mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 04:05:49 +00:00
Change classic_address to address xrpl-py
This commit is contained in:
@@ -69,7 +69,7 @@ def sign_transaction(xrp_amount, destination, ledger_seq, wallet_seq, password):
|
|||||||
|
|
||||||
print("5. Constructing payment transaction...")
|
print("5. Constructing payment transaction...")
|
||||||
my_tx_payment = Payment(
|
my_tx_payment = Payment(
|
||||||
account=_wallet.classic_address,
|
account=_wallet.address,
|
||||||
amount=xrp_to_drops(xrp=xrp_amount),
|
amount=xrp_to_drops(xrp=xrp_amount),
|
||||||
destination=destination,
|
destination=destination,
|
||||||
last_ledger_sequence=validated_seq + 100,
|
last_ledger_sequence=validated_seq + 100,
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ class TWaXLFrame(wx.Frame):
|
|||||||
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
||||||
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
||||||
x_address = wallet.get_xaddress(is_test=self.test_network)
|
x_address = wallet.get_xaddress(is_test=self.test_network)
|
||||||
classic_address = wallet.classic_address
|
classic_address = wallet.address
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ class TWaXLFrame(wx.Frame):
|
|||||||
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
||||||
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
||||||
x_address = wallet.get_xaddress(is_test=self.test_network)
|
x_address = wallet.get_xaddress(is_test=self.test_network)
|
||||||
classic_address = wallet.classic_address
|
classic_address = wallet.address
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ class TWaXLFrame(wx.Frame):
|
|||||||
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
||||||
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
||||||
x_address = wallet.get_xaddress(is_test=self.test_network)
|
x_address = wallet.get_xaddress(is_test=self.test_network)
|
||||||
classic_address = wallet.classic_address
|
classic_address = wallet.address
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ class TWaXLFrame(wx.Frame):
|
|||||||
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
||||||
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
||||||
x_address = wallet.get_xaddress(is_test=self.test_network)
|
x_address = wallet.get_xaddress(is_test=self.test_network)
|
||||||
classic_address = wallet.classic_address
|
classic_address = wallet.address
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ class TWaXLFrame(wx.Frame):
|
|||||||
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
||||||
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
||||||
x_address = wallet.get_xaddress(is_test=self.test_network)
|
x_address = wallet.get_xaddress(is_test=self.test_network)
|
||||||
classic_address = wallet.classic_address
|
classic_address = wallet.address
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class XRPLMonitorThread(Thread):
|
|||||||
))
|
))
|
||||||
if response.is_successful():
|
if response.is_successful():
|
||||||
print("set regular key: got account")
|
print("set regular key: got account")
|
||||||
if response.result["account_data"].get("RegularKey") == wallet.classic_address:
|
if response.result["account_data"].get("RegularKey") == wallet.address:
|
||||||
print("set regular key: regular key matches")
|
print("set regular key: regular key matches")
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
wx.CallAfter(self.gui.enable_readwrite)
|
wx.CallAfter(self.gui.enable_readwrite)
|
||||||
@@ -640,7 +640,7 @@ class TWaXLFrame(wx.Frame):
|
|||||||
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
seed_bytes, alg = xrpl.core.addresscodec.decode_seed(value)
|
||||||
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
wallet = xrpl.wallet.Wallet.from_seed(seed=value)
|
||||||
x_address = wallet.get_xaddress(is_test=self.test_network)
|
x_address = wallet.get_xaddress(is_test=self.test_network)
|
||||||
classic_address = wallet.classic_address
|
classic_address = wallet.address
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ check_id = "F944CB379DEE18EFDA7A58A4F81AF1A98C46E54A8B9F2D268F1E26610BC0EB03"
|
|||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
# Build check cancel transaction
|
# Build check cancel transaction
|
||||||
check_txn = CheckCancel(account=sender_wallet.classic_address, check_id=check_id)
|
check_txn = CheckCancel(account=sender_wallet.address, check_id=check_id)
|
||||||
|
|
||||||
# Sign and submit transaction
|
# Sign and submit transaction
|
||||||
stxn_response = submit_and_wait(check_txn, client, sender_wallet)
|
stxn_response = submit_and_wait(check_txn, client, sender_wallet)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ amount = 10.00
|
|||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
# Build check cash transaction
|
# Build check cash transaction
|
||||||
check_txn = CheckCash(account=sender_wallet.classic_address, check_id=check_id, amount=xrp_to_drops(amount))
|
check_txn = CheckCash(account=sender_wallet.address, check_id=check_id, amount=xrp_to_drops(amount))
|
||||||
|
|
||||||
# Autofill, sign, then submit transaction and wait for result
|
# Autofill, sign, then submit transaction and wait for result
|
||||||
stxn_response = submit_and_wait(check_txn, client, sender_wallet)
|
stxn_response = submit_and_wait(check_txn, client, sender_wallet)
|
||||||
@@ -46,13 +46,13 @@ token = "USD"
|
|||||||
amount = 10.00
|
amount = 10.00
|
||||||
|
|
||||||
# Token issuer address
|
# Token issuer address
|
||||||
issuer = generate_faucet_wallet(client=client).classic_address
|
issuer = generate_faucet_wallet(client=client).address
|
||||||
|
|
||||||
# Create sender wallet object
|
# Create sender wallet object
|
||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
# Build check cash transaction
|
# Build check cash transaction
|
||||||
check_txn = CheckCash(account=sender_wallet.classic_address, check_id=check_id, amount=IssuedCurrencyAmount(
|
check_txn = CheckCash(account=sender_wallet.address, check_id=check_id, amount=IssuedCurrencyAmount(
|
||||||
currency=str_to_hex(token),
|
currency=str_to_hex(token),
|
||||||
issuer=issuer,
|
issuer=issuer,
|
||||||
value=amount))
|
value=amount))
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ expiry_date = datetime_to_ripple_time(datetime.now() + timedelta(days=5))
|
|||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
# Build check create transaction
|
# Build check create transaction
|
||||||
check_txn = CheckCreate(account=sender_wallet.classic_address, destination=receiver_addr,
|
check_txn = CheckCreate(account=sender_wallet.address, destination=receiver_addr,
|
||||||
send_max=IssuedCurrencyAmount(
|
send_max=IssuedCurrencyAmount(
|
||||||
currency=str_to_hex(token),
|
currency=str_to_hex(token),
|
||||||
issuer=issuer,
|
issuer=issuer,
|
||||||
@@ -59,7 +59,7 @@ expiry_date = datetime_to_ripple_time(datetime.now() + timedelta(days=5))
|
|||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
# Build check create transaction
|
# Build check create transaction
|
||||||
check_txn = CheckCreate(account=sender_wallet.classic_address,
|
check_txn = CheckCreate(account=sender_wallet.address,
|
||||||
destination=receiver_addr,
|
destination=receiver_addr,
|
||||||
send_max=xrp_to_drops(amount),
|
send_max=xrp_to_drops(amount),
|
||||||
expiration=expiry_date)
|
expiration=expiry_date)
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
# Get credentials from the Testnet Faucet
|
# Get credentials from the Testnet Faucet
|
||||||
print("Requesting an account from the Testnet faucet...")
|
print("Requesting an account from the Testnet faucet...")
|
||||||
test_wallet = generate_faucet_wallet(client=client)
|
test_wallet = generate_faucet_wallet(client=client)
|
||||||
myAddr = test_wallet.classic_address
|
myAddr = test_wallet.address
|
||||||
|
|
||||||
print(f"\n Account: {test_wallet.classic_address}")
|
print(f"\n Account: {test_wallet.address}")
|
||||||
print(f" Seed: {test_wallet.seed}")
|
print(f" Seed: {test_wallet.seed}")
|
||||||
|
|
||||||
# This is a well known blackhole address
|
# This is a well known blackhole address
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ escrow_sequence = 30215126
|
|||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
# Build escrow cancel transaction
|
# Build escrow cancel transaction
|
||||||
cancel_txn = EscrowCancel(account=sender_wallet.classic_address, owner=sender_wallet.classic_address, offer_sequence=escrow_sequence)
|
cancel_txn = EscrowCancel(account=sender_wallet.address, owner=sender_wallet.address, offer_sequence=escrow_sequence)
|
||||||
|
|
||||||
# Autofill, sign, then submit transaction and wait for result
|
# Autofill, sign, then submit transaction and wait for result
|
||||||
stxn_response = submit_and_wait(cancel_txn, client, sender_wallet)
|
stxn_response = submit_and_wait(cancel_txn, client, sender_wallet)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ sender_wallet = generate_faucet_wallet(client=client)
|
|||||||
|
|
||||||
# Build escrow create transaction
|
# Build escrow create transaction
|
||||||
create_txn = EscrowCreate(
|
create_txn = EscrowCreate(
|
||||||
account=sender_wallet.classic_address,
|
account=sender_wallet.address,
|
||||||
amount=xrp_to_drops(amount_to_escrow),
|
amount=xrp_to_drops(amount_to_escrow),
|
||||||
destination=receiver_addr,
|
destination=receiver_addr,
|
||||||
finish_after=claim_date,
|
finish_after=claim_date,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ client = JsonRpcClient("https://s.altnet.rippletest.net:51234") # Connect to the
|
|||||||
# Cannot be called until the finish time is reached
|
# Cannot be called until the finish time is reached
|
||||||
|
|
||||||
# Required fields (modify to match an escrow you create)
|
# Required fields (modify to match an escrow you create)
|
||||||
escrow_creator = generate_faucet_wallet(client=client).classic_address
|
escrow_creator = generate_faucet_wallet(client=client).address
|
||||||
|
|
||||||
escrow_sequence = 27641268
|
escrow_sequence = 27641268
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ fulfillment = "A0228020AED2C5FE4D147D310D3CFEBD9BFA81AD0F63CE1ADD92E00379DDDAF8E
|
|||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
# Build escrow finish transaction
|
# Build escrow finish transaction
|
||||||
finish_txn = EscrowFinish(account=sender_wallet.classic_address, owner=escrow_creator, offer_sequence=escrow_sequence, condition=condition, fulfillment=fulfillment)
|
finish_txn = EscrowFinish(account=sender_wallet.address, owner=escrow_creator, offer_sequence=escrow_sequence, condition=condition, fulfillment=fulfillment)
|
||||||
|
|
||||||
# Autofill, sign, then submit transaction and wait for result
|
# Autofill, sign, then submit transaction and wait for result
|
||||||
stxn_response = submit_and_wait(finish_txn, client, sender_wallet)
|
stxn_response = submit_and_wait(finish_txn, client, sender_wallet)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ sender_wallet = generate_faucet_wallet(client=client)
|
|||||||
print("Successfully generated test wallet")
|
print("Successfully generated test wallet")
|
||||||
|
|
||||||
# build accountset transaction to disable freezing
|
# build accountset transaction to disable freezing
|
||||||
accountset = AccountSet(account=sender_wallet.classic_address, set_flag=AccountSetFlag.ASF_NO_FREEZE)
|
accountset = AccountSet(account=sender_wallet.address, set_flag=AccountSetFlag.ASF_NO_FREEZE)
|
||||||
|
|
||||||
print("Now sending an AccountSet transaction to set the ASF_NO_FREEZE flag...")
|
print("Now sending an AccountSet transaction to set the ASF_NO_FREEZE flag...")
|
||||||
|
|
||||||
@@ -25,6 +25,6 @@ stxn_result = stxn_response.result
|
|||||||
|
|
||||||
# print result and transaction hash
|
# print result and transaction hash
|
||||||
if stxn_result["meta"]["TransactionResult"] == "tesSUCCESS":
|
if stxn_result["meta"]["TransactionResult"] == "tesSUCCESS":
|
||||||
print(f'Successfully enabled no freeze for {sender_wallet.classic_address}')
|
print(f'Successfully enabled no freeze for {sender_wallet.address}')
|
||||||
print(stxn_result["hash"])
|
print(stxn_result["hash"])
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ token_name = "FOO"
|
|||||||
# Amount a trustline can handle, for this transaction it is set to 0
|
# Amount a trustline can handle, for this transaction it is set to 0
|
||||||
value = "100"
|
value = "100"
|
||||||
|
|
||||||
target_addr = generate_faucet_wallet(client=client).classic_address
|
target_addr = generate_faucet_wallet(client=client).address
|
||||||
|
|
||||||
sender_wallet = generate_faucet_wallet(client=client)
|
sender_wallet = generate_faucet_wallet(client=client)
|
||||||
|
|
||||||
print("Successfully generated test wallets")
|
print("Successfully generated test wallets")
|
||||||
|
|
||||||
# Build trustline freeze transaction
|
# Build trustline freeze transaction
|
||||||
trustset = TrustSet(account=sender_wallet.classic_address, limit_amount=IssuedCurrencyAmount(
|
trustset = TrustSet(account=sender_wallet.address, limit_amount=IssuedCurrencyAmount(
|
||||||
currency= token_name,
|
currency= token_name,
|
||||||
issuer=target_addr,
|
issuer=target_addr,
|
||||||
value = value),
|
value = value),
|
||||||
@@ -33,6 +33,6 @@ stxn_response = submit_and_wait(trustset, client, sender_wallet)
|
|||||||
stxn_result = stxn_response.result
|
stxn_result = stxn_response.result
|
||||||
|
|
||||||
if(stxn_result["meta"]["TransactionResult"] == 'tesSUCCESS'):
|
if(stxn_result["meta"]["TransactionResult"] == 'tesSUCCESS'):
|
||||||
print(f"Froze {token_name} issued by {target_addr} for address {sender_wallet.classic_address}")
|
print(f"Froze {token_name} issued by {target_addr} for address {sender_wallet.address}")
|
||||||
if(stxn_result["meta"]["TransactionResult"] == 'tesSUCCESS'):
|
if(stxn_result["meta"]["TransactionResult"] == 'tesSUCCESS'):
|
||||||
print(f"Froze {token_name} issued by {target_addr} for address {sender_wallet.classic_address}")
|
print(f"Froze {token_name} issued by {target_addr} for address {sender_wallet.address}")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ sender_wallet = generate_faucet_wallet(client)
|
|||||||
print("Successfully generated test wallet")
|
print("Successfully generated test wallet")
|
||||||
|
|
||||||
# Build accountset transaction to enable global freeze
|
# Build accountset transaction to enable global freeze
|
||||||
accountset = AccountSet(account=sender_wallet.classic_address,
|
accountset = AccountSet(account=sender_wallet.address,
|
||||||
set_flag=AccountSetFlag.ASF_GLOBAL_FREEZE)
|
set_flag=AccountSetFlag.ASF_GLOBAL_FREEZE)
|
||||||
|
|
||||||
print("Preparing and submitting Account set transaction with ASF_GLOBAL_FREEZE ...")
|
print("Preparing and submitting Account set transaction with ASF_GLOBAL_FREEZE ...")
|
||||||
@@ -24,5 +24,5 @@ stxn_result = stxn_response.result
|
|||||||
|
|
||||||
# Print result and transaction hash
|
# Print result and transaction hash
|
||||||
if stxn_result["meta"]["TransactionResult"] == "tesSUCCESS":
|
if stxn_result["meta"]["TransactionResult"] == "tesSUCCESS":
|
||||||
print(f'Successfully enabled global freeze for {sender_wallet.classic_address}')
|
print(f'Successfully enabled global freeze for {sender_wallet.address}')
|
||||||
print(stxn_result["hash"])
|
print(stxn_result["hash"])
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ value = "0"
|
|||||||
print("Generating two test wallets...")
|
print("Generating two test wallets...")
|
||||||
|
|
||||||
# Address to unfreeze trustline
|
# Address to unfreeze trustline
|
||||||
target_addr = generate_faucet_wallet(client=client).classic_address
|
target_addr = generate_faucet_wallet(client=client).address
|
||||||
print("Successfully generated the target account")
|
print("Successfully generated the target account")
|
||||||
|
|
||||||
# Sender wallet
|
# Sender wallet
|
||||||
@@ -22,7 +22,7 @@ print("Successfully generated the sender account")
|
|||||||
print("Successfully generated test wallets")
|
print("Successfully generated test wallets")
|
||||||
|
|
||||||
# Build trustline freeze transaction
|
# Build trustline freeze transaction
|
||||||
trustset = TrustSet(account=sender_wallet.classic_address, limit_amount=IssuedCurrencyAmount(
|
trustset = TrustSet(account=sender_wallet.address, limit_amount=IssuedCurrencyAmount(
|
||||||
currency=token_name,
|
currency=token_name,
|
||||||
issuer=target_addr,
|
issuer=target_addr,
|
||||||
value = value
|
value = value
|
||||||
@@ -39,7 +39,7 @@ stxn_result = stxn_response.result
|
|||||||
|
|
||||||
# Print result and transaction hash
|
# Print result and transaction hash
|
||||||
if stxn_result["meta"]["TransactionResult"] == "tesSUCCESS":
|
if stxn_result["meta"]["TransactionResult"] == "tesSUCCESS":
|
||||||
print(f'Successfully enabled no freeze for {sender_wallet.classic_address}')
|
print(f'Successfully enabled no freeze for {sender_wallet.address}')
|
||||||
if stxn_result["meta"]["TransactionResult"] == "tecNO_LINE_REDUNDANT":
|
if stxn_result["meta"]["TransactionResult"] == "tecNO_LINE_REDUNDANT":
|
||||||
print("This was used on an account which didn't have a trustline yet. To try this out, modify `target_addr` to point to an account with a frozen trustline, and make sure the currency code matches.")
|
print("This was used on an account which didn't have a trustline yet. To try this out, modify `target_addr` to point to an account with a frozen trustline, and make sure the currency code matches.")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from xrpl.wallet import generate_faucet_wallet
|
|||||||
test_wallet = generate_faucet_wallet(client, debug=True)
|
test_wallet = generate_faucet_wallet(client, debug=True)
|
||||||
|
|
||||||
# Create an account str from the wallet
|
# Create an account str from the wallet
|
||||||
test_account = test_wallet.classic_address
|
test_account = test_wallet.address
|
||||||
|
|
||||||
# Derive an x-address from the classic address:
|
# Derive an x-address from the classic address:
|
||||||
# https://xrpaddress.info/
|
# https://xrpaddress.info/
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from xrpl.wallet import generate_faucet_wallet
|
|||||||
test_wallet = generate_faucet_wallet(client, debug=True)
|
test_wallet = generate_faucet_wallet(client, debug=True)
|
||||||
|
|
||||||
# Create an account str from the wallet
|
# Create an account str from the wallet
|
||||||
test_account = test_wallet.classic_address
|
test_account = test_wallet.address
|
||||||
|
|
||||||
# Derive an x-address from the classic address:
|
# Derive an x-address from the classic address:
|
||||||
# https://xrpaddress.info/
|
# https://xrpaddress.info/
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ hot_wallet = generate_faucet_wallet(client, debug=True)
|
|||||||
|
|
||||||
# Configure issuer (cold address) settings -------------------------------------
|
# Configure issuer (cold address) settings -------------------------------------
|
||||||
cold_settings_tx = xrpl.models.transactions.AccountSet(
|
cold_settings_tx = xrpl.models.transactions.AccountSet(
|
||||||
account=cold_wallet.classic_address,
|
account=cold_wallet.address,
|
||||||
transfer_rate=0,
|
transfer_rate=0,
|
||||||
tick_size=5,
|
tick_size=5,
|
||||||
domain=bytes.hex("example.com".encode("ASCII")),
|
domain=bytes.hex("example.com".encode("ASCII")),
|
||||||
@@ -33,7 +33,7 @@ print(response)
|
|||||||
|
|
||||||
# Configure hot address settings -----------------------------------------------
|
# Configure hot address settings -----------------------------------------------
|
||||||
hot_settings_tx = xrpl.models.transactions.AccountSet(
|
hot_settings_tx = xrpl.models.transactions.AccountSet(
|
||||||
account=hot_wallet.classic_address,
|
account=hot_wallet.address,
|
||||||
set_flag=xrpl.models.transactions.AccountSetFlag.ASF_REQUIRE_AUTH,
|
set_flag=xrpl.models.transactions.AccountSetFlag.ASF_REQUIRE_AUTH,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -45,10 +45,10 @@ print(response)
|
|||||||
# Create trust line from hot to cold address -----------------------------------
|
# Create trust line from hot to cold address -----------------------------------
|
||||||
currency_code = "FOO"
|
currency_code = "FOO"
|
||||||
trust_set_tx = xrpl.models.transactions.TrustSet(
|
trust_set_tx = xrpl.models.transactions.TrustSet(
|
||||||
account=hot_wallet.classic_address,
|
account=hot_wallet.address,
|
||||||
limit_amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
|
limit_amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
|
||||||
currency=currency_code,
|
currency=currency_code,
|
||||||
issuer=cold_wallet.classic_address,
|
issuer=cold_wallet.address,
|
||||||
value="10000000000", # Large limit, arbitrarily chosen
|
value="10000000000", # Large limit, arbitrarily chosen
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -61,16 +61,16 @@ print(response)
|
|||||||
# Send token -------------------------------------------------------------------
|
# Send token -------------------------------------------------------------------
|
||||||
issue_quantity = "3840"
|
issue_quantity = "3840"
|
||||||
send_token_tx = xrpl.models.transactions.Payment(
|
send_token_tx = xrpl.models.transactions.Payment(
|
||||||
account=cold_wallet.classic_address,
|
account=cold_wallet.address,
|
||||||
destination=hot_wallet.classic_address,
|
destination=hot_wallet.address,
|
||||||
amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
|
amount=xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount(
|
||||||
currency=currency_code,
|
currency=currency_code,
|
||||||
issuer=cold_wallet.classic_address,
|
issuer=cold_wallet.address,
|
||||||
value=issue_quantity
|
value=issue_quantity
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f"Sending {issue_quantity} {currency_code} to {hot_wallet.classic_address}...")
|
print(f"Sending {issue_quantity} {currency_code} to {hot_wallet.address}...")
|
||||||
response = xrpl.transaction.submit_and_wait(send_token_tx, client, cold_wallet)
|
response = xrpl.transaction.submit_and_wait(send_token_tx, client, cold_wallet)
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
@@ -78,15 +78,15 @@ print(response)
|
|||||||
# Check balances ---------------------------------------------------------------
|
# Check balances ---------------------------------------------------------------
|
||||||
print("Getting hot address balances...")
|
print("Getting hot address balances...")
|
||||||
response = client.request(xrpl.models.requests.AccountLines(
|
response = client.request(xrpl.models.requests.AccountLines(
|
||||||
account=hot_wallet.classic_address,
|
account=hot_wallet.address,
|
||||||
ledger_index="validated",
|
ledger_index="validated",
|
||||||
))
|
))
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
print("Getting cold address balances...")
|
print("Getting cold address balances...")
|
||||||
response = client.request(xrpl.models.requests.GatewayBalances(
|
response = client.request(xrpl.models.requests.GatewayBalances(
|
||||||
account=cold_wallet.classic_address,
|
account=cold_wallet.address,
|
||||||
ledger_index="validated",
|
ledger_index="validated",
|
||||||
hotwallet=[hot_wallet.classic_address]
|
hotwallet=[hot_wallet.address]
|
||||||
))
|
))
|
||||||
print(response)
|
print(response)
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ signer_wallet_1 = generate_faucet_wallet(client, debug=True)
|
|||||||
signer_wallet_2 = generate_faucet_wallet(client, debug=True)
|
signer_wallet_2 = generate_faucet_wallet(client, debug=True)
|
||||||
|
|
||||||
signer_entries = [
|
signer_entries = [
|
||||||
SignerEntry(account=signer_wallet_1.classic_address, signer_weight=1),
|
SignerEntry(account=signer_wallet_1.address, signer_weight=1),
|
||||||
SignerEntry(account=signer_wallet_2.classic_address, signer_weight=1),
|
SignerEntry(account=signer_wallet_2.address, signer_weight=1),
|
||||||
]
|
]
|
||||||
signer_list_set_tx = SignerListSet(
|
signer_list_set_tx = SignerListSet(
|
||||||
account=master_wallet.classic_address,
|
account=master_wallet.address,
|
||||||
signer_quorum=2,
|
signer_quorum=2,
|
||||||
signer_entries=signer_entries,
|
signer_entries=signer_entries,
|
||||||
)
|
)
|
||||||
@@ -45,7 +45,7 @@ print(signed_list_set_tx_response)
|
|||||||
# Now that we've set up multisigning, let's try using it to submit an AccountSet
|
# Now that we've set up multisigning, let's try using it to submit an AccountSet
|
||||||
# transaction.
|
# transaction.
|
||||||
account_set_tx = AccountSet(
|
account_set_tx = AccountSet(
|
||||||
account=master_wallet.classic_address, domain=str_to_hex("example.com")
|
account=master_wallet.address, domain=str_to_hex("example.com")
|
||||||
)
|
)
|
||||||
autofilled_account_set_tx = autofill(account_set_tx, client, len(signer_entries))
|
autofilled_account_set_tx = autofill(account_set_tx, client, len(signer_entries))
|
||||||
print("AccountSet transaction is ready to be multisigned")
|
print("AccountSet transaction is ready to be multisigned")
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
|
|
||||||
# Initialize wallet from seed
|
# Initialize wallet from seed
|
||||||
issuer_wallet = generate_faucet_wallet(client=client, wallet=custom_wallet)
|
issuer_wallet = generate_faucet_wallet(client=client, wallet=custom_wallet)
|
||||||
issuerAddr = issuer_wallet.classic_address
|
issuerAddr = issuer_wallet.address
|
||||||
|
|
||||||
# Get minter account credentials from the testnet faucet
|
# Get minter account credentials from the testnet faucet
|
||||||
print("Requesting address from the Testnet faucet...")
|
print("Requesting address from the Testnet faucet...")
|
||||||
nftoken_minter_wallet = generate_faucet_wallet(client=client)
|
nftoken_minter_wallet = generate_faucet_wallet(client=client)
|
||||||
minterAddr = nftoken_minter_wallet.classic_address
|
minterAddr = nftoken_minter_wallet.address
|
||||||
|
|
||||||
print(f"\nMinter Account: {issuerAddr}")
|
print(f"\nMinter Account: {issuerAddr}")
|
||||||
print(f" Seed: {issuer_wallet.seed}")
|
print(f" Seed: {issuer_wallet.seed}")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ else:
|
|||||||
|
|
||||||
# Initialize wallet from seed
|
# Initialize wallet from seed
|
||||||
issuer_wallet = Wallet.from_seed(seed=seed)
|
issuer_wallet = Wallet.from_seed(seed=seed)
|
||||||
issuerAddr = issuer_wallet.classic_address
|
issuerAddr = issuer_wallet.address
|
||||||
|
|
||||||
print(f"\nIssuer Account: {issuerAddr}")
|
print(f"\nIssuer Account: {issuerAddr}")
|
||||||
print(f" Seed: {issuer_wallet.seed}")
|
print(f" Seed: {issuer_wallet.seed}")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ else:
|
|||||||
|
|
||||||
# Initialize wallet from seed
|
# Initialize wallet from seed
|
||||||
wallet = Wallet.from_seed(seed=seed)
|
wallet = Wallet.from_seed(seed=seed)
|
||||||
Addr = wallet.classic_address
|
Addr = wallet.address
|
||||||
|
|
||||||
print(f"\n Account: {Addr}")
|
print(f"\n Account: {Addr}")
|
||||||
print(f" Seed: {seed}")
|
print(f" Seed: {seed}")
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ else:
|
|||||||
|
|
||||||
# Initialize wallet from seed
|
# Initialize wallet from seed
|
||||||
issuer_wallet = Wallet.from_seed(seed=seed)
|
issuer_wallet = Wallet.from_seed(seed=seed)
|
||||||
issuerAddr = issuer_wallet.classic_address
|
issuerAddr = issuer_wallet.address
|
||||||
|
|
||||||
# Get buyer account credentials from the testnet faucet
|
# Get buyer account credentials from the testnet faucet
|
||||||
print("Requesting address from the Testnet faucet...")
|
print("Requesting address from the Testnet faucet...")
|
||||||
buyer_wallet = generate_faucet_wallet(client=client)
|
buyer_wallet = generate_faucet_wallet(client=client)
|
||||||
buyerAddr = buyer_wallet.classic_address
|
buyerAddr = buyer_wallet.address
|
||||||
|
|
||||||
print(f"\n Minter Account: {issuerAddr}")
|
print(f"\n Minter Account: {issuerAddr}")
|
||||||
print(f" Seed: {issuer_wallet.seed}")
|
print(f" Seed: {issuer_wallet.seed}")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ else:
|
|||||||
|
|
||||||
# Initialize wallet from seed
|
# Initialize wallet from seed
|
||||||
issuer_wallet = Wallet.from_seed(seed=seed)
|
issuer_wallet = Wallet.from_seed(seed=seed)
|
||||||
issuerAddr = issuer_wallet.classic_address
|
issuerAddr = issuer_wallet.address
|
||||||
|
|
||||||
print(f"\nIssuer Account: {issuerAddr}")
|
print(f"\nIssuer Account: {issuerAddr}")
|
||||||
print(f" Seed: {issuer_wallet.seed}")
|
print(f" Seed: {issuer_wallet.seed}")
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
if seed == "":
|
if seed == "":
|
||||||
print("Requesting address from the Testnet faucet...")
|
print("Requesting address from the Testnet faucet...")
|
||||||
issuer_wallet = generate_faucet_wallet(client=client)
|
issuer_wallet = generate_faucet_wallet(client=client)
|
||||||
issuerAddr = issuer_wallet.classic_address
|
issuerAddr = issuer_wallet.address
|
||||||
else:
|
else:
|
||||||
issuer_wallet = Wallet.from_seed(seed=seed)
|
issuer_wallet = Wallet.from_seed(seed=seed)
|
||||||
issuerAddr = issuer_wallet.classic_address
|
issuerAddr = issuer_wallet.address
|
||||||
|
|
||||||
print(f"\nIssuer Account: {issuerAddr}")
|
print(f"\nIssuer Account: {issuerAddr}")
|
||||||
print(f" Seed: {issuer_wallet.seed}")
|
print(f" Seed: {issuer_wallet.seed}")
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
# Get issuer, minter, buyer account credentials from the Testnet Faucet
|
# Get issuer, minter, buyer account credentials from the Testnet Faucet
|
||||||
print("Requesting address from the Testnet faucet...")
|
print("Requesting address from the Testnet faucet...")
|
||||||
issuer_wallet = generate_faucet_wallet(client=client)
|
issuer_wallet = generate_faucet_wallet(client=client)
|
||||||
issuerAddr = issuer_wallet.classic_address
|
issuerAddr = issuer_wallet.address
|
||||||
|
|
||||||
nftoken_minter_wallet = generate_faucet_wallet(client=client)
|
nftoken_minter_wallet = generate_faucet_wallet(client=client)
|
||||||
minterAddr = nftoken_minter_wallet.classic_address
|
minterAddr = nftoken_minter_wallet.address
|
||||||
|
|
||||||
buyer_wallet = generate_faucet_wallet(client=client)
|
buyer_wallet = generate_faucet_wallet(client=client)
|
||||||
buyerAddr = buyer_wallet.classic_address
|
buyerAddr = buyer_wallet.address
|
||||||
|
|
||||||
print(f" Minter Account: {issuerAddr}"
|
print(f" Minter Account: {issuerAddr}"
|
||||||
f"\n Authorized Minter Account: {minterAddr}"
|
f"\n Authorized Minter Account: {minterAddr}"
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ wallet2 = generate_faucet_wallet(client, debug=True)
|
|||||||
|
|
||||||
# Create a TrustSet to issue an IOU `FOO` and set limit on it
|
# Create a TrustSet to issue an IOU `FOO` and set limit on it
|
||||||
trust_set_tx = TrustSet(
|
trust_set_tx = TrustSet(
|
||||||
account=wallet2.classic_address,
|
account=wallet2.address,
|
||||||
limit_amount=IssuedCurrencyAmount(
|
limit_amount=IssuedCurrencyAmount(
|
||||||
currency="FOO",
|
currency="FOO",
|
||||||
value="10000000000",
|
value="10000000000",
|
||||||
issuer=wallet1.classic_address,
|
issuer=wallet1.address,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -34,21 +34,21 @@ signed_trust_set_tx = submit_and_wait(trust_set_tx, client, wallet2)
|
|||||||
|
|
||||||
# Both balances should be zero since nothing has been sent yet
|
# Both balances should be zero since nothing has been sent yet
|
||||||
print("Balances after trustline is claimed:")
|
print("Balances after trustline is claimed:")
|
||||||
print("Balance of ${wallet1.classic_address} is:")
|
print("Balance of ${wallet1.address} is:")
|
||||||
print((client.request(AccountLines(account=wallet1.classic_address))).result["lines"])
|
print((client.request(AccountLines(account=wallet1.address))).result["lines"])
|
||||||
print("Balance of ${wallet2.classic_address} is:")
|
print("Balance of ${wallet2.address} is:")
|
||||||
print((client.request(AccountLines(account=wallet2.classic_address))).result["lines"])
|
print((client.request(AccountLines(account=wallet2.address))).result["lines"])
|
||||||
|
|
||||||
# Create a Payment to send 3840 FOO from wallet1 (issuer) to destination (wallet2)
|
# Create a Payment to send 3840 FOO from wallet1 (issuer) to destination (wallet2)
|
||||||
issue_quantity = "3840"
|
issue_quantity = "3840"
|
||||||
payment_tx = Payment(
|
payment_tx = Payment(
|
||||||
account=wallet1.classic_address,
|
account=wallet1.address,
|
||||||
amount=IssuedCurrencyAmount(
|
amount=IssuedCurrencyAmount(
|
||||||
currency="FOO",
|
currency="FOO",
|
||||||
value=issue_quantity,
|
value=issue_quantity,
|
||||||
issuer=wallet1.classic_address,
|
issuer=wallet1.address,
|
||||||
),
|
),
|
||||||
destination=wallet2.classic_address,
|
destination=wallet2.address,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Sign and autofill, then send transaction to the ledger
|
# Sign and autofill, then send transaction to the ledger
|
||||||
@@ -57,10 +57,10 @@ print("Initial Payment response: ", payment_response)
|
|||||||
|
|
||||||
# Issuer (wallet1) should have -3840 FOO and destination (wallet2) should have 3840 FOO
|
# Issuer (wallet1) should have -3840 FOO and destination (wallet2) should have 3840 FOO
|
||||||
print("Balances after wallet1 sends 3840 FOO to wallet2:")
|
print("Balances after wallet1 sends 3840 FOO to wallet2:")
|
||||||
print("Balance of ${wallet1.classic_address} is:")
|
print("Balance of ${wallet1.address} is:")
|
||||||
print((client.request(AccountLines(account=wallet1.classic_address))).result["lines"])
|
print((client.request(AccountLines(account=wallet1.address))).result["lines"])
|
||||||
print("Balance of ${wallet2.classic_address} is:")
|
print("Balance of ${wallet2.address} is:")
|
||||||
print((client.request(AccountLines(account=wallet2.classic_address))).result["lines"])
|
print((client.request(AccountLines(account=wallet2.address))).result["lines"])
|
||||||
|
|
||||||
# Send money less than the amount specified on 2 conditions:
|
# Send money less than the amount specified on 2 conditions:
|
||||||
# 1. Sender has less money than the amount specified in the payment Tx.
|
# 1. Sender has less money than the amount specified in the payment Tx.
|
||||||
@@ -72,18 +72,18 @@ print((client.request(AccountLines(account=wallet2.classic_address))).result["li
|
|||||||
|
|
||||||
# Create Payment to send 4000 (of 3840) FOO from wallet2 to wallet1
|
# Create Payment to send 4000 (of 3840) FOO from wallet2 to wallet1
|
||||||
partial_payment_tx = Payment(
|
partial_payment_tx = Payment(
|
||||||
account=wallet2.classic_address,
|
account=wallet2.address,
|
||||||
amount=IssuedCurrencyAmount(
|
amount=IssuedCurrencyAmount(
|
||||||
currency="FOO",
|
currency="FOO",
|
||||||
value="4000",
|
value="4000",
|
||||||
issuer=wallet1.classic_address,
|
issuer=wallet1.address,
|
||||||
),
|
),
|
||||||
destination=wallet1.classic_address,
|
destination=wallet1.address,
|
||||||
flags=[PaymentFlag.TF_PARTIAL_PAYMENT],
|
flags=[PaymentFlag.TF_PARTIAL_PAYMENT],
|
||||||
send_max=IssuedCurrencyAmount(
|
send_max=IssuedCurrencyAmount(
|
||||||
currency="FOO",
|
currency="FOO",
|
||||||
value="1000000",
|
value="1000000",
|
||||||
issuer=wallet1.classic_address,
|
issuer=wallet1.address,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ print("Partial Payment response: ", partial_payment_response)
|
|||||||
|
|
||||||
# Tried sending 4000 of 3840 FOO -> wallet1 and wallet2 should have 0 FOO
|
# Tried sending 4000 of 3840 FOO -> wallet1 and wallet2 should have 0 FOO
|
||||||
print("Balances after Partial Payment, when wallet2 tried to send 4000 FOOs")
|
print("Balances after Partial Payment, when wallet2 tried to send 4000 FOOs")
|
||||||
print("Balance of ${wallet1.classic_address} is:")
|
print("Balance of ${wallet1.address} is:")
|
||||||
print((client.request(AccountLines(account=wallet1.classic_address))).result["lines"])
|
print((client.request(AccountLines(account=wallet1.address))).result["lines"])
|
||||||
print("Balance of ${wallet2.classic_address} is:")
|
print("Balance of ${wallet2.address} is:")
|
||||||
print((client.request(AccountLines(account=wallet2.classic_address))).result["lines"])
|
print((client.request(AccountLines(account=wallet2.address))).result["lines"])
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ destination_amount = IssuedCurrencyAmount(
|
|||||||
|
|
||||||
# Create a RipplePathFind request and have the client call it
|
# Create a RipplePathFind request and have the client call it
|
||||||
path_request = RipplePathFind(
|
path_request = RipplePathFind(
|
||||||
source_account=wallet.classic_address,
|
source_account=wallet.address,
|
||||||
source_currencies=[XRP()],
|
source_currencies=[XRP()],
|
||||||
destination_account=destination_account,
|
destination_account=destination_account,
|
||||||
destination_amount=destination_amount,
|
destination_amount=destination_amount,
|
||||||
@@ -41,7 +41,7 @@ print(paths)
|
|||||||
|
|
||||||
# # Create a Payment to send money from wallet to destination_account using path
|
# # Create a Payment to send money from wallet to destination_account using path
|
||||||
payment_tx = Payment(
|
payment_tx = Payment(
|
||||||
account=wallet.classic_address,
|
account=wallet.address,
|
||||||
amount=destination_amount,
|
amount=destination_amount,
|
||||||
destination=destination_account,
|
destination=destination_account,
|
||||||
paths=paths,
|
paths=paths,
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ wallet2 = generate_faucet_wallet(client, debug=True)
|
|||||||
|
|
||||||
# Both balances should be zero since nothing has been sent yet
|
# Both balances should be zero since nothing has been sent yet
|
||||||
print("Balances of wallets before Payment tx")
|
print("Balances of wallets before Payment tx")
|
||||||
print(get_balance(wallet1.classic_address, client))
|
print(get_balance(wallet1.address, client))
|
||||||
print(get_balance(wallet2.classic_address, client))
|
print(get_balance(wallet2.address, client))
|
||||||
|
|
||||||
# Create a Payment transaction
|
# Create a Payment transaction
|
||||||
payment_tx = Payment(
|
payment_tx = Payment(
|
||||||
account=wallet1.classic_address,
|
account=wallet1.address,
|
||||||
amount="1000",
|
amount="1000",
|
||||||
destination=wallet2.classic_address,
|
destination=wallet2.address,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Autofill, sign, and submit the transaction
|
# Autofill, sign, and submit the transaction
|
||||||
@@ -42,5 +42,5 @@ print("Validated:", tx_response.result["validated"])
|
|||||||
|
|
||||||
# Check balances after 1000 was sent from wallet1 to wallet2
|
# Check balances after 1000 was sent from wallet1 to wallet2
|
||||||
print("Balances of wallets after Payment tx:")
|
print("Balances of wallets after Payment tx:")
|
||||||
print(get_balance(wallet1.classic_address, client))
|
print(get_balance(wallet1.address, client))
|
||||||
print(get_balance(wallet2.classic_address, client))
|
print(get_balance(wallet2.address, client))
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ async def main() -> int:
|
|||||||
|
|
||||||
# Send AccountSet transaction -----------------------------------------------
|
# Send AccountSet transaction -----------------------------------------------
|
||||||
tx = AccountSet(
|
tx = AccountSet(
|
||||||
account=wallet.classic_address,
|
account=wallet.address,
|
||||||
set_flag=AccountSetFlag.ASF_REQUIRE_DEST,
|
set_flag=AccountSetFlag.ASF_REQUIRE_DEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ async def main() -> int:
|
|||||||
print("Requesting account information...")
|
print("Requesting account information...")
|
||||||
account_info = await client.request(
|
account_info = await client.request(
|
||||||
AccountInfo(
|
AccountInfo(
|
||||||
account=wallet.classic_address,
|
account=wallet.address,
|
||||||
ledger_index="validated",
|
ledger_index="validated",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -47,9 +47,9 @@ async def main() -> int:
|
|||||||
# Verify that the AccountRoot lsfRequireDestTag flag is set
|
# Verify that the AccountRoot lsfRequireDestTag flag is set
|
||||||
flags = account_info.result["account_data"]["Flags"]
|
flags = account_info.result["account_data"]["Flags"]
|
||||||
if flags & 0x00020000 != 0:
|
if flags & 0x00020000 != 0:
|
||||||
print(f"Require Destination Tag for account {wallet.classic_address} is enabled.")
|
print(f"Require Destination Tag for account {wallet.address} is enabled.")
|
||||||
else:
|
else:
|
||||||
print(f"Require Destination Tag for account {wallet.classic_address} is DISABLED.")
|
print(f"Require Destination Tag for account {wallet.address} is DISABLED.")
|
||||||
|
|
||||||
# End main()
|
# End main()
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import os
|
|||||||
my_secret = os.getenv("MYSECRET")
|
my_secret = os.getenv("MYSECRET")
|
||||||
from xrpl.wallet import Wallet
|
from xrpl.wallet import Wallet
|
||||||
wallet = Wallet.from_seed(seed=my_secret)
|
wallet = Wallet.from_seed(seed=my_secret)
|
||||||
print(wallet.classic_address) # "raaFKKmgf6CRZttTVABeTcsqzRQ51bNR6Q"
|
print(wallet.address) # "raaFKKmgf6CRZttTVABeTcsqzRQ51bNR6Q"
|
||||||
|
|
||||||
# For offline signing, you need to know your address's next Sequence number.
|
# For offline signing, you need to know your address's next Sequence number.
|
||||||
# Alternatively, you could use a Ticket in place of the Sequence number.
|
# Alternatively, you could use a Ticket in place of the Sequence number.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
# Get account credentials from the Testnet Faucet
|
# Get account credentials from the Testnet Faucet
|
||||||
print("Requesting an account from the Testnet faucet...")
|
print("Requesting an account from the Testnet faucet...")
|
||||||
test_wallet = generate_faucet_wallet(client=client)
|
test_wallet = generate_faucet_wallet(client=client)
|
||||||
myAddr = test_wallet.classic_address
|
myAddr = test_wallet.address
|
||||||
|
|
||||||
memo_data = "Example Memo - 123 -=+"
|
memo_data = "Example Memo - 123 -=+"
|
||||||
memo_type = "Text"
|
memo_type = "Text"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Example Credentials ----------------------------------------------------------
|
# Example Credentials ----------------------------------------------------------
|
||||||
from xrpl.wallet import Wallet
|
from xrpl.wallet import Wallet
|
||||||
test_wallet = Wallet.from_seed(seed="sn3nxiW7v8KXzPzAqzyHXbSSKNuN9")
|
test_wallet = Wallet.from_seed(seed="sn3nxiW7v8KXzPzAqzyHXbSSKNuN9")
|
||||||
print(test_wallet.classic_address) # "rMCcNuTcajgw7YTgBy1sys3b89QqjUrMpH"
|
print(test_wallet.address) # "rMCcNuTcajgw7YTgBy1sys3b89QqjUrMpH"
|
||||||
|
|
||||||
# Connect ----------------------------------------------------------------------
|
# Connect ----------------------------------------------------------------------
|
||||||
import xrpl
|
import xrpl
|
||||||
@@ -17,7 +17,7 @@ test_wallet = generate_faucet_wallet(client, debug=True)
|
|||||||
|
|
||||||
# Prepare transaction ----------------------------------------------------------
|
# Prepare transaction ----------------------------------------------------------
|
||||||
my_payment = xrpl.models.transactions.Payment(
|
my_payment = xrpl.models.transactions.Payment(
|
||||||
account=test_wallet.classic_address,
|
account=test_wallet.address,
|
||||||
amount=xrpl.utils.xrp_to_drops(22),
|
amount=xrpl.utils.xrp_to_drops(22),
|
||||||
destination="rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
|
destination="rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ regular_key_wallet = generate_faucet_wallet(client, debug=True)
|
|||||||
|
|
||||||
# Both balances should be zero since nothing has been sent yet
|
# Both balances should be zero since nothing has been sent yet
|
||||||
print("Balances before payment:")
|
print("Balances before payment:")
|
||||||
print(get_balance(wallet1.classic_address, client))
|
print(get_balance(wallet1.address, client))
|
||||||
print(get_balance(wallet2.classic_address, client))
|
print(get_balance(wallet2.address, client))
|
||||||
|
|
||||||
# Assign key pair (regular_key_wallet) to wallet1 using SetRegularKey transaction
|
# Assign key pair (regular_key_wallet) to wallet1 using SetRegularKey transaction
|
||||||
tx = SetRegularKey(
|
tx = SetRegularKey(
|
||||||
account=wallet1.classic_address, regular_key=regular_key_wallet.classic_address
|
account=wallet1.address, regular_key=regular_key_wallet.address
|
||||||
)
|
)
|
||||||
|
|
||||||
set_regular_key_response = submit_and_wait(tx, client, wallet1)
|
set_regular_key_response = submit_and_wait(tx, client, wallet1)
|
||||||
@@ -36,8 +36,8 @@ print(set_regular_key_response)
|
|||||||
# Since regular_key_wallet is linked to wallet1,
|
# Since regular_key_wallet is linked to wallet1,
|
||||||
# walet1 can send payment to wallet2 and have regular_key_wallet sign it
|
# walet1 can send payment to wallet2 and have regular_key_wallet sign it
|
||||||
payment = Payment(
|
payment = Payment(
|
||||||
account=wallet1.classic_address,
|
account=wallet1.address,
|
||||||
destination=wallet2.classic_address,
|
destination=wallet2.address,
|
||||||
amount="1000",
|
amount="1000",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -48,5 +48,5 @@ print(payment_response)
|
|||||||
|
|
||||||
# Balance after sending 1000 from wallet1 to wallet2
|
# Balance after sending 1000 from wallet1 to wallet2
|
||||||
print("Balances after payment:")
|
print("Balances after payment:")
|
||||||
print(get_balance(wallet1.classic_address, client))
|
print(get_balance(wallet1.address, client))
|
||||||
print(get_balance(wallet2.classic_address, client))
|
print(get_balance(wallet2.address, client))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
|
|
||||||
# Generate a wallet and request faucet
|
# Generate a wallet and request faucet
|
||||||
test_wallet = generate_faucet_wallet(client=client)
|
test_wallet = generate_faucet_wallet(client=client)
|
||||||
myAddr = test_wallet.classic_address
|
myAddr = test_wallet.address
|
||||||
|
|
||||||
# Construct AccountSet transaction
|
# Construct AccountSet transaction
|
||||||
tx = AccountSet(
|
tx = AccountSet(
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ async def main() -> int:
|
|||||||
print("Requesting orderbook information...")
|
print("Requesting orderbook information...")
|
||||||
orderbook_info = await client.request(
|
orderbook_info = await client.request(
|
||||||
BookOffers(
|
BookOffers(
|
||||||
taker=wallet.classic_address,
|
taker=wallet.address,
|
||||||
ledger_index="current",
|
ledger_index="current",
|
||||||
taker_gets=we_want["currency"],
|
taker_gets=we_want["currency"],
|
||||||
taker_pays=we_spend["currency"],
|
taker_pays=we_spend["currency"],
|
||||||
@@ -120,7 +120,7 @@ async def main() -> int:
|
|||||||
print("Requesting second orderbook information...")
|
print("Requesting second orderbook information...")
|
||||||
orderbook2_info = await client.request(
|
orderbook2_info = await client.request(
|
||||||
BookOffers(
|
BookOffers(
|
||||||
taker=wallet.classic_address,
|
taker=wallet.address,
|
||||||
ledger_index="current",
|
ledger_index="current",
|
||||||
taker_gets=we_spend["currency"],
|
taker_gets=we_spend["currency"],
|
||||||
taker_pays=we_want["currency"],
|
taker_pays=we_want["currency"],
|
||||||
@@ -164,7 +164,7 @@ async def main() -> int:
|
|||||||
# hard-coded TakerGets and TakerPays amounts.
|
# hard-coded TakerGets and TakerPays amounts.
|
||||||
|
|
||||||
tx = OfferCreate(
|
tx = OfferCreate(
|
||||||
account=wallet.classic_address,
|
account=wallet.address,
|
||||||
taker_gets=we_spend["value"],
|
taker_gets=we_spend["value"],
|
||||||
taker_pays=we_want["currency"].to_amount(we_want["value"]),
|
taker_pays=we_want["currency"].to_amount(we_want["value"]),
|
||||||
)
|
)
|
||||||
@@ -225,18 +225,18 @@ async def main() -> int:
|
|||||||
print("Getting address balances as of validated ledger...")
|
print("Getting address balances as of validated ledger...")
|
||||||
balances = await client.request(
|
balances = await client.request(
|
||||||
AccountLines(
|
AccountLines(
|
||||||
account=wallet.classic_address,
|
account=wallet.address,
|
||||||
ledger_index="validated",
|
ledger_index="validated",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
pprint.pp(balances.result)
|
pprint.pp(balances.result)
|
||||||
|
|
||||||
# Check Offers --------------------------------------------------------------
|
# Check Offers --------------------------------------------------------------
|
||||||
print(f"Getting outstanding Offers from {wallet.classic_address} "
|
print(f"Getting outstanding Offers from {wallet.address} "
|
||||||
f"as of validated ledger...")
|
f"as of validated ledger...")
|
||||||
acct_offers = await client.request(
|
acct_offers = await client.request(
|
||||||
AccountOffers(
|
AccountOffers(
|
||||||
account=wallet.classic_address,
|
account=wallet.address,
|
||||||
ledger_index="validated",
|
ledger_index="validated",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
|
|
||||||
# Generate a wallet and request faucet
|
# Generate a wallet and request faucet
|
||||||
test_wallet = generate_faucet_wallet(client=client)
|
test_wallet = generate_faucet_wallet(client=client)
|
||||||
myAddr = test_wallet.classic_address
|
myAddr = test_wallet.address
|
||||||
|
|
||||||
print("Setting up all the signers' accounts via the testnet faucet, this may take a while...")
|
print("Setting up all the signers' accounts via the testnet faucet, this may take a while...")
|
||||||
signer_1_wallet = generate_faucet_wallet(client=client)
|
signer_1_wallet = generate_faucet_wallet(client=client)
|
||||||
@@ -30,9 +30,9 @@ signer_3_wallet = generate_faucet_wallet(client=client)
|
|||||||
|
|
||||||
# Set the list of accounts that are able to authorize transactions on behalf of our Account via a multi-sig transaction
|
# Set the list of accounts that are able to authorize transactions on behalf of our Account via a multi-sig transaction
|
||||||
signers = [
|
signers = [
|
||||||
SignerEntry(account=signer_1_wallet.classic_address, signer_weight=1),
|
SignerEntry(account=signer_1_wallet.address, signer_weight=1),
|
||||||
SignerEntry(account=signer_2_wallet.classic_address, signer_weight=1),
|
SignerEntry(account=signer_2_wallet.address, signer_weight=1),
|
||||||
SignerEntry(account=signer_3_wallet.classic_address, signer_weight=1)
|
SignerEntry(account=signer_3_wallet.address, signer_weight=1)
|
||||||
]
|
]
|
||||||
|
|
||||||
# Display all the signers' account address
|
# Display all the signers' account address
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ client = JsonRpcClient(JSON_RPC_URL)
|
|||||||
|
|
||||||
# Generate a wallet and request faucet
|
# Generate a wallet and request faucet
|
||||||
test_wallet = generate_faucet_wallet(client=client)
|
test_wallet = generate_faucet_wallet(client=client)
|
||||||
myAddr = test_wallet.classic_address
|
myAddr = test_wallet.address
|
||||||
|
|
||||||
# Construct a TicketCreate transaction, 2 ticket created for future use
|
# Construct a TicketCreate transaction, 2 ticket created for future use
|
||||||
tx = TicketCreate(
|
tx = TicketCreate(
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ You can now use your wallet to send XRP! You can even fund an entirely new accou
|
|||||||
|
|
||||||
import xrpl
|
import xrpl
|
||||||
w = xrpl.wallet.Wallet.create()
|
w = xrpl.wallet.Wallet.create()
|
||||||
print(w.classic_address)
|
print(w.address)
|
||||||
print(w.seed)
|
print(w.seed)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ To sign and submit the transaction:
|
|||||||
|
|
||||||
##### Derive an X-address
|
##### Derive an X-address
|
||||||
|
|
||||||
You can use `xrpl-py`'s [`xrpl.core.addresscodec`](https://xrpl-py.readthedocs.io/en/latest/source/xrpl.core.addresscodec.html) module to derive an [X-address](https://xrpaddress.info/) from the `Wallet.classic_address` field:
|
You can use `xrpl-py`'s [`xrpl.core.addresscodec`](https://xrpl-py.readthedocs.io/en/latest/source/xrpl.core.addresscodec.html) module to derive an [X-address](https://xrpaddress.info/) from the `Wallet.address` field:
|
||||||
|
|
||||||
{{ include_code("_code-samples/get-started/py/get-acct-info.py", start_with="# Derive an x-address from the classic address:", end_before="# Look up info about your account", language="py") }}
|
{{ include_code("_code-samples/get-started/py/get-acct-info.py", start_with="# Derive an x-address from the classic address:", end_before="# Look up info about your account", language="py") }}
|
||||||
|
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ _Python_
|
|||||||
```py
|
```py
|
||||||
from xrpl.wallet import Wallet
|
from xrpl.wallet import Wallet
|
||||||
my_wallet = Wallet.create()
|
my_wallet = Wallet.create()
|
||||||
print(my_wallet.classic_address) # Example: rGCkuB7PBr5tNy68tPEABEtcdno4hE6Y7f
|
print(my_wallet.address) # Example: rGCkuB7PBr5tNy68tPEABEtcdno4hE6Y7f
|
||||||
print(my_wallet.seed) # Example: sp6JS7f14BuwFY8Mw6bTtLKWauoUs
|
print(my_wallet.seed) # Example: sp6JS7f14BuwFY8Mw6bTtLKWauoUs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ _Python_
|
|||||||
```py
|
```py
|
||||||
from xrpl.wallet import Wallet
|
from xrpl.wallet import Wallet
|
||||||
my_wallet = Wallet.create()
|
my_wallet = Wallet.create()
|
||||||
print(my_wallet.classic_address) # Example: rGCkuB7PBr5tNy68tPEABEtcdno4hE6Y7f
|
print(my_wallet.address) # Example: rGCkuB7PBr5tNy68tPEABEtcdno4hE6Y7f
|
||||||
print(my_wallet.seed) # Example: sp6JS7f14BuwFY8Mw6bTtLKWauoUs
|
print(my_wallet.seed) # Example: sp6JS7f14BuwFY8Mw6bTtLKWauoUs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ _Python_
|
|||||||
```py
|
```py
|
||||||
keypair = xrpl.wallet.Wallet.create()
|
keypair = xrpl.wallet.Wallet.create()
|
||||||
print("seed:", keypair.seed)
|
print("seed:", keypair.seed)
|
||||||
print("classic address:", keypair.classic_address)
|
print("classic address:", keypair.address)
|
||||||
```
|
```
|
||||||
|
|
||||||
_JavaScript_
|
_JavaScript_
|
||||||
|
|||||||
Reference in New Issue
Block a user