From c43c5445d4374df20e342d1aafab4406bc0d3bd2 Mon Sep 17 00:00:00 2001 From: Wo Jake <87929946+wojake@users.noreply.github.com> Date: Mon, 5 Sep 2022 07:50:27 +0000 Subject: [PATCH] Fixup --- .../submit-and-verify/py/submit-and-verify.py | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/content/_code-samples/submit-and-verify/py/submit-and-verify.py b/content/_code-samples/submit-and-verify/py/submit-and-verify.py index 881c6624a3..4d8256b8bd 100644 --- a/content/_code-samples/submit-and-verify/py/submit-and-verify.py +++ b/content/_code-samples/submit-and-verify/py/submit-and-verify.py @@ -1,16 +1,12 @@ from xrpl.clients import JsonRpcClient from xrpl.models.transactions import AccountSet -from xrpl.transaction import safe_sign_transaction, send_reliable_submission -from xrpl.account import get_next_valid_seq_number -from xrpl.ledger import get_latest_validated_ledger_sequence +from xrpl.transaction import safe_sign_and_autofill_transaction, send_reliable_submission from xrpl.wallet import Wallet -from xrpl.core import keypairs -myAddr = "r31FLxNkfFJwRXbJw82RYB6Fa7jmfA3ix1" -mySeed = "sn51LT5QeaPYhjM1HL9-----------" +myAddr = "rM4vA4uRpc2MtCoc4vdhhTwWqsWcncwaLL" +mySeed = "ssJ4QYQLXomJLSKBT----------" # Derive and initialize wallet -public, private = keypairs.derive_keypair(mySeed) wallet_from_seed = Wallet(mySeed, 0) # Connect to a testnet node @@ -19,14 +15,12 @@ client = JsonRpcClient(JSON_RPC_URL) # Construct AccountSet transaction tx = AccountSet( - account=myAddr, - fee="10", - sequence=get_next_valid_seq_number(address=myAddr, client=client), - last_ledger_sequence=get_latest_validated_ledger_sequence(client=client)+20, + account=myAddr ) -# Sign the transaction locally & submit transaction and verify its validity on the ledger -my_tx_payment_signed = safe_sign_transaction(transaction=tx, wallet=wallet_from_seed) +# Sign the transaction locally +my_tx_payment_signed = safe_sign_and_autofill_transaction(transaction=tx, wallet=wallet_from_seed, client=client) +# Submit transaction and verify its validity on the ledger response = send_reliable_submission(transaction=my_tx_payment_signed, client=client) result = response.result["meta"]["TransactionResult"]