mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-22 12:45:50 +00:00
Fix check snippets
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
from xrpl.clients import JsonRpcClient
|
from xrpl.clients import JsonRpcClient
|
||||||
from xrpl.models import CheckCash, IssuedCurrencyAmount
|
from xrpl.models import CheckCash, IssuedCurrencyAmount
|
||||||
from xrpl.transaction import submit_and_wait
|
from xrpl.transaction import submit_and_wait
|
||||||
from xrpl.utils import str_to_hex, xrp_to_drops
|
from xrpl.utils import xrp_to_drops
|
||||||
from xrpl.wallet import generate_faucet_wallet
|
from xrpl.wallet import generate_faucet_wallet
|
||||||
|
|
||||||
# Connect to a network
|
# Connect to a network
|
||||||
@@ -53,7 +53,7 @@ sender_wallet = generate_faucet_wallet(client=client)
|
|||||||
|
|
||||||
# Build check cash transaction
|
# Build check cash transaction
|
||||||
check_txn = CheckCash(account=sender_wallet.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=token,
|
||||||
issuer=issuer,
|
issuer=issuer,
|
||||||
value=amount))
|
value=amount))
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
|||||||
from xrpl.clients import JsonRpcClient
|
from xrpl.clients import JsonRpcClient
|
||||||
from xrpl.models import CheckCreate, IssuedCurrencyAmount
|
from xrpl.models import CheckCreate, IssuedCurrencyAmount
|
||||||
from xrpl.transaction import submit_and_wait
|
from xrpl.transaction import submit_and_wait
|
||||||
from xrpl.utils import datetime_to_ripple_time, str_to_hex, xrp_to_drops
|
from xrpl.utils import datetime_to_ripple_time, xrp_to_drops
|
||||||
from xrpl.wallet import generate_faucet_wallet
|
from xrpl.wallet import generate_faucet_wallet
|
||||||
|
|
||||||
client = JsonRpcClient("https://s.altnet.rippletest.net:51234") # Connect to the testnetwork
|
client = JsonRpcClient("https://s.altnet.rippletest.net:51234") # Connect to the testnetwork
|
||||||
@@ -25,12 +25,12 @@ 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.address, destination=receiver_addr,
|
check_txn = CheckCreate(account=sender_wallet.address, destination=check_receiver_addr,
|
||||||
send_max=IssuedCurrencyAmount(
|
send_max=IssuedCurrencyAmount(
|
||||||
currency=str_to_hex(token),
|
currency=token_name,
|
||||||
issuer=issuer,
|
issuer=token_issuer,
|
||||||
value=amount),
|
value=amount_to_deliver),
|
||||||
expiration=expiry_date)
|
expiration=expiry_date)
|
||||||
|
|
||||||
# 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)
|
||||||
@@ -60,9 +60,9 @@ sender_wallet = generate_faucet_wallet(client=client)
|
|||||||
|
|
||||||
# Build check create transaction
|
# Build check create transaction
|
||||||
check_txn = CheckCreate(account=sender_wallet.address,
|
check_txn = CheckCreate(account=sender_wallet.address,
|
||||||
destination=receiver_addr,
|
destination=check_receiver_addr,
|
||||||
send_max=xrp_to_drops(amount),
|
send_max=xrp_to_drops(amount_to_deliver),
|
||||||
expiration=expiry_date)
|
expiration=expiry_date)
|
||||||
|
|
||||||
# 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user