Fix a usage of wallet.sequence

This commit is contained in:
JST5000
2023-06-05 17:29:52 -07:00
parent 35bcc2d636
commit 57ff619f98
2 changed files with 10 additions and 5 deletions

View File

@@ -9,7 +9,6 @@ Django==3.2.19
ECPy==1.2.5
h11==0.12.0
httpcore==0.13.6
# httpx==0.23.0
idna==3.2
image==1.5.33
pifacedigitalio==3.0.5

View File

@@ -2,17 +2,23 @@
import os
my_secret = os.getenv("MYSECRET")
from xrpl.wallet import Wallet
wallet = Wallet(seed=my_secret, sequence=16237283)
print(wallet.classic_address) # "raaFKKmgf6CRZttTVABeTcsqzRQ51bNR6Q"
wallet = Wallet.from_seed(seed=my_secret)
print(wallet.classic_address) # "raaFKKmgf6CRZttTVABeTcsqzRQ51bNR6Q"
# 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.
# This is useful when you need multiple signatures and may want to process transactions out-of-order.
# For details, see: https://xrpl.org/tickets.html
sequence = 0
from xrpl.models.transactions import Payment
from xrpl.utils import xrp_to_drops
my_payment = Payment(
account=wallet.classic_address,
account=wallet.address,
amount=xrp_to_drops(22),
fee="10",
destination="rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
sequence=wallet.sequence, # this needs to be incremented upon every successful transaction
sequence=sequence,
)
print("Payment object:", my_payment)