Resubmit Python2 updates

This commit is contained in:
ddawson
2023-09-05 13:58:05 -07:00
parent 3de3aa68f0
commit 757bfd4c07
17 changed files with 1406 additions and 352 deletions

View File

@@ -1,5 +1,4 @@
import xrpl
import json
from xrpl.clients import JsonRpcClient
from xrpl.wallet import Wallet
from xrpl.models.requests import AccountNFTs
@@ -9,23 +8,20 @@ testnet_url = "https://s.altnet.rippletest.net:51234"
def mint_token(seed, uri, flags, transfer_fee, taxon):
"""mint_token"""
# Get the client
mint_wallet=Wallet(seed, sequence=16237283)
minter_wallet=Wallet.from_seed(seed)
client=JsonRpcClient(testnet_url)
# Define the mint transaction
mint_tx=xrpl.models.transactions.NFTokenMint(
account=mint_wallet.classic_address,
account=minter_wallet.address,
uri=xrpl.utils.str_to_hex(uri),
flags=int(flags),
transfer_fee=int(transfer_fee),
nftoken_taxon=int(taxon)
)
# Sign and fill the transaction
signed_tx = xrpl.transaction.safe_sign_and_autofill_transaction(
mint_tx, mint_wallet, client)
# Submit the transaction and get results
reply=""
try:
response=xrpl.transaction.send_reliable_submission(signed_tx,client)
response=xrpl.transaction.submit_and_wait(mint_tx,client,minter_wallet)
reply=response.result
except xrpl.transaction.XRPLReliableSubmissionException as e:
reply=f"Submit failed: {e}"
@@ -45,19 +41,16 @@ def get_tokens(account):
def burn_token(seed, nftoken_id):
"""burn_token"""
# Get the client
owner_wallet=Wallet(seed, sequence=16237283)
owner_wallet=Wallet.from_seed(seed)
client=JsonRpcClient(testnet_url)
burn_tx=xrpl.models.transactions.NFTokenBurn(
account=owner_wallet.classic_address,
account=owner_wallet.address,
nftoken_id=nftoken_id
)
# Sign and fill the transaction
signed_tx=xrpl.transaction.safe_sign_and_autofill_transaction(
burn_tx, owner_wallet, client)
# Submit the transaction and get results
reply=""
try:
response=xrpl.transaction.send_reliable_submission(signed_tx,client)
response=xrpl.transaction.submit_and_wait(burn_tx,client,owner_wallet)
reply=response.result
except xrpl.transaction.XRPLReliableSubmissionException as e:
reply=f"Submit failed: {e}"