Last active
July 2, 2020 20:13
-
-
Save hammertoe/8c186408a6ec92ff16ae09192ee600da to your computer and use it in GitHub Desktop.
Send a payment with XRP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xpring | |
import time | |
seed = 'snzBUmvTTAzCCRwGvGfKeA6Zqn4Yf' | |
wallet = xpring.Wallet.from_seed(seed) # create wallet from seed | |
dest = "rszDsdn8bUH9KRxM7DgvJS6oJ1w7kjQBfi" # where we want to send to | |
amount = 1000 # amount in drops to send | |
url = 'test.xrp.xpring.io:50051' | |
client = xpring.Client.from_url(url) | |
txn = client.send(wallet, dest, str(amount)) # create txn | |
res = client.submit(txn) # submit txn to the network | |
# Check it was delivered | |
txid = bytes.fromhex(txn['hash']) | |
client.get_transaction(txid) | |
# Loop and check the ledger to make sure the txn was successful | |
success = False | |
for i in range(5): | |
time.sleep(3) | |
if client.get_transaction(txid).meta.transaction_result.result == 'tesSUCCESS': | |
success = True | |
break | |
print(success) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment