@@ -106,7 +106,7 @@ class TransactionBuilder:
106106
107107 withdrawals : Optional [Withdrawals ] = field (default = None )
108108
109- reference_inputs : Set [TransactionInput ] = field (
109+ reference_inputs : Set [Union [ UTxO , TransactionInput ] ] = field (
110110 init = False , default_factory = lambda : set ()
111111 )
112112
@@ -237,19 +237,19 @@ def add_script_input(
237237
238238 if utxo .output .script :
239239 self ._inputs_to_scripts [utxo ] = utxo .output .script
240- self .reference_inputs .add (utxo . input )
240+ self .reference_inputs .add (utxo )
241241 self ._reference_scripts .append (utxo .output .script )
242242 elif not script :
243243 for i in self .context .utxos (str (utxo .output .address )):
244244 if i .output .script :
245245 self ._inputs_to_scripts [utxo ] = i .output .script
246- self .reference_inputs .add (i . input )
246+ self .reference_inputs .add (i )
247247 self ._reference_scripts .append (i .output .script )
248248 break
249249 elif isinstance (script , UTxO ):
250250 assert script .output .script is not None
251251 self ._inputs_to_scripts [utxo ] = script .output .script
252- self .reference_inputs .add (script . input )
252+ self .reference_inputs .add (script )
253253 self ._reference_scripts .append (script .output .script )
254254 else :
255255 self ._inputs_to_scripts [utxo ] = script
@@ -283,7 +283,7 @@ def add_minting_script(
283283 if isinstance (script , UTxO ):
284284 assert script .output .script is not None
285285 self ._minting_script_to_redeemers .append ((script .output .script , redeemer ))
286- self .reference_inputs .add (script . input )
286+ self .reference_inputs .add (script )
287287 self ._reference_scripts .append (script .output .script )
288288 else :
289289 self ._minting_script_to_redeemers .append ((script , redeemer ))
@@ -772,7 +772,11 @@ def _build_tx_body(self) -> TransactionBody:
772772 withdraws = self .withdrawals ,
773773 collateral_return = self ._collateral_return ,
774774 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 ,
776780 )
777781 return tx_body
778782
0 commit comments