|
2 | 2 | from test.pycardano.test_key import SK
|
3 | 3 | from test.pycardano.util import chain_context
|
4 | 4 |
|
5 |
| -import cbor2 |
6 | 5 | import pytest
|
7 |
| -from nacl.encoding import RawEncoder |
8 |
| -from nacl.hash import blake2b |
9 | 6 |
|
10 | 7 | from pycardano.address import Address
|
11 | 8 | from pycardano.coinselection import RandomImproveMultiAsset
|
|
14 | 11 | InvalidTransactionException,
|
15 | 12 | UTxOSelectionException,
|
16 | 13 | )
|
17 |
| -from pycardano.hash import SCRIPT_HASH_SIZE, ScriptHash |
18 | 14 | from pycardano.key import VerificationKey
|
19 | 15 | from pycardano.nativescript import (
|
20 | 16 | InvalidBefore,
|
|
37 | 33 | Value,
|
38 | 34 | )
|
39 | 35 | from pycardano.txbuilder import TransactionBuilder
|
| 36 | +from pycardano.utils import fee |
40 | 37 | from pycardano.witness import VerificationKeyWitness
|
41 | 38 |
|
42 | 39 |
|
@@ -170,9 +167,8 @@ def test_tx_builder_raises_utxo_selection(chain_context):
|
170 | 167 |
|
171 | 168 | with pytest.raises(UTxOSelectionException) as e:
|
172 | 169 | tx_body = tx_builder.build(change_address=sender_address)
|
173 |
| - assert "Unfulfilled amount:" in e.value.args[0] |
174 |
| - # The unfulfilled amount includes requested (991000000) and estimated fees (161101) |
175 |
| - assert "'coin': 991161101" in e.value.args[0] |
| 170 | + # The unfulfilled amount includes requested (991000000) and estimated fees (161277) |
| 171 | + assert "Unfulfilled amount:\n {'coin': 991161277" in e.value.args[0] |
176 | 172 | assert "{AssetName(b'NewToken'): 1}" in e.value.args[0]
|
177 | 173 |
|
178 | 174 |
|
@@ -609,15 +605,15 @@ def test_tx_builder_exact_fee_no_change(chain_context):
|
609 | 605 | TransactionOutput.from_primitive([sender, input_amount - tx_body.fee])
|
610 | 606 | )
|
611 | 607 |
|
612 |
| - tx_body = tx_builder.build() |
| 608 | + tx = tx_builder.build_and_sign([SK]) |
613 | 609 |
|
614 | 610 | expected = {
|
615 | 611 | 0: [[b"11111111111111111111111111111111", 3]],
|
616 | 612 | 1: [
|
617 |
| - # First output |
618 |
| - [sender_address.to_primitive(), 9836391], |
| 613 | + [sender_address.to_primitive(), 9836215], |
619 | 614 | ],
|
620 |
| - 2: 163609, |
| 615 | + 2: 163785, |
621 | 616 | }
|
622 | 617 |
|
623 |
| - assert expected == tx_body.to_primitive() |
| 618 | + assert expected == tx.transaction_body.to_primitive() |
| 619 | + assert tx.transaction_body.fee >= fee(chain_context, len(tx.to_cbor("bytes"))) |
0 commit comments