diff --git a/content/_code-samples/send-a-memo/js/README.md b/content/_code-samples/send-a-memo/js/README.md new file mode 100644 index 0000000000..e15d160099 --- /dev/null +++ b/content/_code-samples/send-a-memo/js/README.md @@ -0,0 +1,7 @@ +# JavaScript send Memo examples + +Generates a random account and creates a payment transaction with Memo field. + +### Random seed + + npm start \ No newline at end of file diff --git a/content/_code-samples/send-a-memo/js/package.json b/content/_code-samples/send-a-memo/js/package.json new file mode 100644 index 0000000000..22d3b185e6 --- /dev/null +++ b/content/_code-samples/send-a-memo/js/package.json @@ -0,0 +1,14 @@ +{ + "name": "send-a-memo", + "version": "1.0.0", + "description": "", + "main": "send-a-memo.js", + "scripts": { + "start": "node send-a-memo.js" + }, + "author": "", + "license": "CC0-1.0", + "dependencies": { + "xrpl": "^2.0.0" + } +} diff --git a/content/_code-samples/send-a-memo/js/send-a-memo.js b/content/_code-samples/send-a-memo/js/send-a-memo.js index 597287e32a..677fd37588 100644 --- a/content/_code-samples/send-a-memo/js/send-a-memo.js +++ b/content/_code-samples/send-a-memo/js/send-a-memo.js @@ -23,7 +23,7 @@ if (typeof module !== "undefined") { // Enter memo data to insert into a transaction const MemoData = xrpl.convertStringToHex(string="Example Memo - 123 -=+"); const MemoType = xrpl.convertStringToHex(string="Text"); - // MemoFormat values: # MemoFormat values: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types + // MemoFormat values: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types const MemoFormat = xrpl.convertStringToHex(string="text/plain"); // Send AccountSet transaction @@ -42,7 +42,7 @@ if (typeof module !== "undefined") { }) const signed = wallet.sign(prepared) - print("Submitting a payment transaction with our memo field...") + 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);