mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-12-06 17:27:57 +00:00
Update Desktop Wallet (JS) tutorial dependencies, copy edits
This commit is contained in:
@@ -3,7 +3,7 @@ const xrpl = require("xrpl");
|
||||
// The rippled server and its APIs represent time as an unsigned integer.
|
||||
// This number measures the number of seconds since the "Ripple Epoch" of
|
||||
// January 1, 2000 (00:00 UTC). This is like the way the Unix epoch works,
|
||||
// Reference: https://xrpl.org/basic-data-types.html
|
||||
// Reference: https://xrpl.org/docs/references/protocol/data-types/basic-data-types#specifying-time
|
||||
const RIPPLE_EPOCH = 946684800;
|
||||
|
||||
const prepareAccountData = (rawAccountData) => {
|
||||
|
||||
@@ -14,7 +14,7 @@ const fernet = require("fernet");
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
const initialize = async (client, wallet, appWindow) => {
|
||||
// Reference: https://xrpl.org/account_info.html
|
||||
// Reference: https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_info
|
||||
const accountInfoResponse = await client.request({
|
||||
"command": "account_info",
|
||||
"account": wallet.address,
|
||||
@@ -23,7 +23,7 @@ const initialize = async (client, wallet, appWindow) => {
|
||||
const accountData = prepareAccountData(accountInfoResponse.result.account_data)
|
||||
appWindow.webContents.send('update-account-data', accountData)
|
||||
|
||||
// Reference: https://xrpl.org/account_tx.html
|
||||
// Reference: https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_tx
|
||||
const txResponse = await client.request({
|
||||
"command": "account_tx",
|
||||
"account": wallet.address
|
||||
@@ -42,14 +42,14 @@ const initialize = async (client, wallet, appWindow) => {
|
||||
*/
|
||||
const subscribe = async (client, wallet, appWindow) => {
|
||||
|
||||
// Reference: https://xrpl.org/subscribe.html
|
||||
// Reference: https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/subscription-methods/subscribe
|
||||
await client.request({
|
||||
"command": "subscribe",
|
||||
"streams": ["ledger"],
|
||||
"accounts": [wallet.address]
|
||||
})
|
||||
|
||||
// Reference: https://xrpl.org/subscribe.html#ledger-stream
|
||||
// Reference: https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/subscription-methods/subscribe#ledger-stream
|
||||
client.on("ledgerClosed", async (rawLedgerData) => {
|
||||
const ledger = prepareLedgerData(rawLedgerData)
|
||||
appWindow.webContents.send('update-ledger-data', ledger)
|
||||
@@ -57,7 +57,7 @@ const subscribe = async (client, wallet, appWindow) => {
|
||||
|
||||
// Wait for transaction on subscribed account and re-request account data
|
||||
client.on("transaction", async (transaction) => {
|
||||
// Reference: https://xrpl.org/account_info.html
|
||||
// Reference: https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_info
|
||||
const accountInfoRequest = {
|
||||
"command": "account_info",
|
||||
"account": wallet.address,
|
||||
|
||||
@@ -9,7 +9,7 @@ const xrpl = require("xrpl");
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
const sendXrp = async (paymentData, client, wallet) => {
|
||||
// Reference: https://xrpl.org/submit.html#request-format-1
|
||||
// Reference: https://xrpl.org/docs/references/protocol/transactions/types/payment
|
||||
const paymentTx = {
|
||||
"TransactionType": "Payment",
|
||||
"Account": wallet.address,
|
||||
|
||||
@@ -39,7 +39,7 @@ async function checkDestination(accountData) {
|
||||
|
||||
/**
|
||||
* Verify an account using a xrp-ledger.toml file.
|
||||
* https://xrpl.org/xrp-ledger-toml.html#xrp-ledgertoml-file
|
||||
* https://xrpl.org/docs/references/xrp-ledger-toml
|
||||
*
|
||||
* @param accountData
|
||||
* @returns {Promise<{domain: string, verified: boolean}>}
|
||||
@@ -89,7 +89,7 @@ async function verifyAccountDomain(accountData) {
|
||||
* @returns {Promise<{domain: string, verified: boolean}>}
|
||||
*/
|
||||
async function verify(accountAddress, client) {
|
||||
// Reference: https://xrpl.org/account_info.html
|
||||
// Reference: https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_info
|
||||
const request = {
|
||||
"command": "account_info",
|
||||
"account": accountAddress,
|
||||
|
||||
Reference in New Issue
Block a user