Skip to content

Commit bde51ea

Browse files
committed
Add test
1 parent 9f5af3e commit bde51ea

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/pycardano/test_txbuilder.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,46 @@ def test_tx_builder_mint_multi_asset(chain_context):
373373
assert expected == tx_body.to_primitive()
374374

375375

376+
def test_tx_builder_burn_multi_asset(chain_context):
377+
vk1 = VerificationKey.from_cbor(
378+
"58206443a101bdb948366fc87369336224595d36d8b0eee5602cba8b81a024e58473"
379+
)
380+
vk2 = VerificationKey.from_cbor(
381+
"58206443a101bdb948366fc87369336224595d36d8b0eee5602cba8b81a024e58475"
382+
)
383+
spk1 = ScriptPubkey(key_hash=vk1.hash())
384+
spk2 = ScriptPubkey(key_hash=vk2.hash())
385+
before = InvalidHereAfter(123456789)
386+
after = InvalidBefore(123456780)
387+
script = ScriptAll([before, after, spk1, ScriptAll([spk1, spk2])])
388+
policy_id = script.hash()
389+
390+
tx_builder = TransactionBuilder(chain_context)
391+
sender = "addr_test1vrm9x2zsux7va6w892g38tvchnzahvcd9tykqf3ygnmwtaqyfg52x"
392+
sender_address: Address = Address.from_primitive(sender)
393+
394+
# Add sender address as input
395+
to_burn = MultiAsset.from_primitive({policy_id.payload: {b"Token1": -1}})
396+
tx_input = TransactionInput.from_primitive([b"1" * 32, 123])
397+
tx_builder.potential_inputs.append(
398+
UTxO(
399+
tx_input,
400+
TransactionOutput.from_primitive(
401+
[sender, [2000000, {policy_id.payload: {b"Token1": 1}}]]
402+
),
403+
)
404+
)
405+
tx_builder.add_input_address(sender).add_output(
406+
TransactionOutput.from_primitive([sender, 3000000])
407+
).add_output(TransactionOutput.from_primitive([sender, 2000000]))
408+
409+
tx_builder.mint = to_burn
410+
411+
tx_body = tx_builder.build(change_address=sender_address)
412+
413+
assert tx_input in tx_body.inputs
414+
415+
376416
def test_tx_add_change_split_nfts(chain_context):
377417
# Set the max value size to be very small for testing purpose
378418
param = {"max_val_size": 50}

0 commit comments

Comments
 (0)