@@ -311,3 +311,63 @@ def test_plutus_v2_ref_script(self):
311
311
self .chain_context .submit_tx (signed_tx )
312
312
313
313
self .assert_output (taker_address , take_output )
314
+
315
+ @retry (tries = TEST_RETRIES , backoff = 1.5 , delay = 6 , jitter = (0 , 4 ))
316
+ @pytest .mark .post_alonzo
317
+ def test_transaction_chaining (self ):
318
+ giver_address = Address (self .payment_vkey .hash (), network = self .NETWORK )
319
+ builder = TransactionBuilder (self .chain_context )
320
+ builder .add_input_address (giver_address )
321
+ builder .add_output (TransactionOutput (giver_address , 50000000 ))
322
+ tx1 = builder .build_and_sign ([self .payment_skey ], giver_address )
323
+
324
+ utxo_to_spend = UTxO (
325
+ TransactionInput (tx1 .id , 0 ), tx1 .transaction_body .outputs [0 ]
326
+ )
327
+
328
+ builder = TransactionBuilder (self .chain_context )
329
+ builder .add_input (utxo_to_spend )
330
+ builder .add_output (TransactionOutput (giver_address , 25000000 ))
331
+ tx2 = builder .build_and_sign ([self .payment_skey ], giver_address )
332
+
333
+ self .chain_context .submit_tx (tx1 )
334
+ self .chain_context .submit_tx (tx2 )
335
+
336
+ @retry (tries = TEST_RETRIES , backoff = 1.5 , delay = 6 , jitter = (0 , 4 ))
337
+ @pytest .mark .post_alonzo
338
+ def test_get_plutus_script (self ):
339
+ # ----------- Giver give ---------------
340
+ with open ("./plutus_scripts/fortytwoV2.plutus" , "r" ) as f :
341
+ script_hex = f .read ()
342
+ forty_two_script = PlutusV2Script (cbor2 .loads (bytes .fromhex (script_hex )))
343
+
344
+ script_hash = plutus_script_hash (forty_two_script )
345
+
346
+ script_address = Address (script_hash , network = self .NETWORK )
347
+
348
+ giver_address = Address (self .payment_vkey .hash (), network = self .NETWORK )
349
+
350
+ builder = TransactionBuilder (self .chain_context )
351
+ builder .add_input_address (giver_address )
352
+ builder .add_output (
353
+ TransactionOutput (script_address , 50000000 , script = forty_two_script )
354
+ )
355
+
356
+ signed_tx = builder .build_and_sign ([self .payment_skey ], giver_address )
357
+
358
+ print ("############### Transaction created ###############" )
359
+ print (signed_tx )
360
+ print (signed_tx .to_cbor_hex ())
361
+ print ("############### Submitting transaction ###############" )
362
+ self .chain_context .submit_tx (signed_tx )
363
+ time .sleep (3 )
364
+
365
+ utxos = self .chain_context .utxos (script_address )
366
+
367
+ assert utxos [0 ].output .script == forty_two_script
368
+
369
+
370
+ class TestPlutusOgmiosOnly (TestPlutus ):
371
+ @classmethod
372
+ def setup_class (cls ):
373
+ cls .chain_context ._kupo_url = None
0 commit comments