@@ -426,6 +426,7 @@ def build_raw_tx(
426
426
treasury_donation : int | None = None ,
427
427
invalid_hereafter : int | None = None ,
428
428
invalid_before : int | None = None ,
429
+ src_addr_utxos : list [structs .UTXOData ] | None = None ,
429
430
join_txouts : bool = True ,
430
431
destination_dir : itp .FileType = "." ,
431
432
) -> structs .TxRawOutput :
@@ -466,6 +467,7 @@ def build_raw_tx(
466
467
treasury_donation: A donation to the treasury to perform (optional).
467
468
invalid_hereafter: A last block when the transaction is still valid (optional).
468
469
invalid_before: A first block when the transaction is valid (optional).
470
+ src_addr_utxos: A list of UTxOs for the source address (optional).
469
471
join_txouts: A bool indicating whether to aggregate transaction outputs
470
472
by payment address (True by default).
471
473
destination_dir: A path to directory for storing artifacts (optional).
@@ -495,6 +497,7 @@ def build_raw_tx(
495
497
script_withdrawals = script_withdrawals ,
496
498
deposit = deposit ,
497
499
treasury_donation = treasury_donation ,
500
+ src_addr_utxos = src_addr_utxos ,
498
501
skip_asset_balancing = False ,
499
502
)
500
503
@@ -609,6 +612,7 @@ def calculate_tx_fee(
609
612
treasury_donation : int | None = None ,
610
613
invalid_hereafter : int | None = None ,
611
614
invalid_before : int | None = None ,
615
+ src_addr_utxos : list [structs .UTXOData ] | None = None ,
612
616
witness_count_add : int = 0 ,
613
617
join_txouts : bool = True ,
614
618
destination_dir : itp .FileType = "." ,
@@ -650,6 +654,7 @@ def calculate_tx_fee(
650
654
treasury_donation: A donation to the treasury to perform (optional).
651
655
invalid_hereafter: A last block when the transaction is still valid (optional).
652
656
invalid_before: A first block when the transaction is valid (optional).
657
+ src_addr_utxos: A list of UTxOs for the source address (optional).
653
658
witness_count_add: A number of witnesses to add - workaround to make the fee
654
659
calculation more precise.
655
660
join_txouts: A bool indicating whether to aggregate transaction outputs
@@ -693,6 +698,7 @@ def calculate_tx_fee(
693
698
script_votes = script_votes ,
694
699
invalid_hereafter = invalid_hereafter or ttl ,
695
700
invalid_before = invalid_before ,
701
+ src_addr_utxos = src_addr_utxos ,
696
702
deposit = deposit ,
697
703
current_treasury_value = current_treasury_value ,
698
704
treasury_donation = treasury_donation ,
@@ -1309,6 +1315,15 @@ def send_tx(
1309
1315
script_withdrawals = script_withdrawals ,
1310
1316
)
1311
1317
1318
+ # Get UTxOs for src address here so the records can be passed around, and it is
1319
+ # not necessary to get them once for fee calculation and again for the final transaction
1320
+ # building.
1321
+ src_addr_utxos = (
1322
+ self ._clusterlib_obj .g_query .get_utxo (address = src_address )
1323
+ if fee is None and not txins
1324
+ else None
1325
+ )
1326
+
1312
1327
if fee is None :
1313
1328
fee = self .calculate_tx_fee (
1314
1329
src_address = src_address ,
@@ -1331,6 +1346,7 @@ def send_tx(
1331
1346
current_treasury_value = current_treasury_value ,
1332
1347
treasury_donation = treasury_donation ,
1333
1348
invalid_hereafter = invalid_hereafter or ttl ,
1349
+ src_addr_utxos = src_addr_utxos ,
1334
1350
witness_count_add = witness_count_add ,
1335
1351
join_txouts = join_txouts ,
1336
1352
destination_dir = destination_dir ,
@@ -1364,6 +1380,7 @@ def send_tx(
1364
1380
treasury_donation = treasury_donation ,
1365
1381
invalid_hereafter = invalid_hereafter or ttl ,
1366
1382
invalid_before = invalid_before ,
1383
+ src_addr_utxos = src_addr_utxos ,
1367
1384
join_txouts = join_txouts ,
1368
1385
destination_dir = destination_dir ,
1369
1386
)
0 commit comments