Fix check snippets

This commit is contained in:
JST5000
2023-06-08 15:39:22 -07:00
parent cda4b6e18c
commit 89c3dd86da
2 changed files with 12 additions and 12 deletions

View File

@@ -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))

View File

@@ -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,11 +25,11 @@ 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
@@ -60,8 +60,8 @@ 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