Skip to content

Commit 38acb87

Browse files
committed
Add test to tx builder
1 parent 22f9c63 commit 38acb87

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

test/pycardano/test_txbuilder.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,75 @@ def test_tx_builder_small_utxo_input(chain_context):
966966
signed_tx = builder.build(change_address=address)
967967

968968

969+
def test_tx_builder_small_utxo_input_2(chain_context):
970+
with patch.object(chain_context, "utxos") as mock_utxos:
971+
mock_utxos.return_value = [
972+
UTxO(
973+
TransactionInput.from_primitive(
974+
[
975+
"233a835316f4c27bceafdd190639c9c7b834224a7ab7fce13330495437d977fa",
976+
0,
977+
]
978+
),
979+
TransactionOutput.from_primitive(
980+
[
981+
"addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr",
982+
5639430,
983+
]
984+
),
985+
),
986+
UTxO(
987+
TransactionInput.from_primitive(
988+
[
989+
"233a835316f4c27bceafdd190639c9c7b834224a7ab7fce13330495437d977fa",
990+
1,
991+
]
992+
),
993+
TransactionOutput.from_primitive(
994+
[
995+
"addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr",
996+
[
997+
1379280,
998+
{
999+
bytes.fromhex(
1000+
"c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece"
1001+
): {
1002+
b"x your eyes": 1,
1003+
}
1004+
},
1005+
],
1006+
]
1007+
),
1008+
),
1009+
]
1010+
builder = TransactionBuilder(chain_context)
1011+
address = Address.from_primitive(
1012+
"addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr"
1013+
)
1014+
builder.add_input_address(address)
1015+
1016+
builder.add_output(
1017+
TransactionOutput(
1018+
Address.from_primitive(
1019+
"addr1qxx7lc2kyrjp4qf3gkpezp24ugu35em2f5h05apejzzy73c7yf794gk9yzhngdse36rae52c7a6rv5seku25cd8ntves7f5fe4"
1020+
),
1021+
Value.from_primitive(
1022+
[
1023+
3000000,
1024+
{
1025+
bytes.fromhex(
1026+
"c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece"
1027+
): {
1028+
b"x your eyes": 1,
1029+
}
1030+
},
1031+
],
1032+
),
1033+
)
1034+
)
1035+
signed_tx = builder.build(change_address=address)
1036+
1037+
9691038
def test_tx_builder_merge_change_to_output_3(chain_context):
9701039
with patch.object(chain_context, "utxos") as mock_utxos:
9711040
mock_utxos.return_value = [

0 commit comments

Comments
 (0)