Skip to content

Instantly share code, notes, and snippets.

@mvadari
Last active September 30, 2021 13:47
Show Gist options
  • Save mvadari/83a0c5323ed8b842fdf312b715f4209c to your computer and use it in GitHub Desktop.
Save mvadari/83a0c5323ed8b842fdf312b715f4209c to your computer and use it in GitHub Desktop.
The code from the Apex Dev Summit 2021 xrpl-py demo
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# To install the library:
# pip install xrpl-py
from xrpl.clients import JsonRpcClient
client = JsonRpcClient('https://s.altnet.rippletest.net:51234')
from xrpl.models import Ping
client.request(Ping())
from xrpl.wallet import generate_faucet_wallet
wallet = generate_faucet_wallet(client)
print(wallet)
from xrpl.account import get_balance
from xrpl.utils import drops_to_xrp
drops_to_xrp(str(get_balance(wallet.classic_address, client)))
from xrpl.models import Payment
from xrpl.utils import xrp_to_drops
payment = Payment(account=wallet.classic_address, amount=xrp_to_drops(30), destination='rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe')
print(payment)
from xrpl.transaction import safe_sign_and_autofill_transaction
signed_payment = safe_sign_and_autofill_transaction(payment, wallet, client)
signed_payment
from xrpl.transaction import send_reliable_submission
response = send_reliable_submission(signed_payment, client)
print(response)
from pprint import pprint
pprint(response.result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment