Issue a token: interactive & node.js compatible

- Make sample code node.js compatible (need to uncomment a few lines)
- Wire up interactive tutorial bits to actually run the relevant code
- Edit instructions slightly, add notes on Require Destination Tags
This commit is contained in:
mDuo13
2021-08-12 16:57:59 -07:00
parent d93467a8af
commit a7eec0b039
8 changed files with 1069 additions and 61 deletions

View File

@@ -145,7 +145,7 @@ function lookup_tx_final(api, tx_id, max_ledger, min_ledger) {
// warning written to the console can tell you more about what happened.
async function submit_and_verify(api, tx_blob) {
const prelim_result = await api.request("submit", {"tx_blob": tx_blob})
console.log("Preliminary result:", prelim_result)
console.log("Preliminary result code:", prelim_result.engine_result)
const min_ledger = prelim_result.validated_ledger_index
if (prelim_result.tx_json.LastLedgerSequence === undefined) {
console.warn("Transaction has no LastLedgerSequence field. "+
@@ -165,3 +165,11 @@ async function submit_and_verify(api, tx_blob) {
return final_result;
}
// Exports for node.js; no-op for browsers
if (typeof module !== "undefined") {
module.exports = {
submit_and_verify: submit_and_verify,
lookup_tx_final: lookup_tx_final
}
}