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.models import CheckCash, IssuedCurrencyAmount
|
||||
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
|
||||
|
||||
# Connect to a network
|
||||
@@ -53,7 +53,7 @@ sender_wallet = generate_faucet_wallet(client=client)
|
||||
|
||||
# Build check cash transaction
|
||||
check_txn = CheckCash(account=sender_wallet.address, check_id=check_id, amount=IssuedCurrencyAmount(
|
||||
currency=str_to_hex(token),
|
||||
currency=token,
|
||||
issuer=issuer,
|
||||
value=amount))
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
||||
from xrpl.clients import JsonRpcClient
|
||||
from xrpl.models import CheckCreate, IssuedCurrencyAmount
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
# Build check create transaction
|
||||
check_txn = CheckCreate(account=sender_wallet.address, destination=receiver_addr,
|
||||
send_max=IssuedCurrencyAmount(
|
||||
currency=str_to_hex(token),
|
||||
issuer=issuer,
|
||||
value=amount),
|
||||
check_txn = CheckCreate(account=sender_wallet.address, destination=check_receiver_addr,
|
||||
send_max=IssuedCurrencyAmount(
|
||||
currency=token_name,
|
||||
issuer=token_issuer,
|
||||
value=amount_to_deliver),
|
||||
expiration=expiry_date)
|
||||
|
||||
# Autofill, sign, then submit transaction and wait for result
|
||||
@@ -60,8 +60,8 @@ sender_wallet = generate_faucet_wallet(client=client)
|
||||
|
||||
# Build check create transaction
|
||||
check_txn = CheckCreate(account=sender_wallet.address,
|
||||
destination=receiver_addr,
|
||||
send_max=xrp_to_drops(amount),
|
||||
destination=check_receiver_addr,
|
||||
send_max=xrp_to_drops(amount_to_deliver),
|
||||
expiration=expiry_date)
|
||||
|
||||
# Autofill, sign, then submit transaction and wait for result
|
||||
|
||||
Reference in New Issue
Block a user