File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
examples/plutus/forty_two Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,13 @@ def submit_tx(tx):
45
45
wait_for_tx (str (tx .id ))
46
46
47
47
48
+ def find_collateral (target_address ):
49
+ for utxo in chain_context .utxos (str (target_address )):
50
+ if isinstance (utxo .output .amount , int ):
51
+ return utxo
52
+ return None
53
+
54
+
48
55
def create_collateral (target_address , skey ):
49
56
collateral_builder = TransactionBuilder (chain_context )
50
57
@@ -96,14 +103,11 @@ def create_collateral(target_address, skey):
96
103
take_output = TransactionOutput (taker_address , 5000000 )
97
104
builder .add_output (take_output )
98
105
99
- non_nft_utxo = None
100
- for utxo in chain_context .utxos (str (taker_address )):
101
- if isinstance (utxo .output .amount , int ):
102
- non_nft_utxo = utxo
103
- break
106
+ non_nft_utxo = find_collateral (taker_address )
104
107
105
108
if non_nft_utxo is None :
106
109
create_collateral (taker_address , payment_skey )
110
+ non_nft_utxo = find_collateral (taker_address )
107
111
108
112
builder .collaterals .append (non_nft_utxo )
109
113
You can’t perform that action at this time.
0 commit comments