|
|
|
@ -14,7 +14,14 @@
|
|
|
|
|
# You should have received a copy of the License along with this library.
|
|
|
|
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
|
|
|
import pytest
|
|
|
|
|
from stellar_sdk import Account, Asset, Network, TransactionBuilder, TrustLineEntryFlag
|
|
|
|
|
from stellar_sdk import (
|
|
|
|
|
Account,
|
|
|
|
|
Asset,
|
|
|
|
|
Network,
|
|
|
|
|
TransactionBuilder,
|
|
|
|
|
TrustLineEntryFlag,
|
|
|
|
|
MuxedAccount,
|
|
|
|
|
)
|
|
|
|
|
from stellar_sdk.strkey import StrKey
|
|
|
|
|
|
|
|
|
|
from trezorlib import messages, stellar
|
|
|
|
@ -837,3 +844,163 @@ def test_path_payment_strict_send():
|
|
|
|
|
assert operations[0].paths[1].type == messages.StellarAssetType.ALPHANUM12
|
|
|
|
|
assert operations[0].paths[1].code == path_asset2.code
|
|
|
|
|
assert operations[0].paths[1].issuer == path_asset2.issuer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_payment_muxed_account_not_support_raise():
|
|
|
|
|
tx = make_default_tx()
|
|
|
|
|
destination = MuxedAccount(
|
|
|
|
|
"GDNSSYSCSSJ76FER5WEEXME5G4MTCUBKDRQSKOYP36KUKVDB2VCMERS6", 1
|
|
|
|
|
)
|
|
|
|
|
amount = "50.0111"
|
|
|
|
|
asset_code = "XLM"
|
|
|
|
|
asset_issuer = None
|
|
|
|
|
operation_source = "GAEB4MRKRCONK4J7MVQXAHTNDPAECUCCCNE7YC5CKM34U3OJ673A4D6V"
|
|
|
|
|
|
|
|
|
|
envelope = tx.append_payment_op(
|
|
|
|
|
destination=destination,
|
|
|
|
|
amount=amount,
|
|
|
|
|
asset_code=asset_code,
|
|
|
|
|
asset_issuer=asset_issuer,
|
|
|
|
|
source=operation_source,
|
|
|
|
|
).build()
|
|
|
|
|
|
|
|
|
|
with pytest.raises(ValueError, match="MuxedAccount is not supported"):
|
|
|
|
|
stellar.from_envelope(envelope)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_path_payment_strict_send_muxed_account_not_support_raise():
|
|
|
|
|
tx = make_default_tx()
|
|
|
|
|
destination = MuxedAccount(
|
|
|
|
|
"GDNSSYSCSSJ76FER5WEEXME5G4MTCUBKDRQSKOYP36KUKVDB2VCMERS6", 1
|
|
|
|
|
)
|
|
|
|
|
send_amount = "50.0112"
|
|
|
|
|
dest_min = "120"
|
|
|
|
|
send_code = "XLM"
|
|
|
|
|
send_issuer = None
|
|
|
|
|
dest_code = "USD"
|
|
|
|
|
dest_issuer = "GCSJ7MFIIGIRMAS4R3VT5FIFIAOXNMGDI5HPYTWS5X7HH74FSJ6STSGF"
|
|
|
|
|
operation_source = "GAEB4MRKRCONK4J7MVQXAHTNDPAECUCCCNE7YC5CKM34U3OJ673A4D6V"
|
|
|
|
|
path_asset1 = Asset(
|
|
|
|
|
"JPY", "GD6PV7DXQJX7AGVXFQ2MTCLTCH6LR3E6IO2EO2YDZD7F7IOZZCCB5DSQ"
|
|
|
|
|
)
|
|
|
|
|
path_asset2 = Asset(
|
|
|
|
|
"BANANA", "GC7EKO37HNSKQ3V6RZ274EO7SFOWASQRHLX3OR5FIZK6UMV6LIEDXHGZ"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
envelope = tx.append_path_payment_strict_send_op(
|
|
|
|
|
destination=destination,
|
|
|
|
|
send_code=send_code,
|
|
|
|
|
send_issuer=send_issuer,
|
|
|
|
|
send_amount=send_amount,
|
|
|
|
|
dest_code=dest_code,
|
|
|
|
|
dest_issuer=dest_issuer,
|
|
|
|
|
dest_min=dest_min,
|
|
|
|
|
path=[path_asset1, path_asset2],
|
|
|
|
|
source=operation_source,
|
|
|
|
|
).build()
|
|
|
|
|
|
|
|
|
|
with pytest.raises(ValueError, match="MuxedAccount is not supported"):
|
|
|
|
|
stellar.from_envelope(envelope)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_path_payment_strict_receive_muxed_account_not_support_raise():
|
|
|
|
|
tx = make_default_tx()
|
|
|
|
|
destination = MuxedAccount(
|
|
|
|
|
"GDNSSYSCSSJ76FER5WEEXME5G4MTCUBKDRQSKOYP36KUKVDB2VCMERS6", 1
|
|
|
|
|
)
|
|
|
|
|
send_max = "50.0111"
|
|
|
|
|
dest_amount = "100"
|
|
|
|
|
send_code = "XLM"
|
|
|
|
|
send_issuer = None
|
|
|
|
|
dest_code = "USD"
|
|
|
|
|
dest_issuer = "GCSJ7MFIIGIRMAS4R3VT5FIFIAOXNMGDI5HPYTWS5X7HH74FSJ6STSGF"
|
|
|
|
|
operation_source = "GAEB4MRKRCONK4J7MVQXAHTNDPAECUCCCNE7YC5CKM34U3OJ673A4D6V"
|
|
|
|
|
path_asset1 = Asset(
|
|
|
|
|
"JPY", "GD6PV7DXQJX7AGVXFQ2MTCLTCH6LR3E6IO2EO2YDZD7F7IOZZCCB5DSQ"
|
|
|
|
|
)
|
|
|
|
|
path_asset2 = Asset(
|
|
|
|
|
"BANANA", "GC7EKO37HNSKQ3V6RZ274EO7SFOWASQRHLX3OR5FIZK6UMV6LIEDXHGZ"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
envelope = tx.append_path_payment_strict_receive_op(
|
|
|
|
|
destination=destination,
|
|
|
|
|
send_code=send_code,
|
|
|
|
|
send_issuer=send_issuer,
|
|
|
|
|
send_max=send_max,
|
|
|
|
|
dest_code=dest_code,
|
|
|
|
|
dest_issuer=dest_issuer,
|
|
|
|
|
dest_amount=dest_amount,
|
|
|
|
|
path=[path_asset1, path_asset2],
|
|
|
|
|
source=operation_source,
|
|
|
|
|
).build()
|
|
|
|
|
|
|
|
|
|
with pytest.raises(ValueError, match="MuxedAccount is not supported"):
|
|
|
|
|
stellar.from_envelope(envelope)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_account_merge_muxed_account_not_support_raise():
|
|
|
|
|
tx = make_default_tx()
|
|
|
|
|
destination = MuxedAccount(
|
|
|
|
|
"GDNSSYSCSSJ76FER5WEEXME5G4MTCUBKDRQSKOYP36KUKVDB2VCMERS6", 1
|
|
|
|
|
)
|
|
|
|
|
operation_source = "GAEB4MRKRCONK4J7MVQXAHTNDPAECUCCCNE7YC5CKM34U3OJ673A4D6V"
|
|
|
|
|
|
|
|
|
|
envelope = tx.append_account_merge_op(
|
|
|
|
|
destination=destination, source=operation_source
|
|
|
|
|
).build()
|
|
|
|
|
|
|
|
|
|
with pytest.raises(ValueError, match="MuxedAccount is not supported"):
|
|
|
|
|
stellar.from_envelope(envelope)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_op_source_muxed_account_not_support_raise():
|
|
|
|
|
tx = make_default_tx()
|
|
|
|
|
destination = "GDNSSYSCSSJ76FER5WEEXME5G4MTCUBKDRQSKOYP36KUKVDB2VCMERS6"
|
|
|
|
|
amount = "50.0111"
|
|
|
|
|
asset_code = "XLM"
|
|
|
|
|
asset_issuer = None
|
|
|
|
|
operation_source = MuxedAccount(
|
|
|
|
|
"GAEB4MRKRCONK4J7MVQXAHTNDPAECUCCCNE7YC5CKM34U3OJ673A4D6V", 2
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
envelope = tx.append_payment_op(
|
|
|
|
|
destination=destination,
|
|
|
|
|
amount=amount,
|
|
|
|
|
asset_code=asset_code,
|
|
|
|
|
asset_issuer=asset_issuer,
|
|
|
|
|
source=operation_source,
|
|
|
|
|
).build()
|
|
|
|
|
|
|
|
|
|
with pytest.raises(ValueError, match="MuxedAccount is not supported"):
|
|
|
|
|
stellar.from_envelope(envelope)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_tx_source_muxed_account_not_support_raise():
|
|
|
|
|
source_account = Account(
|
|
|
|
|
account_id=MuxedAccount(TX_SOURCE, 123456), sequence=SEQUENCE
|
|
|
|
|
)
|
|
|
|
|
destination = "GDNSSYSCSSJ76FER5WEEXME5G4MTCUBKDRQSKOYP36KUKVDB2VCMERS6"
|
|
|
|
|
amount = "50.0111"
|
|
|
|
|
asset_code = "XLM"
|
|
|
|
|
asset_issuer = None
|
|
|
|
|
operation_source = "GAEB4MRKRCONK4J7MVQXAHTNDPAECUCCCNE7YC5CKM34U3OJ673A4D6V"
|
|
|
|
|
|
|
|
|
|
envelope = (
|
|
|
|
|
TransactionBuilder(
|
|
|
|
|
source_account=source_account,
|
|
|
|
|
network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE,
|
|
|
|
|
base_fee=BASE_FEE,
|
|
|
|
|
)
|
|
|
|
|
.add_time_bounds(TIMEBOUNDS_START, TIMEBOUNDS_END)
|
|
|
|
|
.append_payment_op(
|
|
|
|
|
destination=destination,
|
|
|
|
|
amount=amount,
|
|
|
|
|
asset_code=asset_code,
|
|
|
|
|
asset_issuer=asset_issuer,
|
|
|
|
|
source=operation_source,
|
|
|
|
|
)
|
|
|
|
|
.build()
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
with pytest.raises(ValueError, match="MuxedAccount is not supported"):
|
|
|
|
|
stellar.from_envelope(envelope)
|
|
|
|
|