Use generate_fauce_wallet

This commit is contained in:
Wo Jake
2022-09-07 02:45:14 +00:00
committed by GitHub
parent 1228047b05
commit aa2c23ae03

View File

@@ -1,19 +1,16 @@
from xrpl.clients import JsonRpcClient
from xrpl.models.transactions import AccountSet
from xrpl.transaction import safe_sign_and_submit_transaction
from xrpl.core import keypairs
from xrpl.wallet import Wallet
myAddr = "rwDMiiYQTnPRxPxPg3DN5FneWmSrx8B2Ej"
mySeed = "sss69gbX4ayqgBHgKRa----------"
# Derive and initialize wallet
wallet_from_seed = Wallet(mySeed, 0)
from xrpl.wallet import generate_faucet_wallet
# Connect to a testnet node
JSON_RPC_URL = "https://s.altnet.rippletest.net:51234/"
client = JsonRpcClient(JSON_RPC_URL)
# Generate a wallet and request faucet
test_wallet = generate_faucet_wallet(client=client)
myAddr = test_wallet.classic_address
# Construct AccountSet transaction
tx = AccountSet(
account=myAddr,
@@ -21,10 +18,11 @@ tx = AccountSet(
)
# Sign the transaction locally and submit to a node
my_tx_payment_signed = safe_sign_and_submit_transaction(tx, wallet=wallet_from_seed, client=client)
my_tx_payment_signed = safe_sign_and_submit_transaction(tx, wallet=test_wallet, client=client)
my_tx_payment_signed = my_tx_payment_signed.result
result = my_tx_payment_signed["engine_result"]
print(f"Account: {myAddr}")
if result == "tesSUCCESS":
print("AccountSet transaction successful, Destination Tag is now required for all incoming transactions")
elif result == "tefMAX_LEDGER":