This commit is contained in:
Wo Jake
2022-09-04 17:13:39 +00:00
committed by GitHub
parent befb872e3b
commit b581f53728

View File

@@ -1,11 +1,13 @@
from xrpl.clients import JsonRpcClient from xrpl.clients import JsonRpcClient
from xrpl.models.transactions import AccountSet from xrpl.models.transactions import AccountSet
from xrpl.transaction import safe_sign_and_submit_transaction from xrpl.transaction import safe_sign_transaction, send_reliable_submission
from xrpl.core import keypairs from xrpl.account import get_next_valid_seq_number
from xrpl.ledger import get_latest_validated_ledger_sequence
from xrpl.wallet import Wallet from xrpl.wallet import Wallet
from xrpl.core import keypairs
myAddr = "rfaNymVS1fEREj4FpNroXVEcVVMph6k2Mt" myAddr = "r31FLxNkfFJwRXbJw82RYB6Fa7jmfA3ix1"
mySeed = "ss3GZzmyEBxvwB3LUv-----------" mySeed = "sn51LT5QeaPYhjM1HL9-----------"
# Derive and initialize wallet # Derive and initialize wallet
public, private = keypairs.derive_keypair(mySeed) public, private = keypairs.derive_keypair(mySeed)
@@ -18,15 +20,15 @@ client = JsonRpcClient(JSON_RPC_URL)
# Construct AccountSet transaction # Construct AccountSet transaction
tx = AccountSet( tx = AccountSet(
account=myAddr, 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,
) )
# Sign the transaction locally & submit transaction and verify its validity on the ledger # 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) my_tx_payment_signed = safe_sign_transaction(transaction=tx, wallet=wallet_from_seed)
response = send_reliable_submission(transaction=my_tx_payment_signed, client=client) response = send_reliable_submission(transaction=my_tx_payment_signed, client=client)
result = response.result["engine_result"] result = response.result["meta"]["TransactionResult"]
my_tx_payment_signed = my_tx_payment_signed.result
result = my_tx_payment_signed["engine_result"]
if result == "tesSUCCESS": if result == "tesSUCCESS":
print("Transaction successful!") print("Transaction successful!")