File tree 2 files changed +6
-11
lines changed 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -1350,12 +1350,9 @@ def build(
1350
1350
1351
1351
unfulfilled_amount = requested_amount - trimmed_selected_amount
1352
1352
1353
- can_use_again_multi_asset = unfulfilled_amount .multi_asset .filter (
1354
- lambda p , n , v : v < 0
1355
- )
1356
- can_use_again = Value (
1357
- min (0 , unfulfilled_amount .coin ) * - 1 , can_use_again_multi_asset
1358
- )
1353
+ remaining = trimmed_selected_amount - requested_amount
1354
+ remaining .multi_asset = remaining .multi_asset .filter (lambda p , n , v : v > 0 )
1355
+ remaining .coin = max (0 , remaining .coin )
1359
1356
1360
1357
if change_address is not None and not can_merge_change :
1361
1358
# If change address is provided and remainder is smaller than minimum ADA required in change,
@@ -1415,7 +1412,7 @@ def build(
1415
1412
self .context ,
1416
1413
include_max_fee = False ,
1417
1414
respect_min_utxo = not can_merge_change ,
1418
- existing_amount = can_use_again ,
1415
+ existing_amount = remaining ,
1419
1416
)
1420
1417
1421
1418
for s in selected :
Original file line number Diff line number Diff line change @@ -443,7 +443,7 @@ def test_tx_builder_burn_multi_asset(chain_context):
443
443
tx_builder = TransactionBuilder (chain_context )
444
444
sender = "addr_test1vrm9x2zsux7va6w892g38tvchnzahvcd9tykqf3ygnmwtaqyfg52x"
445
445
sender_address : Address = Address .from_primitive (sender )
446
- print ( "1" )
446
+
447
447
# Add sender address as input
448
448
to_burn = MultiAsset .from_primitive ({policy_id .payload : {b"Token1" : - 1 }})
449
449
tx_input = TransactionInput .from_primitive ([b"1" * 32 , 123 ])
@@ -455,13 +455,12 @@ def test_tx_builder_burn_multi_asset(chain_context):
455
455
),
456
456
)
457
457
)
458
- print ( "2" )
458
+
459
459
tx_builder .add_input_address (sender ).add_output (
460
460
TransactionOutput .from_primitive ([sender , 3000000 ])
461
461
).add_output (TransactionOutput .from_primitive ([sender , 2000000 ]))
462
462
463
463
tx_builder .mint = to_burn
464
- print ("3" )
465
464
tx_body = tx_builder .build (change_address = sender_address )
466
465
467
466
assert tx_input in tx_body .inputs
@@ -2401,7 +2400,6 @@ def test_token_transfer_with_change(chain_context):
2401
2400
),
2402
2401
)
2403
2402
tx_builder .add_output (TransactionOutput (receiver_address , output_value ))
2404
- # print(tx_builder)
2405
2403
2406
2404
# Build transaction with change going back to vault
2407
2405
tx = tx_builder .build (change_address = vault_address , merge_change = True )
You can’t perform that action at this time.
0 commit comments