Last active
September 30, 2021 13:47
-
-
Save mvadari/83a0c5323ed8b842fdf312b715f4209c to your computer and use it in GitHub Desktop.
The code from the Apex Dev Summit 2021 xrpl-py demo
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
#!/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