@@ -106,7 +106,7 @@ class TransactionBuilder:
106
106
107
107
withdrawals : Optional [Withdrawals ] = field (default = None )
108
108
109
- reference_inputs : Set [TransactionInput ] = field (
109
+ reference_inputs : Set [Union [ UTxO , TransactionInput ] ] = field (
110
110
init = False , default_factory = lambda : set ()
111
111
)
112
112
@@ -237,19 +237,19 @@ def add_script_input(
237
237
238
238
if utxo .output .script :
239
239
self ._inputs_to_scripts [utxo ] = utxo .output .script
240
- self .reference_inputs .add (utxo . input )
240
+ self .reference_inputs .add (utxo )
241
241
self ._reference_scripts .append (utxo .output .script )
242
242
elif not script :
243
243
for i in self .context .utxos (str (utxo .output .address )):
244
244
if i .output .script :
245
245
self ._inputs_to_scripts [utxo ] = i .output .script
246
- self .reference_inputs .add (i . input )
246
+ self .reference_inputs .add (i )
247
247
self ._reference_scripts .append (i .output .script )
248
248
break
249
249
elif isinstance (script , UTxO ):
250
250
assert script .output .script is not None
251
251
self ._inputs_to_scripts [utxo ] = script .output .script
252
- self .reference_inputs .add (script . input )
252
+ self .reference_inputs .add (script )
253
253
self ._reference_scripts .append (script .output .script )
254
254
else :
255
255
self ._inputs_to_scripts [utxo ] = script
@@ -283,7 +283,7 @@ def add_minting_script(
283
283
if isinstance (script , UTxO ):
284
284
assert script .output .script is not None
285
285
self ._minting_script_to_redeemers .append ((script .output .script , redeemer ))
286
- self .reference_inputs .add (script . input )
286
+ self .reference_inputs .add (script )
287
287
self ._reference_scripts .append (script .output .script )
288
288
else :
289
289
self ._minting_script_to_redeemers .append ((script , redeemer ))
@@ -772,7 +772,11 @@ def _build_tx_body(self) -> TransactionBody:
772
772
withdraws = self .withdrawals ,
773
773
collateral_return = self ._collateral_return ,
774
774
total_collateral = self ._total_collateral ,
775
- reference_inputs = list (self .reference_inputs ) or None ,
775
+ reference_inputs = [
776
+ i .input if isinstance (i , UTxO ) else i for i in self .reference_inputs
777
+ ]
778
+ if self .reference_inputs
779
+ else None ,
776
780
)
777
781
return tx_body
778
782
0 commit comments