New error codes + other changes

This commit is contained in:
Wo Jake
2022-09-28 08:01:44 +00:00
committed by GitHub
parent 99e72585f5
commit b100af8b61

View File

@@ -12,10 +12,10 @@ client = JsonRpcClient(JSON_RPC_URL)
test_wallet = generate_faucet_wallet(client=client)
myAddr = test_wallet.classic_address
# Construct a TicketCreate transaction, 1 ticket created for future use
# Construct a TicketCreate transaction, 2 ticket created for future use
tx = TicketCreate(
account=myAddr,
ticket_count=1
ticket_count=2
)
# Sign transaction locally and submit
@@ -28,7 +28,15 @@ get_ticket_sequence = AccountObjects(
)
response = client.request(get_ticket_sequence)
ticket_sequence = response.result["account_objects"][0]["TicketSequence"]
# Since we created 2 Tickets previously, you're able to choose which Ticket you're going to use
ticket1_sequence = response.result["account_objects"][0]["TicketSequence"]
ticket2_sequence = response.result["account_objects"][1]["TicketSequence"]
print(f"Ticket 1: {ticket1_sequence}\n"
f"Ticket 2: {ticket2_sequence}")
ticket_sequence = int(input("Pick a ticket sequence to use for your next transaction: "))
# Construct Transaction using a Ticket
tx_1 = AccountSet(
@@ -46,8 +54,12 @@ result = tx_result.result["engine_result"]
print(f"Account: {myAddr}")
if result == "tesSUCCESS":
print("Transaction successful!")
elif result == "terPRE_TICKET":
print("The provided Ticket Sequence does not exist in the ledger")
elif result == "tefMAX_LEDGER":
print("Transaction failed to achieve consensus")
elif result == "tefPAST_SEQ":
print("The sequence number is lower than the current sequence number of the account")
elif result == "unknown":
print("Transaction status unknown")
else: