diff --git a/_code-samples/escrow/js/create-escrow.js b/_code-samples/escrow/js/create-escrow.js index a5dc268e3d..cd9d032312 100644 --- a/_code-samples/escrow/js/create-escrow.js +++ b/_code-samples/escrow/js/create-escrow.js @@ -55,7 +55,7 @@ async function main() { JSON.stringify(escrowCreateTransaction, null, "\t"), "\n" ); const response = await client.submitAndWait(escrowCreateTransaction, { wallet }); - console.log(`Sequence number: ${response.result.Sequence}`); + console.log(`Sequence number: ${response.result.tx_json.Sequence}`); console.log(`Finished submitting! ${JSON.stringify(response.result, null, "\t")}`); await client.disconnect(); diff --git a/_code-samples/escrow/py/create_escrow.py b/_code-samples/escrow/py/create_escrow.py index c810cce6b6..c35775a5e3 100644 --- a/_code-samples/escrow/py/create_escrow.py +++ b/_code-samples/escrow/py/create_escrow.py @@ -44,8 +44,8 @@ stxn_result = stxn_response.result # Parse result and print out the neccesary info -print(stxn_result["Account"]) -print(stxn_result["Sequence"]) +print(stxn_result["tx_json"]["Account"]) +print(stxn_result["tx_json"]["Sequence"]) print(stxn_result["meta"]["TransactionResult"]) print(stxn_result["hash"]) diff --git a/_code-samples/issue-a-token/js/issue-a-token.js b/_code-samples/issue-a-token/js/issue-a-token.js index bd99309a3e..c8cebcd527 100644 --- a/_code-samples/issue-a-token/js/issue-a-token.js +++ b/_code-samples/issue-a-token/js/issue-a-token.js @@ -145,7 +145,7 @@ async function main() { const send_token_tx = { "TransactionType": "Payment", "Account": cold_wallet.address, - "Amount": { + "DeliverMax": { "currency": currency_code, "value": issue_quantity, "issuer": cold_wallet.address @@ -171,7 +171,7 @@ async function main() { const send_token_tx2 = { "TransactionType": "Payment", "Account": hot_wallet.address, - "Amount": { + "DeliverMax": { "currency": currency_code, "value": issue_quantity, "issuer": cold_wallet.address @@ -197,7 +197,7 @@ async function main() { const send_token_tx3 = { "TransactionType": "Payment", "Account": customer_one_wallet.address, - "Amount": { + "DeliverMax": { "currency": currency_code, "value": issue_quantity, "issuer": cold_wallet.address diff --git a/_code-samples/monitor-payments-websocket/js/monitor-payments.js b/_code-samples/monitor-payments-websocket/js/monitor-payments.js index c38511e351..5e4e537e40 100644 --- a/_code-samples/monitor-payments-websocket/js/monitor-payments.js +++ b/_code-samples/monitor-payments-websocket/js/monitor-payments.js @@ -82,8 +82,8 @@ async function do_subscribe() { } const log_tx = function(tx) { - console.log(tx.transaction.TransactionType + " transaction sent by " + - tx.transaction.Account + + console.log(tx.tx_json.TransactionType + " transaction sent by " + + tx.tx_json.Account + "\n Result: " + tx.meta.TransactionResult + " in ledger " + tx.ledger_index + "\n Validated? " + tx.validated) diff --git a/_code-samples/monitor-payments-websocket/js/read-amount-received.js b/_code-samples/monitor-payments-websocket/js/read-amount-received.js index d044b274e9..ae253100ea 100644 --- a/_code-samples/monitor-payments-websocket/js/read-amount-received.js +++ b/_code-samples/monitor-payments-websocket/js/read-amount-received.js @@ -51,8 +51,8 @@ function CountXRPReceived(tx, address) { console.log("Transaction failed.") return } - if (tx.transaction.TransactionType === "Payment") { - if (tx.transaction.Destination !== address) { + if (tx.tx_json.TransactionType === "Payment") { + if (tx.tx_json.Destination !== address) { console.log("Not the destination of this payment.") return } @@ -67,10 +67,10 @@ function CountXRPReceived(tx, address) { } } else if (["PaymentChannelClaim", "PaymentChannelFund", "OfferCreate", "CheckCash", "EscrowFinish"].includes( - tx.transaction.TransactionType)) { + tx.tx_json.TransactionType)) { CountXRPDifference(tx.meta.AffectedNodes, address) } else { console.log("Not a currency-delivering transaction type (" + - tx.transaction.TransactionType + ").") + tx.tx_json.TransactionType + ").") } } diff --git a/_code-samples/monitor-payments-websocket/py/read_amount_received.py b/_code-samples/monitor-payments-websocket/py/read_amount_received.py index 5f54fcf3c5..39c0e987fe 100644 --- a/_code-samples/monitor-payments-websocket/py/read_amount_received.py +++ b/_code-samples/monitor-payments-websocket/py/read_amount_received.py @@ -53,21 +53,21 @@ def CountXRPReceived(tx, address): if tx['meta']['TransactionResult'] != 'tesSUCCESS': print("Transaction failed") return - if tx['transaction']['TransactionType'] == 'Payment': - if tx['transaction']['Destination'] != address: + if tx['tx_json']['TransactionType'] == 'Payment': + if tx['tx_json']['Destination'] != address: print("Not the destination of this payment.") return if tx['meta']['delivered_amount'] is int or str: - amount_in_drops = int(tx['transaction']['Amount']) + amount_in_drops = int(tx['tx_json']['DeliverMax']) xrp_amount = (amount_in_drops / 1000000) print(f"Received {xrp_amount} XRP") return else: print("Received non-XRP currency") - elif tx['transaction']['TransactionType'] == 'PaymentChannelClaim' or 'PaymentChannelFund' or'OfferCreate' or 'CheckCash' or 'EscrowFinish': + elif tx['tx_json']['TransactionType'] == 'PaymentChannelClaim' or 'PaymentChannelFund' or'OfferCreate' or 'CheckCash' or 'EscrowFinish': FindXRPDifference(tx, address) else: - print("Not a currency-delivering transaction type", tx['transaction']['TransactionType']) + print("Not a currency-delivering transaction type", tx['tx_json']['TransactionType']) CountXRPReceived(tx=transaction, address='rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe') diff --git a/_code-samples/quickstart/js/1.get-accounts-send-xrp.html b/_code-samples/quickstart/js/1.get-accounts-send-xrp.html index 2a0c79d081..82cc70f5b5 100644 --- a/_code-samples/quickstart/js/1.get-accounts-send-xrp.html +++ b/_code-samples/quickstart/js/1.get-accounts-send-xrp.html @@ -9,7 +9,7 @@ button{font-weight: bold;font-family: "Work Sans", sans-serif;} td{vertical-align: middle;} - + + + diff --git a/_code-samples/quickstart/js/ripplex1-send-xrp.js b/_code-samples/quickstart/js/ripplex1-send-xrp.js index 07c1d274e3..6e1bf3b93c 100644 --- a/_code-samples/quickstart/js/ripplex1-send-xrp.js +++ b/_code-samples/quickstart/js/ripplex1-send-xrp.js @@ -128,7 +128,7 @@ async function sendXRP() { const prepared = await client.autofill({ "TransactionType": "Payment", "Account": standby_wallet.address, - "Amount": xrpl.xrpToDrops(sendAmount), + "DeliverMax": xrpl.xrpToDrops(sendAmount), "Destination": standbyDestinationField.value }) @@ -178,7 +178,7 @@ async function oPsendXRP() { const prepared = await client.autofill({ "TransactionType": "Payment", "Account": operational_wallet.address, - "Amount": xrpl.xrpToDrops(operationalAmountField.value), + "DeliverMax": xrpl.xrpToDrops(operationalAmountField.value), "Destination": operationalDestinationField.value }) diff --git a/_code-samples/quickstart/js/ripplex2-send-currency.js b/_code-samples/quickstart/js/ripplex2-send-currency.js index 47365cec0d..03b961a2bf 100644 --- a/_code-samples/quickstart/js/ripplex2-send-currency.js +++ b/_code-samples/quickstart/js/ripplex2-send-currency.js @@ -116,7 +116,7 @@ async function sendCurrency() { const send_token_tx = { "TransactionType": "Payment", "Account": standby_wallet.address, - "Amount": { + "DeliverMax": { "currency": standbyCurrencyField.value, "value": standbyAmountField.value, "issuer": standby_wallet.address @@ -249,7 +249,7 @@ async function oPsendCurrency() { const send_token_tx = { "TransactionType": "Payment", "Account": operational_wallet.address, - "Amount": { + "DeliverMax": { "currency": currency_code, "value": issue_quantity, "issuer": operational_wallet.address diff --git a/_code-samples/quickstart/js/ripplex3b-NameFieldSupport.js b/_code-samples/quickstart/js/ripplex3b-NameFieldSupport.js index 5157a1d913..89e613ce63 100644 --- a/_code-samples/quickstart/js/ripplex3b-NameFieldSupport.js +++ b/_code-samples/quickstart/js/ripplex3b-NameFieldSupport.js @@ -136,7 +136,7 @@ async function sendXRP() { const prepared = await client.autofill({ "TransactionType": "Payment", "Account": standby_wallet.address, - "Amount": xrpl.xrpToDrops(sendAmount), + "DeliverMax": xrpl.xrpToDrops(sendAmount), "Destination": standbyDestinationField.value }) @@ -186,7 +186,7 @@ async function oPsendXRP() { const prepared = await client.autofill({ "TransactionType": "Payment", "Account": operational_wallet.address, - "Amount": xrpl.xrpToDrops(sendAmount), + "DeliverMax": xrpl.xrpToDrops(sendAmount), "Destination": operationalDestinationField.value }) diff --git a/_code-samples/secure-signing/js/signPayment.js b/_code-samples/secure-signing/js/signPayment.js index effe44cfcd..259f62e447 100644 --- a/_code-samples/secure-signing/js/signPayment.js +++ b/_code-samples/secure-signing/js/signPayment.js @@ -15,7 +15,7 @@ const txJSON = { "Account": my_wallet.address, "TransactionType":"Payment", "Destination":"rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", - "Amount":"13000000", + "DeliverMax":"13000000", "Flags":2147483648, "LastLedgerSequence":7835923, // Optional, but recommended. "Fee":"13", @@ -25,4 +25,4 @@ const txJSON = { const signed = my_wallet.sign(txJSON) console.log("tx_blob is:", signed.tx_blob) -console.log("tx hash is:", signed.hash) +console.log("tx hash is:", signed.tx_json.hash) diff --git a/_code-samples/send-a-memo/js/send-a-memo.js b/_code-samples/send-a-memo/js/send-a-memo.js index 677fd37588..27b11e6f7f 100644 --- a/_code-samples/send-a-memo/js/send-a-memo.js +++ b/_code-samples/send-a-memo/js/send-a-memo.js @@ -31,7 +31,7 @@ if (typeof module !== "undefined") { "TransactionType": "Payment", "Account": wallet.address, "Destination": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe", - "Amount": "1000000", // Amount in drops, 1 XRP = 1,000,000 drops + "DeliverMax": "1000000", // Amount in drops, 1 XRP = 1,000,000 drops "Memos": [{ "Memo":{ "MemoType": MemoType, @@ -45,9 +45,9 @@ if (typeof module !== "undefined") { console.log("Submitting a payment transaction with our memo field...") const submit_result = await client.submitAndWait(signed.tx_blob) xrpl.convertHexToString - const tx_MemoData = xrpl.convertHexToString(string=submit_result.result.Memos[0].Memo.MemoData); - const tx_MemoFormat = xrpl.convertHexToString(string=submit_result.result.Memos[0].Memo.MemoFormat); - const tx_MemoType = xrpl.convertHexToString(string=submit_result.result.Memos[0].Memo.MemoType); + const tx_MemoData = xrpl.convertHexToString(string=submit_result.result.tx_json.Memos[0].Memo.MemoData); + const tx_MemoFormat = xrpl.convertHexToString(string=submit_result.result.tx_json.Memos[0].Memo.MemoFormat); + const tx_MemoType = xrpl.convertHexToString(string=submit_result.result.tx_json.Memos[0].Memo.MemoType); console.log(`\n Encoded Transaction MEMO: ${JSON.stringify({"MemoType": MemoType, "MemoData": MemoData, "MemoFormat": MemoFormat})}`) console.log(` Decoded Transaction MEMO: ${JSON.stringify({"MemoType": tx_MemoType, "MemoData": tx_MemoData, "MemoFormat": tx_MemoFormat})}`); diff --git a/_code-samples/send-a-memo/py/send-a-memo.py b/_code-samples/send-a-memo/py/send-a-memo.py index adb66fc611..36b1a6559e 100644 --- a/_code-samples/send-a-memo/py/send-a-memo.py +++ b/_code-samples/send-a-memo/py/send-a-memo.py @@ -49,9 +49,9 @@ print(f"\n Encoded Transaction MEMO: {payment_tx_signed.memos}") submit_tx_regular = submit_and_wait(transaction=payment_tx_signed, client=client) submit_tx_regular = submit_tx_regular.result -tx_MemoData = bytes.fromhex(submit_tx_regular['Memos'][0]['Memo']['MemoData']).decode('utf-8') -tx_MemoFormat = bytes.fromhex(submit_tx_regular['Memos'][0]['Memo']['MemoFormat']).decode('utf-8') -tx_MemoType = bytes.fromhex(submit_tx_regular['Memos'][0]['Memo']['MemoType']).decode('utf-8') +tx_MemoData = bytes.fromhex(submit_tx_regular['tx_json']['Memos'][0]['Memo']['MemoData']).decode('utf-8') +tx_MemoFormat = bytes.fromhex(submit_tx_regular['tx_json']['Memos'][0]['Memo']['MemoFormat']).decode('utf-8') +tx_MemoType = bytes.fromhex(submit_tx_regular['tx_json']['Memos'][0]['Memo']['MemoType']).decode('utf-8') print(f" Decoded Transaction MEMO:") print(f" MemoData: {tx_MemoData}") diff --git a/_code-samples/send-xrp/js/send-xrp.js b/_code-samples/send-xrp/js/send-xrp.js index 1c932ed667..1a7e64a889 100644 --- a/_code-samples/send-xrp/js/send-xrp.js +++ b/_code-samples/send-xrp/js/send-xrp.js @@ -23,7 +23,7 @@ async function main() { const prepared = await client.autofill({ "TransactionType": "Payment", "Account": wallet.address, - "Amount": xrpl.xrpToDrops("22"), + "DeliverMax": xrpl.xrpToDrops("22"), "Destination": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe" }) const max_ledger = prepared.LastLedgerSequence diff --git a/docs/tutorials/how-tos/send-xrp.md b/docs/tutorials/how-tos/send-xrp.md index 811d554a48..2508a5e906 100644 --- a/docs/tutorials/how-tos/send-xrp.md +++ b/docs/tutorials/how-tos/send-xrp.md @@ -102,7 +102,7 @@ Typically, we create XRP Ledger transactions as objects in the JSON [transaction { "TransactionType": "Payment", "Account": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe", - "Amount": "2000000", + "DeliverMax": "2000000", "Destination": "rUCzEr6jrEyMpjhs4wSdQdz4g8Y382NxfM" } ``` @@ -112,7 +112,7 @@ The bare minimum set of instructions you must provide for an XRP Payment is: - An indicator that this is a payment. (`"TransactionType": "Payment"`) - The sending address. (`"Account"`) - The address that should receive the XRP (`"Destination"`). This can't be the same as the sending address. -- The amount of XRP to send (`"Amount"`). Typically, this is specified as an integer in "drops" of XRP, where 1,000,000 drops equals 1 XRP. +- The amount of XRP to send (`"DeliverMax"`). Typically, this is specified as an integer in "drops" of XRP, where 1,000,000 drops equals 1 XRP. Technically, a transaction must contain some additional fields, and certain optional fields such as `LastLedgerSequence` are strongly recommended. Some other language-specific notes: diff --git a/package-lock.json b/package-lock.json index 8d8ad1ce8f..52cc6b2ff2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2783,33 +2783,6 @@ "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==" }, - "node_modules/cross-fetch": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", - "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", - "dependencies": { - "node-fetch": "^2.6.12" - } - }, - "node_modules/cross-fetch/node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/crypto-js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", @@ -6898,6 +6871,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/xrpl/-/xrpl-4.0.0.tgz", "integrity": "sha512-VZm1lQWHQ6PheAAFGdH+ISXKvqB2hZDQ0w4ZcdAEtmqZQXtSIVQHOKPz95rEgGANbos7+XClxJ73++joPhA8Cw==", + "license": "ISC", "dependencies": { "@scure/bip32": "^1.3.1", "@scure/bip39": "^1.2.1",