mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-05 04:15:50 +00:00
Update and rename create_token_check.py to create_checks.py
This commit is contained in:
@@ -10,7 +10,6 @@ client = JsonRpcClient("https://s.altnet.rippletest.net:51234") # connect to the
|
|||||||
"""Create a token check"""
|
"""Create a token check"""
|
||||||
|
|
||||||
"""Helper methods for working with token names"""
|
"""Helper methods for working with token names"""
|
||||||
|
|
||||||
def symbol_to_hex(symbol: str = None) -> str:
|
def symbol_to_hex(symbol: str = None) -> str:
|
||||||
"""token symbol_to_hex."""
|
"""token symbol_to_hex."""
|
||||||
if len(symbol) > 3:
|
if len(symbol) > 3:
|
||||||
@@ -18,7 +17,6 @@ def symbol_to_hex(symbol: str = None) -> str:
|
|||||||
return bytes_string.hex().upper().ljust(40, '0')
|
return bytes_string.hex().upper().ljust(40, '0')
|
||||||
return symbol
|
return symbol
|
||||||
|
|
||||||
|
|
||||||
# check sender seed
|
# check sender seed
|
||||||
sender_seed = "sxxxxxxxxxxxxxxxxxxxx"
|
sender_seed = "sxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
||||||
@@ -60,3 +58,43 @@ stxn_result = stxn_response.result
|
|||||||
# print result and transaction hash
|
# print result and transaction hash
|
||||||
print(stxn_result["meta"]["TransactionResult"])
|
print(stxn_result["meta"]["TransactionResult"])
|
||||||
print(stxn_result["hash"])
|
print(stxn_result["hash"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############ CREATE XRP CHECK ################################
|
||||||
|
"""Create xrp check"""
|
||||||
|
|
||||||
|
# check sender seed
|
||||||
|
sender_seed = "sxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
||||||
|
# check receiver address
|
||||||
|
receiver_addr = "rxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
|
||||||
|
# amount of xrp to deliver
|
||||||
|
amount = 10.00
|
||||||
|
|
||||||
|
# check expiry date
|
||||||
|
expiry_date = int # from xrpl.utils import datetime_to_ripple_time()
|
||||||
|
|
||||||
|
# generate wallet from seed
|
||||||
|
sender_wallet = Wallet(seed=sender_seed, sequence=0)
|
||||||
|
|
||||||
|
# build check create transaction
|
||||||
|
check_txn = CheckCreate(account=sender_wallet.classic_address,
|
||||||
|
destination=receiver_addr,
|
||||||
|
send_max=xrp_to_drops(amount),
|
||||||
|
expiration=expiry_date)
|
||||||
|
|
||||||
|
# sign transaction
|
||||||
|
stxn = safe_sign_and_autofill_transaction(check_txn, sender_wallet, client)
|
||||||
|
|
||||||
|
# submit transaction and wait for result
|
||||||
|
stxn_response = send_reliable_submission(stxn, client)
|
||||||
|
|
||||||
|
# parse response for result
|
||||||
|
stxn_result = stxn_response.result
|
||||||
|
|
||||||
|
# print result and transaction hash
|
||||||
|
print(stxn_result["meta"]["TransactionResult"])
|
||||||
|
print(stxn_result["hash"])
|
||||||
Reference in New Issue
Block a user