Skip to content

Instantly share code, notes, and snippets.

@hammertoe
Last active July 2, 2020 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hammertoe/8c186408a6ec92ff16ae09192ee600da to your computer and use it in GitHub Desktop.
Save hammertoe/8c186408a6ec92ff16ae09192ee600da to your computer and use it in GitHub Desktop.
Send a payment with XRP
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