From 12c42e2a9f9515794230743b2fb916b65fb70fed Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Fri, 15 Jan 2021 15:47:56 -0800 Subject: [PATCH] Use Tickets: draft complete --- .../manage-account-settings/use-tickets.md | 142 +++++++++++++++++- 1 file changed, 135 insertions(+), 7 deletions(-) diff --git a/content/tutorials/manage-account-settings/use-tickets.md b/content/tutorials/manage-account-settings/use-tickets.md index b736fb6b09..25dde61857 100644 --- a/content/tutorials/manage-account-settings/use-tickets.md +++ b/content/tutorials/manage-account-settings/use-tickets.md @@ -307,6 +307,7 @@ let waiting_for_tx = null; api.on('ledger', async (ledger) => { $("#current-ledger-version").text(ledger.ledgerVersion) + let tx_result; if (waiting_for_tx) { try { tx_result = await api.request("tx", { @@ -314,7 +315,6 @@ api.on('ledger', async (ledger) => { "min_ledger": parseInt($("#earliest-ledger-version").text()), "max_ledger": parseInt($("#lastledgersequence").text()) }) - console.log(tx_result) if (tx_result.validated) { $("#tx-validation-status").html( `Final Result:${tx_result.meta.TransactionResult} (Validated)`) @@ -359,6 +359,7 @@ let response = await api.request("account_objects", { }) console.log("Available Tickets:", response.account_objects) +let use_ticket = response.account_objects[0].TicketSequence ``` @@ -381,6 +382,13 @@ console.log("Available Tickets:", response.account_objects) }) $("#check-tickets-output").html(`
${pretty_print(response)}
`) + // Reset the next step's form & add these tickets + $("#ticket-selector .form-area").html("") + response.account_objects.forEach((ticket, i) => { + $("#ticket-selector .form-area").append(`
`) + }) + + // Update breadcrumbs & activate next step complete_step("Check Tickets") $("#prepare-ticketed-tx").prop("disabled", false) @@ -392,13 +400,12 @@ console.log("Available Tickets:", response.account_objects) Now that you have a Ticket available, you can prepare a transaction that uses it. -This can be any [type of transaction](transaction-types.html) you like. The following example uses an [AccountSet transaction][] to set a `MessageKey` since that doesn't require any other setup in the ledger. Set the `Sequence` field to `0` and include a `TicketSequence` field with the Ticket Sequence number of one of your available Tickets. +This can be any [type of transaction](transaction-types.html) you like. The following example uses a no-op [AccountSet transaction][] since that doesn't require any other setup in the ledger. Set the `Sequence` field to `0` and include a `TicketSequence` field with the Ticket Sequence number of one of your available Tickets. ```js let prepared_t = await api.prepareTransaction({ "TransactionType": "AccountSet", "Account": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe", - "MessageKey": "DEADBEEF", "TicketSequence": use_ticket, "Sequence": 0 }, { @@ -418,6 +425,10 @@ console.log("Signed transaction blob:", tx_blob_t) **Tip:** If you don't plan to submit the TicketCreate transaction right away, you should explicitly set the [instructions'](rippleapi-reference.html#transaction-instructions) `maxLedgerVersionOffset` to a larger number of ledgers. To create a transaction that could remain valid indefinitely, set the `maxLedgerVersion` to `null`. {{ start_step("Prepare Ticketed Tx") }} +
+

Select a Ticket:

+
+
@@ -425,7 +436,42 @@ console.log("Signed transaction blob:", tx_blob_t) @@ -438,12 +484,94 @@ let prelim_result_t = await api.submit(tx_blob_t) console.log("Preliminary result:", prelim_result_t) ``` +{{ start_step("Submit Ticketed Tx") }} + +
+{{ end_step() }} + + + + ### {{n.next()}}. Wait for Validation -```js -TODO -``` +Ticketed transactions go through the consensus process the same way that Sequenced transactions do. +{{ start_step("Wait Again") }} + + + + + + + + + + + + + + + +
Latest Validated Ledger Version:(Not connected)
Ledger Version at Time of Submission:(Not submitted)
Ticketed Transaction LastLedgerSequence:(Not prepared)
+{{ end_step() }} + + ## See Also