mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-19 19:25:51 +00:00
Remove __name__ == "__main__"
This commit is contained in:
@@ -7,43 +7,42 @@ from xrpl.models.requests import AccountInfo
|
||||
# Stand-alone code sample for the "Require Destination Tags" tutorial:
|
||||
# https://xrpl.org/require-destination-tags.html
|
||||
|
||||
if __name__ == "__main__":
|
||||
lsfRequireDestTag = 131072
|
||||
lsfRequireDestTag = 131072
|
||||
|
||||
# Connect to a testnet node
|
||||
print("Connecting to Testnet...")
|
||||
JSON_RPC_URL = "https://s.altnet.rippletest.net:51234/"
|
||||
client = JsonRpcClient(JSON_RPC_URL)
|
||||
# Connect to a testnet node
|
||||
print("Connecting to Testnet...")
|
||||
JSON_RPC_URL = "https://s.altnet.rippletest.net:51234/"
|
||||
client = JsonRpcClient(JSON_RPC_URL)
|
||||
|
||||
# Get credentials from the Testnet Faucet
|
||||
print("Requesting address from the Testnet faucet...")
|
||||
test_wallet = generate_faucet_wallet(client=client)
|
||||
myAddr = test_wallet.classic_address
|
||||
# Get credentials from the Testnet Faucet
|
||||
print("Requesting address from the Testnet faucet...")
|
||||
test_wallet = generate_faucet_wallet(client=client)
|
||||
myAddr = test_wallet.classic_address
|
||||
|
||||
# Construct AccountSet transaction
|
||||
tx = AccountSet(
|
||||
# Construct AccountSet transaction
|
||||
tx = AccountSet(
|
||||
account=myAddr,
|
||||
set_flag=AccountSetFlag.ASF_REQUIRE_DEST
|
||||
)
|
||||
print(f"Prepared transaction: {tx}")
|
||||
)
|
||||
print(f"Prepared transaction: {tx}")
|
||||
|
||||
# Sign the transaction
|
||||
my_tx_payment_signed = safe_sign_and_autofill_transaction(tx, wallet=test_wallet, client=client)
|
||||
print(f"Transaction Hash: {my_tx_payment_signed.txn_signature}")
|
||||
# Sign the transaction
|
||||
my_tx_payment_signed = safe_sign_and_autofill_transaction(tx, wallet=test_wallet, client=client)
|
||||
print(f"Transaction Hash: {my_tx_payment_signed.txn_signature}")
|
||||
|
||||
# Submit the transaction to the node
|
||||
print(f"Enabling Require Destination Tag flag (asfRequireDest) on {myAddr}")
|
||||
submit_transaction = submit_transaction(client=client, transaction=my_tx_payment_signed)
|
||||
submit_transaction = submit_transaction.result["engine_result"]
|
||||
print(f"Submit result: {submit_transaction}")
|
||||
# Send the transaction to the node
|
||||
print(f"Enabling Require Destination Tag flag (asfRequireDest) on {myAddr}")
|
||||
submit_transaction = submit_transaction(client=client, transaction=my_tx_payment_signed)
|
||||
submit_transaction = submit_transaction.result["engine_result"]
|
||||
print(f"Submit result: {submit_transaction}")
|
||||
|
||||
# Verify Account Settings
|
||||
get_acc_flag = AccountInfo(
|
||||
# Verify Account Settings
|
||||
get_acc_flag = AccountInfo(
|
||||
account=myAddr
|
||||
)
|
||||
response = client.request(get_acc_flag)
|
||||
)
|
||||
response = client.request(get_acc_flag)
|
||||
|
||||
if response.result['account_data']['Flags'] & lsfRequireDestTag:
|
||||
if response.result['account_data']['Flags'] & lsfRequireDestTag:
|
||||
print("Require Destination Tag is enabled.")
|
||||
else:
|
||||
else:
|
||||
print("Require Destination Tag is DISABLED.")
|
||||
|
||||
Reference in New Issue
Block a user