diff --git a/assets/js/submit-and-verify2.js b/assets/js/submit-and-verify2.js index a15b04711a..2db20c8bb7 100644 --- a/assets/js/submit-and-verify2.js +++ b/assets/js/submit-and-verify2.js @@ -32,6 +32,9 @@ function lookup_tx_final(api, tx_id, max_ledger, min_ledger) { [min_ledger, max_ledger] = [max_ledger, min_ledger] } + // Make sure we're subscribed to the ledger stream to trigger updates + api.request({"command": "subscribe", "streams": ["ledger"]}) + // Helper to determine if we (should) know the transaction's final result yet. // If the server has validated all ledgers the tx could possibly appear in, // then we should know its final result. diff --git a/assets/js/tx-sender.js b/assets/js/tx-sender.js index 1a603683f8..3a7cb3dd48 100644 --- a/assets/js/tx-sender.js +++ b/assets/js/tx-sender.js @@ -156,8 +156,8 @@ const set_up_tx_sender = async function() { try { // use lookup_tx_final() from submit-and-verify2.js - let final_result_data = await lookup_tx_final(api, tx_id, max_ledger, min_ledger) - let final_result = final_result_data.meta.TransactionResult + let final_result_data = await lookup_tx_final(api, hash, max_ledger, min_ledger) + let final_result = final_result_data.result.meta.TransactionResult if (!silent) { if (final_result === "tesSUCCESS") { successNotif(`${tx_object.TransactionType} tx succeeded (hash: ${hash})`) diff --git a/assets/js/xrpl-2.0b0.min.js b/assets/js/xrpl-2.0.0b2.min.js similarity index 100% rename from assets/js/xrpl-2.0b0.min.js rename to assets/js/xrpl-2.0.0b2.min.js diff --git a/content/_code-samples/require-destination-tags/demo.html b/content/_code-samples/require-destination-tags/demo.html index 42a6bc33b6..d4be9cd76b 100644 --- a/content/_code-samples/require-destination-tags/demo.html +++ b/content/_code-samples/require-destination-tags/demo.html @@ -2,7 +2,9 @@ - + + diff --git a/content/_code-samples/secure-signing/js/signPayment.js b/content/_code-samples/secure-signing/js/signPayment.js index ed8bfb7421..a37fb3a54a 100644 --- a/content/_code-samples/secure-signing/js/signPayment.js +++ b/content/_code-samples/secure-signing/js/signPayment.js @@ -1,25 +1,25 @@ -'use strict' -const RippleAPI = require('ripple-lib').RippleAPI +// Sample code demonstrating secure offline signing using xrpl.js library. +const xrpl = require('xrpl') -// Load address & secret from environment variables: -const from_address = process.env['MY_ADDRESS'] -const secret = process.env['MY_SECRET'] +// Load seed value from an environment variable: +const my_wallet = xrpl.Wallet.fromSeed(process.env['MY_SEED']) -// Can sign offline if the txJSON has all required fields -const api = new RippleAPI() +// For offline signing, you need to know your address's next Sequence number +let my_seq = 21404872 -const txJSON = JSON.stringify({ - "Account": from_address, +// Provide *all* required fields before signing a transaction +const txJSON = { + "Account": my_wallet.classicAddress, "TransactionType":"Payment", "Destination":"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "Amount":"13000000", "Flags":2147483648, - "LastLedgerSequence":7835923, + "LastLedgerSequence":7835923, // Optional, but recommended. "Fee":"13", - "Sequence":2 -}) + "Sequence": my_seq +} -const signed = api.sign(txJSON, secret) +const tx_blob = my_wallet.signTransaction(txJSON) -console.log("tx_blob is:", signed.signedTransaction) -console.log("tx hash is:", signed.id) +console.log("tx_blob is:", tx_blob) +console.log("tx hash is:", xrpl.computeBinaryTransactionSigningHash(tx_blob)) diff --git a/content/_code-samples/send-xrp/demo.html b/content/_code-samples/send-xrp/demo.html index 4efa4203f4..3e7f6bd0a9 100644 --- a/content/_code-samples/send-xrp/demo.html +++ b/content/_code-samples/send-xrp/demo.html @@ -5,7 +5,7 @@ Code Sample - Send XRP - + diff --git a/dactyl-config.yml b/dactyl-config.yml index aee5af8eea..fa3fc1e8f8 100644 --- a/dactyl-config.yml +++ b/dactyl-config.yml @@ -64,7 +64,7 @@ default_keys: &defaults hover_anchors: light_theme_enabled: true # Script tags used in a variety of tools & examples. - ripple_lib_tag: '' + ripple_lib_tag: '' targets: # First member is the default that gets built when target not specified