Update finish_escrow.py

This commit is contained in:
Obiajulu
2022-10-04 01:10:14 -07:00
committed by GitHub
parent ad6d411b05
commit 98064790d9

View File

@@ -4,38 +4,39 @@ from xrpl.transaction import (safe_sign_and_autofill_transaction,
send_reliable_submission)
from xrpl.wallet import Wallet, generate_faucet_wallet
client = JsonRpcClient("https://s.altnet.rippletest.net:51234") # connect to the testnetwork
client = JsonRpcClient("https://s.altnet.rippletest.net:51234") # Connect to the testnetwork
# Complete an escrow
# cannot be called until the finish time is reached
# Cannot be called until the finish time is reached
escrow_creator = generate_faucet_wallet(client=client).classic_address # ecsrow creator/ sender address
escrow_seq = 27641268 # escrow sequence
escrow_creator = generate_faucet_wallet(client=client).classic_address
# optional fields
escrow_sequence = 27641268
# cryptic condition that must be met before escrow can be completed, passed on escrow creation
# Optional fields
# Cryptio condition that must be met before escrow can be completed, passed on escrow creation
condition = "A02580203882E2EB9B44130530541C4CC360D079F265792C4A7ED3840968897CB7DF2DA1810120"
# cryptic fulfillment of the condtion
# Cryptio fulfillment of the condtion
fulfillment = "A0228020AED2C5FE4D147D310D3CFEBD9BFA81AD0F63CE1ADD92E00379DDDAF8E090E24C"
# generate wallet object
# Sender wallet object
sender_wallet = generate_faucet_wallet(client=client)
# build escrow finish transaction
# Build escrow finish transaction
finish_txn = EscrowFinish(account=sender_wallet.classic_address, owner=escrow_creator, offer_sequence=escrow_seq, condition=condition, fulfillment=fulfillment)
# sign transaction with wallet
# Sign transaction with wallet
stxn = safe_sign_and_autofill_transaction(finish_txn, sender_wallet, client)
# send transaction and wait for response
# Send transaction and wait for response
stxn_response = send_reliable_submission(stxn, client)
# parse response and return result
# Parse response and return result
stxn_result = stxn_response.result
# parse result and print out the transaction result and transaction hash
# Parse result and print out the transaction result and transaction hash
print(stxn_result["meta"]["TransactionResult"])
print(stxn_result["hash"])