mirror of
				https://github.com/XRPLF/xrpl-dev-portal.git
				synced 2025-11-04 03:45:49 +00:00 
			
		
		
		
	Updates based on feedback
This commit is contained in:
		@@ -6,7 +6,6 @@ function getNet() {
 | 
			
		||||
  let net
 | 
			
		||||
  if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233/"
 | 
			
		||||
  if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233/"
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  return net
 | 
			
		||||
} // End of getNet()
 | 
			
		||||
 | 
			
		||||
@@ -18,23 +17,36 @@ async function getAccount() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\nConnected to ${net}.`
 | 
			
		||||
  let faucetHost = null
 | 
			
		||||
  const my_wallet = (await client.fundWallet(null, { faucetHost})).wallet
 | 
			
		||||
  const newAccount = [my_wallet.address, my_wallet.seed]
 | 
			
		||||
  return (newAccount)
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  resultField.value = `===Getting Account===\n\nConnected to ${net}.`
 | 
			
		||||
  try {
 | 
			
		||||
    let faucetHost = null
 | 
			
		||||
    const my_wallet = (await client.fundWallet(null, { faucetHost})).wallet
 | 
			
		||||
    const newAccount = [my_wallet.address, my_wallet.seed]
 | 
			
		||||
    return (newAccount)
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('===Error getting account:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} // End of getAccount()
 | 
			
		||||
 | 
			
		||||
async function getNewAccount1() {
 | 
			
		||||
  account1address.value = "Getting new account."
 | 
			
		||||
  account1address.value = "=== Getting new account. ===\n\n"
 | 
			
		||||
  account1seed.value = ""
 | 
			
		||||
  const accountInfo= await getAccount()
 | 
			
		||||
  account1address.value = accountInfo[0]
 | 
			
		||||
  account1seed.value = accountInfo[1]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function getNewAccount2() {
 | 
			
		||||
  account2address.value = "Getting new account."
 | 
			
		||||
  account2address.value = "=== Getting new account. ===\n\n"
 | 
			
		||||
  account2seed.value = ""
 | 
			
		||||
  const accountInfo= await getAccount()
 | 
			
		||||
  account2address.value = accountInfo[0]
 | 
			
		||||
  account2seed.value = accountInfo[1]
 | 
			
		||||
@@ -48,13 +60,26 @@ async function getAccountFromSeed(my_seed) {
 | 
			
		||||
  const net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = '\nConnected, finding wallet.\n'
 | 
			
		||||
  let results = '===Finding wallet.===\n\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(my_seed)
 | 
			
		||||
// ----------------------Populate the fields for left and right accounts.
 | 
			
		||||
  const address = wallet.address
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  return (address)
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(my_seed)
 | 
			
		||||
    const address = wallet.address
 | 
			
		||||
    results += "===Wallet found.===\n\n"
 | 
			
		||||
    results += "Account address: " + address + "\n\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    return (address)
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('===Error getting account from seed:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} // End of getAccountFromSeed()
 | 
			
		||||
 | 
			
		||||
// *****************************************************
 | 
			
		||||
@@ -120,15 +145,32 @@ function populate2() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// **************** Get Xrp Balance  *********************
 | 
			
		||||
// **************** Get XRP Balance  *********************
 | 
			
		||||
// *******************************************************
 | 
			
		||||
 | 
			
		||||
async function getXrpBalance() {
 | 
			
		||||
  const net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  xrpBalanceField.value = await client.getXrpBalance(accountAddressField.value)
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  let results = `\n===Getting XRP balance...===\n\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const balance = await client.getXrpBalance(wallet.address)
 | 
			
		||||
    results += accountNameField.value + " current XRP balance: " + balance + "\n\n"
 | 
			
		||||
    xrpBalanceField.value = await client.getXrpBalance(accountAddressField.value)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error getting XRP balance:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} // End of getXrpBalance()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -138,21 +180,29 @@ async function getXrpBalance() {
 | 
			
		||||
async function getTokenBalance() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  results= "\nGetting account balance...\n"
 | 
			
		||||
  const balance = await client.request({
 | 
			
		||||
    command: "gateway_balances",
 | 
			
		||||
    account: wallet.address,
 | 
			
		||||
    ledger_index: "validated",
 | 
			
		||||
  })
 | 
			
		||||
  results += JSON.stringify(balance.result, null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  let results = `===Connected to ${net}.===\n===Getting account token balance...===\n\n`
 | 
			
		||||
  resultField.value += results
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const balance = await client.request({
 | 
			
		||||
      command: "gateway_balances",
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
    })
 | 
			
		||||
    results = accountNameField.value + "\'s token balance(s): " + JSON.stringify(balance.result, null, 2) + "\n"
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error getting token balance:', error);
 | 
			
		||||
    results = `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} // End of getTokenBalance()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,42 +8,43 @@ async function createConditionalEscrow() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}, creating conditional escrow.\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const sendAmount = amountField.value
 | 
			
		||||
  
 | 
			
		||||
  wallet.address
 | 
			
		||||
  
 | 
			
		||||
  let results = `===Connected to ${net}===\n===Creating conditional escrow.===\n\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  let escrow_cancel_date = new Date()
 | 
			
		||||
  escrow_cancel_date = addSeconds(parseInt(escrowCancelDateField.value))
 | 
			
		||||
 | 
			
		||||
  // ------------------------------------------------------- Prepare transaction
 | 
			
		||||
  try {
 | 
			
		||||
    const escrowTx = await client.autofill({
 | 
			
		||||
      "TransactionType": "EscrowCreate",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
      "Destination": destinationField.value,
 | 
			
		||||
      "CancelAfter": escrow_cancel_date,
 | 
			
		||||
      "Condition": escrowConditionField.value
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
  const escrowTx = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowCreate",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
    "Destination": destinationField.value,
 | 
			
		||||
    "CancelAfter": escrow_cancel_date,
 | 
			
		||||
    "Condition": escrowConditionField.value
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  // ------------------------------------------------ Sign prepared instructions
 | 
			
		||||
  const signed = wallet.sign(escrowTx)
 | 
			
		||||
 | 
			
		||||
  // -------------------------------------------------------- Submit signed blob
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
  results += "\nSequence Number (Save!): " + tx.result.tx_json.Sequence 
 | 
			
		||||
  results  += "\n\nBalance changes: " + 
 | 
			
		||||
  JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
 | 
			
		||||
  // ----------------------------------------------Disconnect from the XRP Ledger
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
    // ------------------------------------------------ Sign prepared instructions
 | 
			
		||||
    const signed = wallet.sign(escrowTx)
 | 
			
		||||
 | 
			
		||||
    // -------------------------------------------------------- Submit signed blob
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results = "\n=== *** Sequence Number (Save!): " + tx.result.tx_json.Sequence 
 | 
			
		||||
    results += "\n\n===Balance changes===\n" + 
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // -------------------------------------------------------- Disconnect
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of createTimeEscrow()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -54,31 +55,32 @@ async function finishConditionalEscrow() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}, fulfilling conditional escrow.\n`
 | 
			
		||||
  let results = `===Connected to ${net}===\n===Fulfilling conditional escrow.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
 | 
			
		||||
  // ------------------------------------------------------- Prepare transaction
 | 
			
		||||
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowFinish",
 | 
			
		||||
    "Account": accountAddressField.value,
 | 
			
		||||
    "Owner": escrowOwnerField.value,
 | 
			
		||||
    "OfferSequence": parseInt(escrowSequenceNumberField.value),
 | 
			
		||||
    "Condition": escrowConditionField.value,
 | 
			
		||||
    "Fulfillment": escrowFulfillmentField.value
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  // ------------------------------------------------ Sign prepared instructions
 | 
			
		||||
  const signed = wallet.sign(prepared)
 | 
			
		||||
 | 
			
		||||
  // -------------------------------------------------------- Submit signed blob
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
  results  += "\nBalance changes: " + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
 | 
			
		||||
} // End of finishEscrow()
 | 
			
		||||
  try {
 | 
			
		||||
    // ------------------------------------------------------- Prepare transaction
 | 
			
		||||
    const prepared = await client.autofill({
 | 
			
		||||
      "TransactionType": "EscrowFinish",
 | 
			
		||||
      "Account": accountAddressField.value,
 | 
			
		||||
      "Owner": escrowOwnerField.value,
 | 
			
		||||
      "OfferSequence": parseInt(escrowSequenceNumberField.value),
 | 
			
		||||
      "Condition": escrowConditionField.value,
 | 
			
		||||
      "Fulfillment": escrowFulfillmentField.value
 | 
			
		||||
    })
 | 
			
		||||
    const signed = wallet.sign(prepared)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results += "\n===Balance changes===" + 
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message + ".===\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // -------------------------------------------------------- Disconnect
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of finisConditionalEscrow()
 | 
			
		||||
@@ -2,56 +2,54 @@
 | 
			
		||||
 *********** Create Offer **********
 | 
			
		||||
 **********************************/
 | 
			
		||||
 | 
			
		||||
 async function createOffer() {
 | 
			
		||||
async function createOffer() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  let results = 'Connecting to ' + net + '....\n'
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
      
 | 
			
		||||
  results  += "Connected. Getting wallets.\n"
 | 
			
		||||
  let results = `===Connected to ${net}, getting wallet....===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  results += accountNameField.value + " account address: " + wallet.address + "\n"
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  if (getCurrencyField.value == 'XRP') {
 | 
			
		||||
    takerGets = getAmountField.value
 | 
			
		||||
  } else {
 | 
			
		||||
    takerGetsString = '{"currency": "' + getCurrencyField.value +'",\n' +
 | 
			
		||||
  try {
 | 
			
		||||
    if (getCurrencyField.value == 'XRP') {
 | 
			
		||||
      takerGets = xrpl.xrpToDrops(getAmountField.value)
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      takerGetsString = '{"currency": "' + getCurrencyField.value + '",\n' +
 | 
			
		||||
        '"issuer": "' + getIssuerField.value + '",\n' +
 | 
			
		||||
        '"value": "' + getAmountField.value + '"}'
 | 
			
		||||
    takerGets = JSON.parse(takerGetsString)
 | 
			
		||||
  }
 | 
			
		||||
      takerGets = JSON.parse(takerGetsString)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (payCurrencyField.value == 'XRP') {
 | 
			
		||||
    takerPays = payAmountField.value
 | 
			
		||||
  } else {
 | 
			
		||||
    takerPaysString = '{"currency": "' + payCurrencyField.value + '",\n' +
 | 
			
		||||
      '"issuer": "' + payIssuerField.value + '",\n' +
 | 
			
		||||
      '"value": "' + payAmountField.value + '"}'
 | 
			
		||||
    takerPays = JSON.parse(takerPaysString)
 | 
			
		||||
    if (payCurrencyField.value == 'XRP') {
 | 
			
		||||
      takerPays = xrpl.xrpToDrops(payAmountField.value)
 | 
			
		||||
    } else {
 | 
			
		||||
      takerPaysString = '{"currency": "' + payCurrencyField.value + '",\n' +
 | 
			
		||||
        '"issuer": "' + payIssuerField.value + '",\n' +
 | 
			
		||||
        '"value": "' + payAmountField.value + '"}'
 | 
			
		||||
      takerPays = JSON.parse(takerPaysString)
 | 
			
		||||
    }
 | 
			
		||||
    const prepared = await client.autofill({
 | 
			
		||||
      "TransactionType": "OfferCreate",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "TakerGets": takerGets,
 | 
			
		||||
      "TakerPays": takerPays
 | 
			
		||||
    })
 | 
			
		||||
    const signed = wallet.sign(prepared)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results = '\n\n===Offer created===\n\n' +
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  } catch (err) {
 | 
			
		||||
    console.error('Error creating offer:', err);
 | 
			
		||||
    results = `\nError: ${err.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw err; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client          
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
   // -------------------------------------------------------- Prepare transaction
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
    "TransactionType": "OfferCreate",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "TakerGets": takerGets,
 | 
			
		||||
    "TakerPays": takerPays
 | 
			
		||||
  })   
 | 
			
		||||
  // ------------------------------------------------- Sign prepared instructions
 | 
			
		||||
  const signed = wallet.sign(prepared)
 | 
			
		||||
 results += "\nSubmitting transaction...."
 | 
			
		||||
  // -------------------------------------------------------- Submit signed blob
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
  results  += "\nBalance changes: " + 
 | 
			
		||||
  JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
 | 
			
		||||
  xrpBalanceField.value =  (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  getOffers()                 
 | 
			
		||||
  client.disconnect()    
 | 
			
		||||
} // End of createOffer()
 | 
			
		||||
 | 
			
		||||
/***********************************
 | 
			
		||||
@@ -60,66 +58,64 @@
 | 
			
		||||
 | 
			
		||||
async function getOffers() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  let results = 'Connecting to ' + net + '....\n'
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results  += "Connected.\n"
 | 
			
		||||
  let results = `===Connected to ' + ${net}, getting offers....===\n`
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  results += accountNameField.value + " account: " + wallet.address
 | 
			
		||||
// -------------------------------------------------------- Prepare request
 | 
			
		||||
 | 
			
		||||
  results += '\n\n*** Offers ***\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  results += '\n\n=== Offers ===\n'
 | 
			
		||||
  let offers
 | 
			
		||||
  try {
 | 
			
		||||
    const offers = await client.request({
 | 
			
		||||
    offers = await client.request({
 | 
			
		||||
      method: "account_offers",
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated"
 | 
			
		||||
    })
 | 
			
		||||
    results += JSON.stringify(offers,null,2)
 | 
			
		||||
    results = JSON.stringify(offers, null, 2)
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  } catch (err) {
 | 
			
		||||
      results += err
 | 
			
		||||
    console.error('Error getting offers:', err);
 | 
			
		||||
    results = `\nError: ${err.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw err; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
}// End of getOffers()
 | 
			
		||||
 | 
			
		||||
/***********************************
 | 
			
		||||
*********** Cancel Offer **********
 | 
			
		||||
**********************************/
 | 
			
		||||
 | 
			
		||||
  async function cancelOffer() {
 | 
			
		||||
    let results  = "Connecting to the selected ledger.\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    results += 'Connecting to ' + net + '....\n'
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    await client.connect()
 | 
			
		||||
        
 | 
			
		||||
    results  += "Connected.\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    results += "wallet.address: = " + wallet.address
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
 | 
			
		||||
  // -------------------------------------------------------- Prepare transaction
 | 
			
		||||
    /* OfferSequence is the Seq value when you getOffers. */
 | 
			
		||||
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
  "TransactionType": "OfferCancel",
 | 
			
		||||
  "Account": wallet.address,
 | 
			
		||||
  "OfferSequence": parseInt(offerSequenceField.value)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  // ------------------------------------------------- Sign prepared instructions
 | 
			
		||||
  const signed = wallet.sign(prepared)
 | 
			
		||||
 | 
			
		||||
  // -------------------------------------------------------- Submit signed blob
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
      
 | 
			
		||||
  results  += "\nBalance changes: \n" + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
async function cancelOffer() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `===Connected to ${net}, canceling offer.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  xrpBalanceField.value =  (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()    
 | 
			
		||||
  } // End of cancelOffer()
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  try {
 | 
			
		||||
    // OfferSequence is the _seq_ value from getOffers.
 | 
			
		||||
    const prepared = await client.autofill({
 | 
			
		||||
      "TransactionType": "OfferCancel",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "OfferSequence": parseInt(offerSequenceField.value)
 | 
			
		||||
    })
 | 
			
		||||
    const signed = wallet.sign(prepared)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results += "\nOffer canceled. Balance changes: \n" +
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  }
 | 
			
		||||
  catch (err) {
 | 
			
		||||
    console.error('Error canceling offer:', err);
 | 
			
		||||
    results = `\nError: ${err.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw err; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
}// End of cancelOffer()
 | 
			
		||||
 
 | 
			
		||||
@@ -15,37 +15,40 @@ function addSeconds(numOfSeconds, date = new Date()) {
 | 
			
		||||
// *******************************************************
 | 
			
		||||
 | 
			
		||||
async function createTimeBasedEscrow() {
 | 
			
		||||
 | 
			
		||||
  //-------------------------------------------- Prepare Finish and Cancel Dates
 | 
			
		||||
 | 
			
		||||
  let escrow_finish_date = new Date()
 | 
			
		||||
  let escrow_cancel_date = new Date()
 | 
			
		||||
  escrow_finish_date = addSeconds(parseInt(escrowFinishTimeField.value))
 | 
			
		||||
  escrow_cancel_date = addSeconds(parseInt(escrowCancelTimeField.value))
 | 
			
		||||
 | 
			
		||||
  //------------------------------------------------------Connect to the Ledger
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results  = `Connected to ${net}.\nCreating time-based escrow.\n`
 | 
			
		||||
  let results = `===Connected to ${net}.===\n\n===Creating time-based escrow.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const sendAmount = amountField.value
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const escrowTx = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowCreate",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
    "Destination": destinationField.value,
 | 
			
		||||
    "FinishAfter": escrow_finish_date,
 | 
			
		||||
    "CancelAfter": escrow_cancel_date
 | 
			
		||||
  })
 | 
			
		||||
  const signed = wallet.sign(escrowTx)
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
  results += "\nSuccess! Save this sequence number: " + tx.result.tx_json.Sequence 
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const sendAmount = amountField.value
 | 
			
		||||
    const escrowTx = await client.autofill({
 | 
			
		||||
      "TransactionType": "EscrowCreate",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
      "Destination": destinationField.value,
 | 
			
		||||
      "FinishAfter": escrow_finish_date,
 | 
			
		||||
      "CancelAfter": escrow_cancel_date
 | 
			
		||||
    })
 | 
			
		||||
    const signed = wallet.sign(escrowTx)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results += "\n===Success! === *** Save this sequence number: " + tx.result.tx_json.Sequence
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of createTimeEscrow()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -56,24 +59,30 @@ async function finishTimeBasedEscrow() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}. Finishing escrow....`
 | 
			
		||||
  let results = `===Connected to ${net}. Finishing escrow.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  results += "\nwallet.address: = " + wallet.address
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowFinish",
 | 
			
		||||
    "Account": accountAddressField.value,
 | 
			
		||||
    "Owner": escrowOwnerField.value,
 | 
			
		||||
    "OfferSequence": parseInt(escrowSequenceNumberField.value)
 | 
			
		||||
  })
 | 
			
		||||
  const signed = wallet.sign(prepared)
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
  results  += "\nBalance changes: " + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  try {
 | 
			
		||||
    const prepared = await client.autofill({
 | 
			
		||||
      "TransactionType": "EscrowFinish",
 | 
			
		||||
      "Account": accountAddressField.value,
 | 
			
		||||
      "Owner": escrowOwnerField.value,
 | 
			
		||||
      "OfferSequence": parseInt(escrowSequenceNumberField.value)
 | 
			
		||||
    })
 | 
			
		||||
    const signed = wallet.sign(prepared)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results += "\n===Balance changes===" +
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message + "==="
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of finishTimeBasedEscrow()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -83,21 +92,28 @@ async function finishTimeBasedEscrow() {
 | 
			
		||||
async function getEscrows() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  let results = `\nConnected to ${net}.\nGetting account escrows...\n`
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\n===Connected to ${net}.\nGetting account escrows.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const escrow_objects = await client.request({
 | 
			
		||||
    "id": 5,
 | 
			
		||||
    "command": "account_objects",
 | 
			
		||||
    "account": accountAddressField.value,
 | 
			
		||||
    "ledger_index": "validated",
 | 
			
		||||
    "type": "escrow"
 | 
			
		||||
  })
 | 
			
		||||
  results += JSON.stringify(escrow_objects.result, null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getEscrows()
 | 
			
		||||
 | 
			
		||||
  try {
 | 
			
		||||
    const escrow_objects = await client.request({
 | 
			
		||||
      "id": 5,
 | 
			
		||||
      "command": "account_objects",
 | 
			
		||||
      "account": accountAddressField.value,
 | 
			
		||||
      "ledger_index": "validated",
 | 
			
		||||
      "type": "escrow"
 | 
			
		||||
    })
 | 
			
		||||
    results += JSON.stringify(escrow_objects.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\nError: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
// ************** Get Transaction Info *******************
 | 
			
		||||
@@ -106,18 +122,25 @@ async function getEscrows() {
 | 
			
		||||
async function getTransaction() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  let results = `\nConnected to ${net}.\nGetting transaction information...\n`
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\n===Connected to ${net}.===\n===Getting transaction information.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const tx_info = await client.request({
 | 
			
		||||
    "id": 1,
 | 
			
		||||
    "command": "tx",
 | 
			
		||||
    "transaction": transactionField.value,
 | 
			
		||||
  })
 | 
			
		||||
  results += JSON.stringify(tx_info.result, null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
 
 | 
			
		||||
  try {
 | 
			
		||||
    const tx_info = await client.request({
 | 
			
		||||
      "id": 1,
 | 
			
		||||
      "command": "tx",
 | 
			
		||||
      "transaction": transactionField.value,
 | 
			
		||||
    })
 | 
			
		||||
    results += JSON.stringify(tx_info.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\nError: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of getTransaction()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -128,20 +151,27 @@ async function cancelEscrow() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\nConnected to ${net}. Cancelling escrow....`
 | 
			
		||||
  let results = `\n===Connected to ${net}. Cancelling escrow.===`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowCancel",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Owner": escrowOwnerField.value,
 | 
			
		||||
    "OfferSequence": parseInt(escrowSequenceNumberField.value)
 | 
			
		||||
  })
 | 
			
		||||
  const signed = wallet.sign(prepared)
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
   results  += "\nBalance changes: " + 
 | 
			
		||||
  try {
 | 
			
		||||
    const prepared = await client.autofill({
 | 
			
		||||
      "TransactionType": "EscrowCancel",
 | 
			
		||||
      "Account": accountAddressField.value,
 | 
			
		||||
      "Owner": escrowOwnerField.value,
 | 
			
		||||
      "OfferSequence": parseInt(escrowSequenceNumberField.value)
 | 
			
		||||
    })
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const signed = wallet.sign(prepared)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results += "\n===Balance changes: " +
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -5,39 +5,43 @@ async function sendCheck() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results = `\nConnected to ${net}.`
 | 
			
		||||
  results = `\n===Connected to ${net}.===\n===Sending check.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
          
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  let check_amount = amountField.value
 | 
			
		||||
  if (currencyField.value !=  "XRP") {
 | 
			
		||||
  	check_amount = {
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "value": amountField.value,
 | 
			
		||||
      "issuer": wallet.address  	
 | 
			
		||||
  	}
 | 
			
		||||
  try {     
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    let check_amount = amountField.value
 | 
			
		||||
    if (currencyField.value !=  "XRP") {
 | 
			
		||||
      check_amount = {
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "value": amountField.value,
 | 
			
		||||
        "issuer": wallet.address  	
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    const send_check_tx = {
 | 
			
		||||
      "TransactionType": "CheckCreate",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "SendMax": check_amount,
 | 
			
		||||
      "Destination": destinationField.value
 | 
			
		||||
    }
 | 
			
		||||
    const check_prepared = await client.autofill(send_check_tx)
 | 
			
		||||
    const check_signed = wallet.sign(check_prepared)
 | 
			
		||||
    results = '\n===Sending ' + amountField.value + ' ' + currencyField.
 | 
			
		||||
     value + ' to ' +  destinationField.value + '.===\n'
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    const check_result = await client.submitAndWait(check_signed.tx_blob)
 | 
			
		||||
    if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
      results += '===Transaction succeeded===\n\n'
 | 
			
		||||
      resultField.value += JSON.stringify(check_result.result, null, 2)
 | 
			
		||||
      xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
    }
 | 
			
		||||
  } 
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results = `Error sending transaction: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  const send_check_tx = {
 | 
			
		||||
    "TransactionType": "CheckCreate",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "SendMax": check_amount,
 | 
			
		||||
    "Destination": destinationField.value
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
  const check_prepared = await client.autofill(send_check_tx)
 | 
			
		||||
  const check_signed = wallet.sign(check_prepared)
 | 
			
		||||
  results += '\nSending ' + amountField.value + ' ' + currencyField.value + ' to ' +
 | 
			
		||||
    destinationField.value + '...\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const check_result = await client.submitAndWait(check_signed.tx_blob)
 | 
			
		||||
  if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += 'Transaction succeeded:\n'
 | 
			
		||||
    resultField.value += JSON.stringify(check_result.result, null, 2)
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `Error sending transaction: ${check_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendCheck()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -48,17 +52,24 @@ async function getChecks() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  let results = `\nConnected to ${net}.`
 | 
			
		||||
  let results = `\n===Connected to ${net}.===\n===Getting account checks.===\n\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const check_objects = await client.request({
 | 
			
		||||
    "id": 5,
 | 
			
		||||
    "command": "account_objects",
 | 
			
		||||
    "account": accountAddressField.value,
 | 
			
		||||
    "ledger_index": "validated",
 | 
			
		||||
    "type": "check"
 | 
			
		||||
  })
 | 
			
		||||
  resultField.value = JSON.stringify(check_objects.result, null, 2)
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  try {
 | 
			
		||||
    const check_objects = await client.request({
 | 
			
		||||
      "id": 5,
 | 
			
		||||
      "command": "account_objects",
 | 
			
		||||
      "account": accountAddressField.value,
 | 
			
		||||
      "ledger_index": "validated",
 | 
			
		||||
      "type": "check"
 | 
			
		||||
    })
 | 
			
		||||
    resultField.value += JSON.stringify(check_objects.result, null, 2)
 | 
			
		||||
  }  catch (error) {
 | 
			
		||||
    results = `Error getting checks: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of getChecks()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -69,39 +80,41 @@ async function cashCheck() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results = `\nConnected to ${net}.`
 | 
			
		||||
  results = `\n===Connected to ${net}.===\n===Cashing check.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
          
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  var check_amount = amountField.value
 | 
			
		||||
  
 | 
			
		||||
  if (currencyField.value !=  "XRP") {
 | 
			
		||||
  	check_amount = {
 | 
			
		||||
      "value": amountField.value,
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "issuer": issuerField.value  	
 | 
			
		||||
  	}
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    let check_amount = amountField.value
 | 
			
		||||
    if (currencyField.value !=  "XRP") {
 | 
			
		||||
      check_amount = {
 | 
			
		||||
        "value": amountField.value,
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "issuer": issuerField.value  	
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    const cash_check_tx = {
 | 
			
		||||
      "TransactionType": "CheckCash",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": check_amount,
 | 
			
		||||
      "CheckID": checkIdField.value
 | 
			
		||||
    }
 | 
			
		||||
    const cash_prepared = await client.autofill(cash_check_tx)
 | 
			
		||||
    const cash_signed = wallet.sign(cash_prepared)
 | 
			
		||||
    results = ' Receiving ' + amountField.value + ' ' + currencyField.value + '.\n'
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    const check_result = await client.submitAndWait(cash_signed.tx_blob)
 | 
			
		||||
    if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
      results = '===Transaction succeeded===\n' + JSON.stringify(check_result.result, null, 2)
 | 
			
		||||
      resultField.value += results
 | 
			
		||||
    }
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `Error sending transaction: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  const cash_check_tx = {
 | 
			
		||||
    "TransactionType": "CheckCash",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": check_amount,
 | 
			
		||||
    "CheckID": checkIdField.value
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
  const cash_prepared = await client.autofill(cash_check_tx)
 | 
			
		||||
  const cash_signed = wallet.sign(cash_prepared)
 | 
			
		||||
  results += ' Receiving ' + amountField.value + ' ' + currencyField.value + '.\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const check_result = await client.submitAndWait(cash_signed.tx_blob)
 | 
			
		||||
  if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += 'Transaction succeeded:\n' + JSON.stringify(check_result.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `Error sending transaction: ${check_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of cashCheck()
 | 
			
		||||
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -112,28 +125,28 @@ async function cancelCheck() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results = `\nConnected to ${net}.`
 | 
			
		||||
  results = `\n===Connected to ${net}.===\n===Cancelling check.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
          
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
        
 | 
			
		||||
  const cancel_check_tx = {
 | 
			
		||||
    "TransactionType": "CheckCancel",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "CheckID": checkIdField.value
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const cancel_check_tx = {
 | 
			
		||||
      "TransactionType": "CheckCancel",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "CheckID": checkIdField.value
 | 
			
		||||
    }
 | 
			
		||||
    const cancel_prepared = await client.autofill(cancel_check_tx)
 | 
			
		||||
    const cancel_signed = wallet.sign(cancel_prepared)
 | 
			
		||||
    const check_result = await client.submitAndWait(cancel_signed.tx_blob)
 | 
			
		||||
    if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
      results += `===Transaction succeeded===\n${check_result.result.meta.TransactionResult}`
 | 
			
		||||
      resultField.value = results
 | 
			
		||||
    } 
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `Error sending transaction: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  const cancel_prepared = await client.autofill(cancel_check_tx)
 | 
			
		||||
  const cancel_signed = wallet.sign(cancel_prepared)
 | 
			
		||||
  results += ' Cancelling check.\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const check_result = await client.submitAndWait(cancel_signed.tx_blob)
 | 
			
		||||
  if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `Transaction succeeded: ${check_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `Error sending transaction: ${check_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of cancelCheck()
 | 
			
		||||
 
 | 
			
		||||
@@ -8,27 +8,39 @@ async function createTrustLine() {
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = "\nConnected. Creating trust line.\n"
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const trustSet_tx = {
 | 
			
		||||
    "TransactionType": "TrustSet",
 | 
			
		||||
    "Account": accountAddressField.value,
 | 
			
		||||
    "LimitAmount": {
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "issuer": issuerField.value,
 | 
			
		||||
      "value": amountField.value
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const trustSet_tx = {
 | 
			
		||||
      "TransactionType": "TrustSet",
 | 
			
		||||
      "Account": accountAddressField.value,
 | 
			
		||||
      "LimitAmount": {
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "issuer": issuerField.value,
 | 
			
		||||
        "value": amountField.value
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    const ts_prepared = await client.autofill(trustSet_tx)
 | 
			
		||||
    const ts_signed = wallet.sign(ts_prepared)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    const ts_result = await client.submitAndWait(ts_signed.tx_blob)
 | 
			
		||||
    if (ts_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
      results += '\n===Trustline established between account\n' +
 | 
			
		||||
        accountAddressField.value + "\nand account\n" + issuerField.value + '.'
 | 
			
		||||
      resultField.value = results
 | 
			
		||||
    } else {
 | 
			
		||||
      results += `\n===Transaction failed: ${ts_result.result.meta.TransactionResult}`
 | 
			
		||||
      resultField.value = results     
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  const ts_prepared = await client.autofill(trustSet_tx)
 | 
			
		||||
  const ts_signed = wallet.sign(ts_prepared)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const ts_result = await client.submitAndWait(ts_signed.tx_blob)
 | 
			
		||||
  if (ts_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += '\nTrustline established between account \n' +
 | 
			
		||||
      accountAddressField.value + ' \n and account\n' + issuerField.value + '.'
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error creating trust line:', error);
 | 
			
		||||
    results += `\n===Error: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${ts_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results     
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} //End of createTrustline()
 | 
			
		||||
      
 | 
			
		||||
@@ -44,29 +56,41 @@ async function sendCurrency() {
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const send_currency_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "value": amountField.value,
 | 
			
		||||
      "issuer": issuerField.value
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": destinationField.value
 | 
			
		||||
  }
 | 
			
		||||
  const pay_prepared = await client.autofill(send_currency_tx)
 | 
			
		||||
  const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${amountField.value} ${currencyField.value} to ${destinationField.value} ...`
 | 
			
		||||
 resultField.value = results
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const send_currency_tx = {
 | 
			
		||||
      "TransactionType": "Payment",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": {
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "value": amountField.value,
 | 
			
		||||
        "issuer": issuerField.value
 | 
			
		||||
      },
 | 
			
		||||
      "Destination": destinationField.value
 | 
			
		||||
    }
 | 
			
		||||
    const pay_prepared = await client.autofill(send_currency_tx)
 | 
			
		||||
    const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
    results += `\n\n===Sending ${amountField.value} ${currencyField.value} to ${destinationField.value} ...`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += 'Transaction succeeded.'
 | 
			
		||||
    results += '\n===Transaction succeeded.'
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    getTokenBalance()
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${pay_result.result.meta.TransactionResult}`
 | 
			
		||||
    results += `\n===Transaction failed: ${pay_result.result.meta.TransactionResult}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
}
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error sending transaction:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} // end of sendCurrency()
 | 
			
		||||
 
 | 
			
		||||
@@ -6,35 +6,36 @@ async function sendMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  let results = `===Connected to ${net}. Sending MPT.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIdField.value
 | 
			
		||||
  const mpt_quantity = amountField.value
 | 
			
		||||
  const send_mpt_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
      "value": mpt_quantity,
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": destinationField.value,
 | 
			
		||||
  }
 | 
			
		||||
  const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
  const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${destinationField.value} ...`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
        results += 'Transaction succeeded.\n\n'
 | 
			
		||||
        results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${pay_result.result.meta.TransactionResult}\n\n`
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const mpt_issuance_id = mptIdField.value
 | 
			
		||||
    const mpt_quantity = amountField.value
 | 
			
		||||
    const send_mpt_tx = {
 | 
			
		||||
      "TransactionType": "Payment",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": {
 | 
			
		||||
        "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
        "value": mpt_quantity,
 | 
			
		||||
      },
 | 
			
		||||
      "Destination": destinationField.value,
 | 
			
		||||
    }
 | 
			
		||||
    const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
    const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
    results = `\n===Sending ${mpt_quantity} ${mpt_issuance_id} to ${destinationField.value} ...`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
    results = '\n\n===Transaction succeeded.\n'
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `Error sending MPT: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendMPT()
 | 
			
		||||
      
 | 
			
		||||
// *******************************************************
 | 
			
		||||
@@ -45,27 +46,35 @@ async function getMPTs() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const mpts = await client.request({
 | 
			
		||||
      command: "account_objects",
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
      type: "mptoken"
 | 
			
		||||
    })
 | 
			
		||||
  let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
  let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
  let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
  let x = 0
 | 
			
		||||
  while (x < numberOfMPTs){
 | 
			
		||||
    results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
             + "\nMPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
    x++
 | 
			
		||||
  let results = ''
 | 
			
		||||
  resultField.value = `===Connected to ${net}. Getting MPTs.===`
 | 
			
		||||
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const mpts = await client.request({
 | 
			
		||||
        command: "account_objects",
 | 
			
		||||
        account: wallet.address,
 | 
			
		||||
        ledger_index: "validated",
 | 
			
		||||
        type: "mptoken"
 | 
			
		||||
      })
 | 
			
		||||
    let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
    let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
    let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
    let x = 0
 | 
			
		||||
    while (x < numberOfMPTs){
 | 
			
		||||
      results += "\n\n===MPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
              + "\n===MPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
      x++
 | 
			
		||||
    }
 | 
			
		||||
    results += "\n\n" + JSONString
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `===Error getting MPTs: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
  results += "\n\n" + JSONString
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getMPTs()
 | 
			
		||||
 | 
			
		||||
// **********************************************************************
 | 
			
		||||
@@ -76,25 +85,28 @@ async function authorizeMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  let results = `===Connected to ${net}. Authorizing MPT.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const mpt_issuance_id = mptIdField.value
 | 
			
		||||
  const auth_mpt_tx = {
 | 
			
		||||
    "TransactionType": "MPTokenAuthorize",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "MPTokenIssuanceID": mpt_issuance_id,
 | 
			
		||||
  }
 | 
			
		||||
  const auth_prepared = await client.autofill(auth_mpt_tx)
 | 
			
		||||
  const auth_signed = wallet.sign(auth_prepared)
 | 
			
		||||
  results += `\n\nSending authorization...`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const auth_result = await client.submitAndWait(auth_signed.tx_blob)
 | 
			
		||||
  if (auth_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `\nTransaction succeeded`
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const mpt_issuance_id = mptIdField.value
 | 
			
		||||
    const auth_mpt_tx = {
 | 
			
		||||
      "TransactionType": "MPTokenAuthorize",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "MPTokenIssuanceID": mpt_issuance_id,
 | 
			
		||||
    }
 | 
			
		||||
    const auth_prepared = await client.autofill(auth_mpt_tx)
 | 
			
		||||
    const auth_signed = wallet.sign(auth_prepared)
 | 
			
		||||
    results += `\n\n===Sending authorization.===\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${auth_result.result.meta.TransactionResult}`
 | 
			
		||||
    const auth_result = await client.submitAndWait(auth_signed.tx_blob)
 | 
			
		||||
    results = '\n===Transaction succeeded===\n\n'
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    results += `\n\n` + JSON.stringify(auth_result.result, null, 2)
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `===Error authorizing MPT: ${error}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } finally {
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
 
 | 
			
		||||
@@ -5,24 +5,33 @@ async function sendXRP() {
 | 
			
		||||
  const net = getNet() 
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = "\nConnected. Sending XRP.\n"
 | 
			
		||||
  let results = `===Connected to ${net}.===\n\nSending XRP.\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const sendAmount = amountField.value  
 | 
			
		||||
// -------------------------------------------------------- Prepare transaction
 | 
			
		||||
  const prepared_tx = await client.autofill({
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
    "Destination": destinationField.value
 | 
			
		||||
  })
 | 
			
		||||
// ------------------------------------------------- Sign prepared instructions
 | 
			
		||||
  const signed = wallet.sign(prepared_tx)
 | 
			
		||||
// -------------------------------------------------------- Submit signed blob
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
  results = "\nBalance changes: " + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  xrpBalanceField.value =  (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()    
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const sendAmount = amountField.value  
 | 
			
		||||
  // -------------------------------------------------------- Prepare transaction
 | 
			
		||||
    const prepared_tx = await client.autofill({
 | 
			
		||||
      "TransactionType": "Payment",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
      "Destination": destinationField.value
 | 
			
		||||
    })
 | 
			
		||||
  // ------------------------------------------------- Sign prepared instructions
 | 
			
		||||
    const signed = wallet.sign(prepared_tx)
 | 
			
		||||
  // -------------------------------------------------------- Submit signed blob
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    results += JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    xrpBalanceField.value =  (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    console.error('Error sending transaction:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await xrplClient.disconnect();
 | 
			
		||||
  }   
 | 
			
		||||
} // End of sendXRP()
 | 
			
		||||
@@ -27,8 +27,8 @@ async function mintToken() {
 | 
			
		||||
  // ----------------------------------------------------- Submit signed blob 
 | 
			
		||||
  const tx = await client.submitAndWait(transactionJson, { wallet: standby_wallet} )
 | 
			
		||||
  const nfts = await client.request({
 | 
			
		||||
    method: "account_nfts",
 | 
			
		||||
    account: standby_wallet.classicAddress
 | 
			
		||||
    "method": "account_nfts",
 | 
			
		||||
    "account": standby_wallet.classicAddress
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  // ------------------------------------------------------- Report results
 | 
			
		||||
 
 | 
			
		||||
@@ -126,18 +126,32 @@ Get the selected network, create a new client, and connect to the XRPL serever.
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\nConnected to ${net}.`
 | 
			
		||||
  resultField.value = `===Getting Account===\n\nConnected to ${net}.`
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Request a new wallet funded with play-money XRP for experimentation.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let faucetHost = null
 | 
			
		||||
  const my_wallet = (await client.fundWallet(null, { faucetHost})).wallet
 | 
			
		||||
  const newAccount = [my_wallet.address, my_wallet.seed]
 | 
			
		||||
  try {
 | 
			
		||||
    let faucetHost = null
 | 
			
		||||
    const my_wallet = (await client.fundWallet(null, { faucetHost})).wallet
 | 
			
		||||
    const newAccount = [my_wallet.address, my_wallet.seed]
 | 
			
		||||
    return (newAccount)
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRPL server and return the account address and seed.
 | 
			
		||||
Catch and report any errors.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error getting account:', error);
 | 
			
		||||
    results = `\n===Error: ${error.message}===\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRPL server and return the address and seed information.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
@@ -151,14 +165,17 @@ These are wrapper functions that call the getAccount() function, then populate t
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function getNewAccount1() {
 | 
			
		||||
  account1address.value = "Getting new account."
 | 
			
		||||
  account1address.value = "=== Getting new account. ===\n\n"
 | 
			
		||||
  account1seed.value = ""
 | 
			
		||||
  const accountInfo= await getAccount()
 | 
			
		||||
  account1address.value = accountInfo[0]
 | 
			
		||||
  account1seed.value = accountInfo[1]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async function getNewAccount2() {
 | 
			
		||||
  account2address.value = "Getting new account."
 | 
			
		||||
  account2address.value = "=== Getting new account. ===\n\n"
 | 
			
		||||
  account2seed.value = ""
 | 
			
		||||
  const accountInfo= await getAccount()
 | 
			
		||||
  account2address.value = accountInfo[0]
 | 
			
		||||
  account2seed.value = accountInfo[1]
 | 
			
		||||
@@ -174,12 +191,34 @@ async function getAccountFromSeed(my_seed) {
 | 
			
		||||
  const net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = '\nConnected, finding wallet.\n'
 | 
			
		||||
  let results = '===Finding wallet.===\n\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(my_seed)
 | 
			
		||||
  const address = wallet.address
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  return (address)
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(my_seed)
 | 
			
		||||
    const address = wallet.address
 | 
			
		||||
    results += "===Wallet found.===\n\n"
 | 
			
		||||
    results += "Account address: " + address + "\n\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    return (address)
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
Catch and report any errors.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
    catch (error) {
 | 
			
		||||
    console.error('===Error getting account from seed:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  ```
 | 
			
		||||
 | 
			
		||||
  Disconnect from the XRP Ledger and return the .
 | 
			
		||||
 | 
			
		||||
  ```javascript
 | 
			
		||||
  finally {
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} // End of getAccountFromSeed()
 | 
			
		||||
```
 | 
			
		||||
### getAccountFromSeed1 and getAccountFromSeed2
 | 
			
		||||
@@ -210,7 +249,7 @@ function gatherAccountInfo() {
 | 
			
		||||
 | 
			
		||||
### distributeAccountInfo()
 | 
			
		||||
 | 
			
		||||
This local function parses structured account information from the **Result** field and distributes it to the corresponding account fields.
 | 
			
		||||
This local function parses structured account information from the **Result** field and distributes it to the corresponding account fields. It is the counterpart to the gatherAccountInfo() utility. The purpose is to let you continue to use the same accounts in all of the modular examples. If you have information that doesn't perfectly conform, you can still use this utility to populate the fields with the information that does fit the format.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
function distributeAccountInfo() {
 | 
			
		||||
@@ -253,9 +292,30 @@ async function getXrpBalance() {
 | 
			
		||||
  const net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  xrpBalanceField.value = await client.getXrpBalance(accountAddressField.value)
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getXrpBalance()
 | 
			
		||||
  let results = `\n===Getting XRP balance...===\n\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const balance = await client.getXrpBalance(wallet.address)
 | 
			
		||||
    results += accountNameField.value + " current XRP balance: " + balance + "\n\n"
 | 
			
		||||
    xrpBalanceField.value = await client.getXrpBalance(accountAddressField.value)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  ```
 | 
			
		||||
 | 
			
		||||
  Catch any errors and disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
  ```javascript
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error getting XRP balance:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
### getTokenBalance()
 | 
			
		||||
 | 
			
		||||
@@ -265,47 +325,47 @@ Get the balance of all tokens for the current active account. This is a function
 | 
			
		||||
async function getTokenBalance() {
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Connect with the network and get the account wallet.
 | 
			
		||||
Connect with the network.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  results = 'Connecting to ' + getNet() + '....'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  let results = `===Connected to ${net}.===\n===Getting account token balance...===\n\n`
 | 
			
		||||
  resultField.value += results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send a request to get the account balance, then wait for the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results= "\nGetting account balance...\n"
 | 
			
		||||
  const balance = await client.request({
 | 
			
		||||
    command: "gateway_balances",
 | 
			
		||||
    account: wallet.address,
 | 
			
		||||
    ledger_index: "validated",
 | 
			
		||||
  })
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const balance = await client.request({
 | 
			
		||||
      command: "gateway_balances",
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
    })
 | 
			
		||||
    results = accountNameField.value + "\'s token balance(s): " + JSON.stringify(balance.result, null, 2) + "\n"
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Display the results in the **Result** field.
 | 
			
		||||
```javascript
 | 
			
		||||
  results += JSON.stringify(balance.result, null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send a request for the XRP balance and update the **XRP Balance** field.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getTokenBalance()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error getting token balance:', error);
 | 
			
		||||
    results = `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## base-module.html
 | 
			
		||||
 
 | 
			
		||||
@@ -125,7 +125,7 @@ If you forget to save the sequence number, you can find it in the escrow transac
 | 
			
		||||
 | 
			
		||||
Download the [Modular Tutorials](../../../../_code-samples/modular-tutorials/payment-modular-tutorials.zip)<!-- {.github-code-download} --> archive.
 | 
			
		||||
 | 
			
		||||
## five-bells.js
 | 
			
		||||
## five-bells.cjs
 | 
			
		||||
 | 
			
		||||
To generate a condition/fulfillment pair, use Node.js to run the `five-bells.js` script.
 | 
			
		||||
 | 
			
		||||
@@ -165,13 +165,13 @@ Connect to the ledger and get the account wallet.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function createConditionalEscrow() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
 let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}, creating conditional escrow.\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const sendAmount = amountField.value
 | 
			
		||||
  let results = `===Connected to ${net}===\n===Creating conditional escrow.===\n\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Prepare the cancel date by adding the number of seconds in the **Escrow Cancel Date** field to the current date and time. In practice, the cancel date might be in days, weeks, months, or years. Using seconds allows you to test scenarios with expired escrows.
 | 
			
		||||
@@ -209,18 +209,24 @@ Submit the signed object and wait for the results.
 | 
			
		||||
Report the results, parsing the _Sequence Number_ for later use.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += "\nSequence Number (Save!): " + tx.result.tx_json.Sequence
 | 
			
		||||
  results += "\n\nBalance changes: " +
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
    results = "\n=== *** Sequence Number (Save!): " + tx.result.tx_json.Sequence 
 | 
			
		||||
    results += "\n\n===Balance changes===\n" + 
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of createTimeEscrow()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // -------------------------------------------------------- Disconnect
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }// End of createTimeEscrow()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### finishConditionalEscrow()
 | 
			
		||||
@@ -232,7 +238,7 @@ async function finishConditionalEscrow() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}, fulfilling conditional escrow.\n`
 | 
			
		||||
  let results = `===Connected to ${net}===\n===Fulfilling conditional escrow.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
@@ -265,22 +271,22 @@ Submit the signed transaction and wait for the results.
 | 
			
		||||
Report the results
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += "\nBalance changes: " +
 | 
			
		||||
  results = "\n===Balance changes===" + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  resultField.value += results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Update the **XRP Balance Field**.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of finishEscrow()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message + ".===\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // -------------------------------------------------------- Disconnect
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## create-conditional-escrow.html
 | 
			
		||||
 
 | 
			
		||||
@@ -103,41 +103,38 @@ Connect to the XRP Ledger and get the account wallet.
 | 
			
		||||
```javascript
 | 
			
		||||
 async function createOffer() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  let results = 'Connecting to ' + net + '....\n'
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
      
 | 
			
		||||
  results  += "Connected. Getting wallets.\n"
 | 
			
		||||
  let results = `===Connected to ${net}, getting wallet....===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  results += accountNameField.value + " account address: " + wallet.address + "\n"
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Gather the information for what the taker pays, and what the taker gets in return. If the **Currency Code** is _XRP_, the amount is equal to the value in the **Amount** field. Otherwise, the `takerGets` parameter is constructed as an array containing the currency code, issuer address, and the value in the amount field.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (getCurrencyField.value == 'XRP') {
 | 
			
		||||
    takerGets = getAmountField.value
 | 
			
		||||
  } else {
 | 
			
		||||
    takerGetsString = '{"currency": "' + getCurrencyField.value +'",\n' +
 | 
			
		||||
        '"issuer": "' + getIssuerField.value + '",\n' +
 | 
			
		||||
        '"value": "' + getAmountField.value + '"}'
 | 
			
		||||
    takerGets = JSON.parse(takerGetsString)
 | 
			
		||||
  }
 | 
			
		||||
  try {
 | 
			
		||||
    if (getCurrencyField.value == 'XRP') {
 | 
			
		||||
        takerGets = getAmountField.value
 | 
			
		||||
    } else {
 | 
			
		||||
        takerGetsString = '{"currency": "' + getCurrencyField.value +'",\n' +
 | 
			
		||||
            '"issuer": "' + getIssuerField.value + '",\n' +
 | 
			
		||||
            '"value": "' + getAmountField.value + '"}'
 | 
			
		||||
        takerGets = JSON.parse(takerGetsString)
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The same logic is used to create the value for the `takerPays` parameter.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (payCurrencyField.value == 'XRP') {
 | 
			
		||||
    takerPays = payAmountField.value
 | 
			
		||||
  } else {
 | 
			
		||||
    takerPaysString = '{"currency": "' + payCurrencyField.value + '",\n' +
 | 
			
		||||
      '"issuer": "' + payIssuerField.value + '",\n' +
 | 
			
		||||
      '"value": "' + payAmountField.value + '"}'
 | 
			
		||||
    takerPays = JSON.parse(takerPaysString)
 | 
			
		||||
  }
 | 
			
		||||
    if (payCurrencyField.value == 'XRP') {
 | 
			
		||||
      takerPays = xrpl.xrpToDrops(payAmountField.value)
 | 
			
		||||
    } else {
 | 
			
		||||
      takerPaysString = '{"currency": "' + payCurrencyField.value + '",\n' +
 | 
			
		||||
        '"issuer": "' + payIssuerField.value + '",\n' +
 | 
			
		||||
        '"value": "' + payAmountField.value + '"}'
 | 
			
		||||
      takerPays = JSON.parse(takerPaysString)
 | 
			
		||||
    }
 | 
			
		||||
 ```
 | 
			
		||||
 | 
			
		||||
Define the `OfferCreate` transaction, using the `takerPays` and `takerGets` parameters defined above.
 | 
			
		||||
@@ -154,18 +151,16 @@ Define the `OfferCreate` transaction, using the `takerPays` and `takerGets` para
 | 
			
		||||
Sign and send the prepared transaction, and wait for the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
 | 
			
		||||
  const signed = wallet.sign(prepared)
 | 
			
		||||
  results += "\nSubmitting transaction...."
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    const signed = wallet.sign(prepared)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Request the token balance changes after the transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results  += "\nBalance changes: " + 
 | 
			
		||||
  JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
    results = '\n\n===Offer created===\n\n' +
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Get the new XRP balance, reflecting the payments and transaction fees.
 | 
			
		||||
@@ -174,17 +169,24 @@ Get the new XRP balance, reflecting the payments and transaction fees.
 | 
			
		||||
  xrpBalanceField.value =  (await client.getXrpBalance(wallet.address))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Run the getOffers() function to show any remaining available offers.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  getOffers()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()    
 | 
			
		||||
} // End of createOffer()
 | 
			
		||||
  } catch (err) {
 | 
			
		||||
    console.error('Error creating offer:', err);
 | 
			
		||||
    results = `\nError: ${err.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw err; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client          
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  })
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### getOffers
 | 
			
		||||
@@ -196,12 +198,11 @@ Connect to the XRP Ledger and get the Account wallet.
 | 
			
		||||
```javascript
 | 
			
		||||
async function getOffers() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  let results = 'Connecting to ' + net + '....\n'
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results  += "Connected.\n"
 | 
			
		||||
  let results = `===Connected to ' + ${net}, getting offers....===\n`
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  results += accountNameField.value + " account: " + wallet.address
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send a request for all `account_offers` for the specified account address and report the results.
 | 
			
		||||
@@ -209,26 +210,31 @@ Send a request for all `account_offers` for the specified account address and re
 | 
			
		||||
```javascript
 | 
			
		||||
  results += '\n\n*** Offers ***\n'
 | 
			
		||||
  let offers
 | 
			
		||||
  try {
 | 
			
		||||
    const offers = await client.request({
 | 
			
		||||
    try {
 | 
			
		||||
    offers = await client.request({
 | 
			
		||||
      method: "account_offers",
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated"
 | 
			
		||||
    })
 | 
			
		||||
    results += JSON.stringify(offers,null,2)
 | 
			
		||||
  } catch (err) {
 | 
			
		||||
      results += err
 | 
			
		||||
  }
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
    results = JSON.stringify(offers, null, 2)
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  } catch (err) {
 | 
			
		||||
    console.error('Error getting offers:', err);
 | 
			
		||||
    results = `\nError: ${err.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw err; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
}// End of getOffers()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### cancelOffer()
 | 
			
		||||
 | 
			
		||||
You can cancel an offer before it is matched with another offer.
 | 
			
		||||
@@ -236,28 +242,24 @@ You can cancel an offer before it is matched with another offer.
 | 
			
		||||
Connect to the XRP Ledger and get the account wallet.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  async function cancelOffer() {
 | 
			
		||||
    let results  = "Connecting to the selected ledger.\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    let net = getNet()
 | 
			
		||||
    results += 'Connecting to ' + net + '....\n'
 | 
			
		||||
    const client = new xrpl.Client(net)
 | 
			
		||||
    await client.connect()
 | 
			
		||||
    results  += "Connected.\n"
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    results += "wallet.address: = " + wallet.address
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
async function cancelOffer() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `===Connected to ${net}, canceling offer.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Prepare the `OfferCancel` transaction, passing the account address of the account that created the offer and the `Sequence` of the offer.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
  "TransactionType": "OfferCancel",
 | 
			
		||||
  "Account": wallet.address,
 | 
			
		||||
  "OfferSequence": parseInt(offerSequenceField.value)
 | 
			
		||||
  })
 | 
			
		||||
  try {
 | 
			
		||||
    const prepared = await client.autofill({
 | 
			
		||||
      "TransactionType": "OfferCancel",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "OfferSequence": parseInt(offerSequenceField.value)
 | 
			
		||||
    })
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Sign and submit the transaction, then wait for the result.
 | 
			
		||||
@@ -270,18 +272,25 @@ Sign and submit the transaction, then wait for the result.
 | 
			
		||||
Report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results  += "\nBalance changes: \n" + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
    results += "\nOffer canceled. Balance changes: \n" +
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Update the XRP Balance field, reflecting the transaction fee.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  xrpBalanceField.value =  (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()    
 | 
			
		||||
  } // End of cancelOffer()
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  catch (err) {
 | 
			
		||||
    console.error('Error canceling offer:', err);
 | 
			
		||||
    results = `\nError: ${err.message}\n`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
    throw err; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
}// End of cancelOffer()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## create-offer.html
 | 
			
		||||
 
 | 
			
		||||
@@ -170,62 +170,69 @@ Instantiate two new date objects, then set the dates to the current date plus th
 | 
			
		||||
```javascript
 | 
			
		||||
  let escrow_finish_date = new Date()
 | 
			
		||||
  let escrow_cancel_date = new Date()
 | 
			
		||||
  escrow_finish_date = addSeconds(parseInt(standbyEscrowFinishDateField.value))
 | 
			
		||||
  escrow_cancel_date = addSeconds(parseInt(standbyEscrowCancelDateField.value))
 | 
			
		||||
  escrow_finish_date = addSeconds(parseInt(escrowFinishTimeField.value))
 | 
			
		||||
  escrow_cancel_date = addSeconds(parseInt(escrowCancelTimeField.value))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Connect to the ledger and get the account wallet.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
   let net = getNet()
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results  = `Connected to ${net}.\nCreating time-based escrow.\n`
 | 
			
		||||
  let results = `===Connected to ${net}.===\n\n===Creating time-based escrow.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Define the transaction object.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const sendAmount = amountField.value
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const escrowTx = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowCreate",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
    "Destination": destinationField.value,
 | 
			
		||||
    "FinishAfter": escrow_finish_date,
 | 
			
		||||
    "CancelAfter": escrow_cancel_date
 | 
			
		||||
  })
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const sendAmount = amountField.value
 | 
			
		||||
    const escrowTx = await client.autofill({
 | 
			
		||||
      "TransactionType": "EscrowCreate",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": xrpl.xrpToDrops(sendAmount),
 | 
			
		||||
      "Destination": destinationField.value,
 | 
			
		||||
      "FinishAfter": escrow_finish_date,
 | 
			
		||||
      "CancelAfter": escrow_cancel_date
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
  ```
 | 
			
		||||
 | 
			
		||||
  Sign the prepared transaction object.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const signed = wallet.sign(escrowTx)
 | 
			
		||||
    const signed = wallet.sign(escrowTx)
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Submit the signed transaction object and wait for the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += "\nSuccess! Save this sequence number: " + tx.result.tx_json.Sequence 
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
    results += "\n===Success! === *** Save this sequence number: " + tx.result.tx_json.Sequence
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of createTimeBasedEscrow()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -235,22 +242,20 @@ Disconnect from the XRP Ledger.
 | 
			
		||||
async function finishEscrow() {
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Connect to the XRP Ledger and get the account wallet.
 | 
			
		||||
Connect to the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}. Finishing escrow....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  results += "\nwallet.address: = " + wallet.address
 | 
			
		||||
  let results = `===Connected to ${net}. Finishing escrow.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Define the transaction. The _Owner_ is the account that created the escrow. The _OfferSequence_ is the sequence number of the escrow transaction. Automatically fill in the common fields for the transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowFinish",
 | 
			
		||||
    "Account": accountAddressField.value,
 | 
			
		||||
@@ -274,7 +279,7 @@ Submit the signed transaction to the XRP ledger.
 | 
			
		||||
Report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results  += "\nBalance changes: " + 
 | 
			
		||||
  results  += "\n===Balance changes===" + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
@@ -285,11 +290,16 @@ Update the **XRP Balance** field.
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of finishEscrow()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message + "==="
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Get  Escrows
 | 
			
		||||
@@ -305,36 +315,43 @@ Connect to the network. The information you are looking for is public informatio
 | 
			
		||||
```javascript
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  results += `\nConnected to ${net}. Getting account escrows.\n`
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\n===Connected to ${net}.\nGetting account escrows.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create the `account_objects` request. Specify that you want objects of the type _escrow_.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const escrow_objects = await client.request({
 | 
			
		||||
    "id": 5,
 | 
			
		||||
    "command": "account_objects",
 | 
			
		||||
    "account": accountAddressField.value,
 | 
			
		||||
    "ledger_index": "validated",
 | 
			
		||||
    "type": "escrow"
 | 
			
		||||
  })
 | 
			
		||||
  try {
 | 
			
		||||
    const escrow_objects = await client.request({
 | 
			
		||||
      "id": 5,
 | 
			
		||||
      "command": "account_objects",
 | 
			
		||||
      "account": accountAddressField.value,
 | 
			
		||||
      "ledger_index": "validated",
 | 
			
		||||
      "type": "escrow"
 | 
			
		||||
    })
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += JSON.stringify(escrow_objects.result, null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
    results += JSON.stringify(escrow_objects.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // End of getEscrows()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\nError: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Get Transaction Info 
 | 
			
		||||
@@ -348,31 +365,39 @@ Connect to the XRP Ledger.
 | 
			
		||||
```javascript
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  let results = `\nConnected to ${net}.\nGetting transaction information...\n`
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\n===Connected to ${net}.===\n===Getting transaction information.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
  
 | 
			
		||||
Prepare and send the transaction information request. The only required parameter is the transaction ID.
 | 
			
		||||
  
 | 
			
		||||
```javascript
 | 
			
		||||
  const tx_info = await client.request({
 | 
			
		||||
    "id": 1,
 | 
			
		||||
    "command": "tx",
 | 
			
		||||
    "transaction": transactionField.value,
 | 
			
		||||
  })
 | 
			
		||||
  try {
 | 
			
		||||
    const tx_info = await client.request({
 | 
			
		||||
      "id": 1,
 | 
			
		||||
      "command": "tx",
 | 
			
		||||
      "transaction": transactionField.value,
 | 
			
		||||
    })
 | 
			
		||||
```
 | 
			
		||||
Report the results.
 | 
			
		||||
  
 | 
			
		||||
```javascript
 | 
			
		||||
  results += JSON.stringify(tx_info.result, null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
    results += JSON.stringify(tx_info.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
  
 | 
			
		||||
Disconnect from the XRP Ledger instance.  
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.  
 | 
			
		||||
  
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\nError: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of getTransaction()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -390,47 +415,55 @@ Connect to the XRP Ledger instance and get the account wallet.
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `\nConnected to ${net}. Cancelling escrow....`
 | 
			
		||||
  let results = `\n===Connected to ${net}. Cancelling escrow.===`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Prepare the EscrowCancel transaction, passing the escrow owner and offer sequence values.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const prepared = await client.autofill({
 | 
			
		||||
    "TransactionType": "EscrowCancel",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Owner": escrowOwnerField.value,
 | 
			
		||||
    "OfferSequence": parseInt(escrowSequenceNumberField.value)
 | 
			
		||||
  })
 | 
			
		||||
  try {
 | 
			
		||||
    const prepared = await client.autofill({
 | 
			
		||||
      "TransactionType": "EscrowCancel",
 | 
			
		||||
      "Account": accountAddressField.value,
 | 
			
		||||
      "Owner": escrowOwnerField.value,
 | 
			
		||||
      "OfferSequence": parseInt(escrowSequenceNumberField.value)
 | 
			
		||||
    })
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Sign the transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const signed = wallet.sign(prepared)
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const signed = wallet.sign(prepared)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Submit the transaction and wait for the response.
 | 
			
		||||
 | 
			
		||||
``` javascript
 | 
			
		||||
  const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
    const tx = await client.submitAndWait(signed.tx_blob)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results  += "\nBalance changes: " + 
 | 
			
		||||
    JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  ))
 | 
			
		||||
    results += "\n===Balance changes: " +
 | 
			
		||||
      JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger instance.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger instance.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
   }
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results += "\n===Error: " + error.message
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ labels:
 | 
			
		||||
 | 
			
		||||
This example shows how to:
 | 
			
		||||
 | 
			
		||||
1. Create a trust line between the standby account and the operational account.
 | 
			
		||||
1. Create a trust line between two accounts.
 | 
			
		||||
2. Send issued currency between accounts.
 | 
			
		||||
3. Display account balances for all currencies.
 | 
			
		||||
 | 
			
		||||
@@ -99,7 +99,7 @@ There are two asynchronous functions in the send-currency.js file that build on
 | 
			
		||||
 | 
			
		||||
A trust line enables two accounts to trade a defined currency up to a set limit. This gives the participants assurance that any exchanges are between known entities at agreed upon maximum amounts.
 | 
			
		||||
 | 
			
		||||
Connect to the XRPL server and get the account wallet.
 | 
			
		||||
Connect to the XRPL server.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function createTrustLine() {
 | 
			
		||||
@@ -108,27 +108,28 @@ async function createTrustLine() {
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = "\nConnected. Creating trust line.\n"
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create a `TrustSet` transaction, passing the currency code, issuer account, and the total value the holder is willing to accept.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const trustSet_tx = {
 | 
			
		||||
    "TransactionType": "TrustSet",
 | 
			
		||||
    "Account": accountAddressField.value,
 | 
			
		||||
    "LimitAmount": {
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "issuer": issuerField.value,
 | 
			
		||||
      "value": amountField.value
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const trustSet_tx = {
 | 
			
		||||
      "TransactionType": "TrustSet",
 | 
			
		||||
      "Account": accountAddressField.value,
 | 
			
		||||
      "LimitAmount": {
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "issuer": issuerField.value,
 | 
			
		||||
        "value": amountField.value
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Autofill the remaining default transaction parameters.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const ts_prepared = await client.autofill(trustSet_tx)
 | 
			
		||||
    const ts_prepared = await client.autofill(trustSet_tx)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Sign and send the transaction to the XRPL server, then wait for the results.
 | 
			
		||||
@@ -142,15 +143,32 @@ Sign and send the transaction to the XRPL server, then wait for the results.
 | 
			
		||||
Report the results of the transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (ts_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += '\nTrust line established between account \n' +
 | 
			
		||||
      accountAddressField.value + ' \n and account\n' + issuerField.value + '.'
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${ts_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results     
 | 
			
		||||
    if (ts_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
        results += '\n===Trust line established between account \n' +
 | 
			
		||||
        accountAddressField.value + ' \n and account\n' + issuerField.value + '.'
 | 
			
		||||
        resultField.value = results
 | 
			
		||||
    } else {
 | 
			
		||||
        results += `\n===Transaction failed: ${ts_result.result.meta.TransactionResult}`
 | 
			
		||||
        resultField.value = results     
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
} //End of createTrustline()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('===Error creating trust line:', error);
 | 
			
		||||
    results += `\n===Error: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
//End of createTrustline()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### sendCurrency()
 | 
			
		||||
@@ -167,52 +185,64 @@ async function sendCurrency() {
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results += '\nConnected.'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create a payment transaction to the destination account, specifying the amount using the currency, value, and issuer.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const send_currency_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "value": amountField.value,
 | 
			
		||||
      "issuer": issuerField.value
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": destinationField.value
 | 
			
		||||
  }
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const send_currency_tx = {
 | 
			
		||||
      "TransactionType": "Payment",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": {
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "value": amountField.value,
 | 
			
		||||
        "issuer": issuerField.value
 | 
			
		||||
      },
 | 
			
		||||
      "Destination": destinationField.value
 | 
			
		||||
    }
 | 
			
		||||
  ```
 | 
			
		||||
 | 
			
		||||
Autofill the remaining default transaction parameters.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const pay_prepared = await client.autofill(send_currency_tx)
 | 
			
		||||
    const pay_prepared = await client.autofill(send_currency_tx)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Sign and send the prepared payment transaction to the XRP Ledger, then await and report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
  results += `\n\nSending ${amountField.value} ${currencyField.value} to ${destinationField.value} ...`
 | 
			
		||||
 resultField.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += 'Transaction succeeded.'
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${pay_result.result.meta.TransactionResult}`
 | 
			
		||||
    const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
    results += `\n\n===Sending ${amountField.value} ${currencyField.value} to ${destinationField.value} ...`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
    if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
        results += '\n===Transaction succeeded.'
 | 
			
		||||
        resultField.value = results
 | 
			
		||||
    } else {
 | 
			
		||||
        results += `\n===Transaction failed: ${pay_result.result.meta.TransactionResult}`
 | 
			
		||||
        resultField.value = results
 | 
			
		||||
        xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Update the XRP value field to reflect the transaction fee.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    console.error('Error sending transaction:', error);
 | 
			
		||||
    results += `\nError: ${error.message}\n`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    throw error; // Re-throw the error to be handled by the caller
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    // Disconnect from the client
 | 
			
		||||
    await client.disconnect();
 | 
			
		||||
  }
 | 
			
		||||
} // end of sendCurrency()
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## send-currency.html
 | 
			
		||||
 
 | 
			
		||||
@@ -90,8 +90,8 @@ To cash a check you have received:
 | 
			
		||||
1. Enter the **Check ID** (**index** value).
 | 
			
		||||
2. Enter the **Amount** you want to collect, up to the full amount of the check.
 | 
			
		||||
3. Enter the currency code.
 | 
			
		||||
   a. If you cashing a check for XRP, enter _XRP_ in the **Currency Code** field.
 | 
			
		||||
	 b. If you are cashing a check for an issued currency token:
 | 
			
		||||
   a. If you are cashing a check for XRP, enter _XRP_ in the **Currency Code** field. 
 | 
			
		||||
   b. If you are cashing a check for an issued currency token:
 | 
			
		||||
	    1. Enter the **Issuer** of the token.
 | 
			
		||||
	    2. Enter the **Currency Code** code for the token.
 | 
			
		||||
4. Click **Cash Check**.
 | 
			
		||||
@@ -121,34 +121,35 @@ Download and expand the [Modular Tutorials](../../../../_code-samples/modular-tu
 | 
			
		||||
 | 
			
		||||
### sendCheck()
 | 
			
		||||
 | 
			
		||||
Connect to the XRP ledger and get the account wallet.
 | 
			
		||||
Connect to the XRP ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function sendCheck() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results = `\nConnected to ${net}.`
 | 
			
		||||
  results = `\n===Connected to ${net}.===\n===Sending check.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Prepare the transaction. Set the *check_amount* variable to the value in the **Amount** field.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let check_amount = amountField.value
 | 
			
		||||
  try {     
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    let check_amount = amountField.value
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 If the currency field is not _XRP_, create an `amount` object with the _currency_, _value_, and _issuer_. Otherwise, use the *check_amount* value as is.
 | 
			
		||||
 | 
			
		||||
 ```javascript
 | 
			
		||||
  if (currencyField.value !=  "XRP") {
 | 
			
		||||
  	check_amount = {
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "value": amountField.value,
 | 
			
		||||
      "issuer": wallet.address  	
 | 
			
		||||
  	}
 | 
			
		||||
  }
 | 
			
		||||
    if (currencyField.value !=  "XRP") {
 | 
			
		||||
      check_amount = {
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "value": amountField.value,
 | 
			
		||||
        "issuer": wallet.address  	
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ```
 | 
			
		||||
 | 
			
		||||
  Create the transaction object.
 | 
			
		||||
@@ -165,82 +166,87 @@ Prepare the transaction. Set the *check_amount* variable to the value in the **A
 | 
			
		||||
Autofill the remaining values and sign the prepared transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const check_prepared = await client.autofill(send_check_tx)
 | 
			
		||||
  const check_signed = wallet.sign(check_prepared)
 | 
			
		||||
    const check_prepared = await client.autofill(send_check_tx)
 | 
			
		||||
    const check_signed = wallet.sign(check_prepared)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send the transaction and wait for the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += '\nSending ' + amountField.value + ' ' + currencyField.value + ' to ' +
 | 
			
		||||
    destinationField.value + '...\n'
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const check_result = await client.submitAndWait(check_signed.tx_blob)
 | 
			
		||||
    results += '\n===Sending ' + amountField.value + ' ' + currencyField.
 | 
			
		||||
     value + ' to ' +  destinationField.value + '.===\n'
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    const check_result = await client.submitAndWait(check_signed.tx_blob)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += 'Transaction succeeded:\n'
 | 
			
		||||
    resultField.value += JSON.stringify(check_result.result, null, 2)
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `Error sending transaction: ${check_result.result.meta.TransactionResult}`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  }
 | 
			
		||||
    if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
      results = '===Transaction succeeded===\n\n'
 | 
			
		||||
      resultField.value += results + JSON.stringify(check_result.result, null, 2)
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Update the **XRP Balance** field.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP ledger.
 | 
			
		||||
Report any errors, then disconnect from the XRP ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendCheck()
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `Error sending transaction: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
}//end of sendCheck()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## getChecks()
 | 
			
		||||
 | 
			
		||||
Connect to the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function getChecks() {
 | 
			
		||||
  let net = getNet();
 | 
			
		||||
  const client = new xrpl.Client(net);
 | 
			
		||||
  await client.connect();
 | 
			
		||||
```
 | 
			
		||||
Initialize the results string and display the connection status.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let results = `\nConnected to ${net}.`;
 | 
			
		||||
  resultField.value = results;
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()   
 | 
			
		||||
  let results = `\n===Connected to ${net}.===\n===Getting account checks.===\n\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Define an `account_objects` query, filtering for the _check_ object type.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const check_objects = await client.request({
 | 
			
		||||
    "id": 5,
 | 
			
		||||
    "command": "account_objects",
 | 
			
		||||
    "account": accountAddressField.value,
 | 
			
		||||
    "ledger_index": "validated",
 | 
			
		||||
    "type": "check"
 | 
			
		||||
  });
 | 
			
		||||
  try {
 | 
			
		||||
    const check_objects = await client.request({
 | 
			
		||||
      "id": 5,
 | 
			
		||||
      "command": "account_objects",
 | 
			
		||||
      "account": accountAddressField.value,
 | 
			
		||||
      "ledger_index": "validated",
 | 
			
		||||
      "type": "check"
 | 
			
		||||
    })
 | 
			
		||||
```
 | 
			
		||||
Display the retrieved `Check` objects in the result field.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  resultField.value = JSON.stringify(check_objects.result, null, 2);
 | 
			
		||||
    resultField.value += JSON.stringify(check_objects.result, null, 2)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP Ledger.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect();
 | 
			
		||||
  }  catch (error) {
 | 
			
		||||
    results = `Error getting checks: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of getChecks()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -250,143 +256,71 @@ Connect to the XRP Ledger and get the account wallet
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function cashCheck() {
 | 
			
		||||
  let net = getNet();
 | 
			
		||||
  const client = new xrpl.Client(net);
 | 
			
		||||
  await client.connect();
 | 
			
		||||
  results = `\nConnected to ${net}.`;
 | 
			
		||||
  resultField.value = results;
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value);
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results = `\n===Connected to ${net}.===\n===Cashing check.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Set the check amount.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let check_amount = amountField.value;
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    let check_amount = amountField.value
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If the currency is not _XRP_, create an `amount` object with _value_, _currency_, and _issuer_.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (currencyField.value != "XRP") {
 | 
			
		||||
    check_amount = {
 | 
			
		||||
      "value": amountField.value,
 | 
			
		||||
      "currency": currencyField.value,
 | 
			
		||||
      "issuer": issuerField.value
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
    if (currencyField.value !=  "XRP") {
 | 
			
		||||
      check_amount = {
 | 
			
		||||
        "value": amountField.value,
 | 
			
		||||
        "currency": currencyField.value,
 | 
			
		||||
        "issuer": issuerField.value  	
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create the `CheckCash` transaction object.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const cash_check_tx = {
 | 
			
		||||
    "TransactionType": "CheckCash",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": check_amount,
 | 
			
		||||
    "CheckID": checkIdField.value
 | 
			
		||||
  };
 | 
			
		||||
    const cash_check_tx = {
 | 
			
		||||
      "TransactionType": "CheckCash",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": check_amount,
 | 
			
		||||
      "CheckID": checkIdField.value
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Autofill the transaction details.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const cash_prepared = await client.autofill(cash_check_tx);
 | 
			
		||||
    const cash_prepared = await client.autofill(cash_check_tx)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Sign the prepared transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const cash_signed = wallet.sign(cash_prepared);
 | 
			
		||||
  results += ' Receiving ' + amountField.value + ' ' + currencyField.value + '.\n';
 | 
			
		||||
  resultField.value = results;
 | 
			
		||||
    const cash_signed = wallet.sign(cash_prepared)
 | 
			
		||||
    results = ' Receiving ' + amountField.value + ' ' + currencyField.value + '.\n'
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Submit the transaction and wait for the result.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const check_result = await client.submitAndWait(cash_signed.tx_blob);
 | 
			
		||||
```
 | 
			
		||||
  const check_result = await client.submitAndWait(cash_signed.tx_blob)
 | 
			
		||||
  ```
 | 
			
		||||
 | 
			
		||||
Report the transaction results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += 'Transaction succeeded:\n' + JSON.stringify(check_result.result, null, 2);
 | 
			
		||||
    resultField.value = results;
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `Error sending transaction: ${check_result.result.meta.TransactionResult}`;
 | 
			
		||||
    resultField.value = results;
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 Update the XRP Balance field.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address));
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect();
 | 
			
		||||
} // end of cashCheck()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## cancelCheck()
 | 
			
		||||
 | 
			
		||||
Connect to the XRP Ledger and get the account wallet.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function cancelCheck() {
 | 
			
		||||
  // Connect to the XRP Ledger.
 | 
			
		||||
  let net = getNet();
 | 
			
		||||
  const client = new xrpl.Client(net);
 | 
			
		||||
  await client.connect();
 | 
			
		||||
  results = `\nConnected to ${net}.`;
 | 
			
		||||
  resultField.value = results;
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create the CheckCancel transaction object, passing the wallet address and the Check ID value (the _Index_).
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const cancel_check_tx = {
 | 
			
		||||
    "TransactionType": "CheckCancel",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "CheckID": checkIdField.value
 | 
			
		||||
  };
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Autofill the transaction details.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const cancel_prepared = await client.autofill(cancel_check_tx);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Sign the prepared transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const cancel_signed = wallet.sign(cancel_prepared);
 | 
			
		||||
  results += ' Cancelling check.\n';
 | 
			
		||||
  resultField.value = results;
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Submit the transaction and wait for the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const check_result = await client.submitAndWait(cancel_signed.tx_blob);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Report the transaction results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
    results += `Transaction succeeded: ${check_result.result.meta.TransactionResult}`;
 | 
			
		||||
    resultField.value = results;
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `Error sending transaction: ${check_result.result.meta.TransactionResult}`;
 | 
			
		||||
    resultField.value = results;
 | 
			
		||||
  }
 | 
			
		||||
    if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
      results = '===Transaction succeeded===\n' + JSON.stringify(check_result.result, null, 2)
 | 
			
		||||
      resultField.value += results
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Update the XRP Balance field.
 | 
			
		||||
@@ -395,10 +329,86 @@ Update the XRP Balance field.
 | 
			
		||||
  xrpBalanceField.value = (await client.getXrpBalance(wallet.address));
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Disconnect from the XRP ledger.
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  client.disconnect();
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `Error sending transaction: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
} // end of cashCheck()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## cancelCheck()
 | 
			
		||||
 | 
			
		||||
Connect to the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function cancelCheck() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  results = `\n===Connected to ${net}.===\n===Cancelling check.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create the CheckCancel transaction object, passing the wallet address and the Check ID value (the _Index_).
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const cancel_check_tx = {
 | 
			
		||||
      "TransactionType": "CheckCancel",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "CheckID": checkIdField.value
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Autofill the transaction details.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
    const cancel_prepared = await client.autofill(cancel_check_tx)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Sign the prepared transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
    const cancel_signed = wallet.sign(cancel_prepared)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Submit the transaction and wait for the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
    const check_result = await client.submitAndWait(cancel_signed.tx_blob)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Report the transaction results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
    if (check_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
      results += `===Transaction succeeded===\n${check_result.result.meta.TransactionResult}`
 | 
			
		||||
      resultField.value = results
 | 
			
		||||
    } 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Update the XRP Balance field.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
    xrpBalanceField.value = (await client.getXrpBalance(wallet.address))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `Error sending transaction: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // end of cancelCheck()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -34,8 +34,8 @@ To get the accounts:
 | 
			
		||||
   [](../../../img/mt-send-mpt-1-gathered-info.png)
 | 
			
		||||
   2. Cut and paste the MPT Issuance ID to the **MPT Issuance ID** field.
 | 
			
		||||
   3. Click **Distribute Account Info** to populate the **Account 1** fields.<br/><br/>
 | 
			
		||||
   (If you did not use the MPT Generator, enter the **Account 1 Name**, **Account 1 Address**, **Account 1 Seed**, and **MPT Issuance ID** in the corresponding fields.)
 | 
			
		||||
4. Click **Get New Account 2**.
 | 
			
		||||
   If you did not use the MPT Generator, enter the **Account 1 Name**, **Account 1 Address**, **Account 1 Seed**, and **MPT Issuance ID** in the corresponding fields.)
 | 
			
		||||
4. Click **Get New Account 2**, or use a seed to **Get Account 2 from Seed**.
 | 
			
		||||
5. Optionally, add the **Account 2 Name**, an arbitrary human-readable name that helps to differentiate the accounts.
 | 
			
		||||
[](../../../img/mt-send-mpt-2-account-2.png)
 | 
			
		||||
 | 
			
		||||
@@ -79,62 +79,69 @@ The code that supports the MPT features is in the `send-mpt.js` file. Standard s
 | 
			
		||||
 | 
			
		||||
### sendMPT()
 | 
			
		||||
 | 
			
		||||
Connect to the network and instantiate the account wallet.
 | 
			
		||||
Connect to the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript    
 | 
			
		||||
async function sendMPT() {
 | 
			
		||||
  let net = getNet()
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  let results = `===Connected to ${net}.===\n===Sending MPT.===\n`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Instantiate the parameter variables.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const mpt_issuance_id = mptIdField.value
 | 
			
		||||
  const mpt_quantity = amountField.value
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const mpt_issuance_id = mptIdField.value
 | 
			
		||||
    const mpt_quantity = amountField.value
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Create a Payment transaction using the MPT for the Amount.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const send_mpt_tx = {
 | 
			
		||||
    "TransactionType": "Payment",
 | 
			
		||||
    "Account": wallet.address,
 | 
			
		||||
    "Amount": {
 | 
			
		||||
      "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
      "value": mpt_quantity,
 | 
			
		||||
    },
 | 
			
		||||
    "Destination": destinationField.value,
 | 
			
		||||
  }
 | 
			
		||||
    const send_mpt_tx = {
 | 
			
		||||
      "TransactionType": "Payment",
 | 
			
		||||
      "Account": wallet.address,
 | 
			
		||||
      "Amount": {
 | 
			
		||||
        "mpt_issuance_id": mpt_issuance_id,
 | 
			
		||||
        "value": mpt_quantity,
 | 
			
		||||
      },
 | 
			
		||||
      "Destination": destinationField.value,
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Prepare and sign the transaction.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
  const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
    const pay_prepared = await client.autofill(send_mpt_tx)
 | 
			
		||||
    const pay_signed = wallet.sign(pay_prepared)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send the prepared transaction and report the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += `\n\nSending ${mpt_quantity} ${mpt_issuance_id} to ${destinationField.value} ...`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
  if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
 | 
			
		||||
        results += 'Transaction succeeded.\n\n'
 | 
			
		||||
        results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    results += `\n===Sending ${mpt_quantity} ${mpt_issuance_id} to ${destinationField.value} ...`
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
  } else {
 | 
			
		||||
    results += `\nTransaction failed: ${pay_result.result.meta.TransactionResult}\n\n`
 | 
			
		||||
    const pay_result = await client.submitAndWait(pay_signed.tx_blob)
 | 
			
		||||
    results += '\n\n===Transaction succeeded.\n'
 | 
			
		||||
    results += JSON.stringify(pay_result.result, null, 2)
 | 
			
		||||
    resultField.value = results
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  catch (error) {
 | 
			
		||||
    results = `Error sending MPT: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
} // end of sendMPT()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -142,7 +149,7 @@ Send the prepared transaction and report the results.
 | 
			
		||||
 | 
			
		||||
Get all of the MPTs for the selected account by filtering for MPT objects and looping through the array to display them one at a time.
 | 
			
		||||
 | 
			
		||||
Connect to the XRPL instance and get the account wallet.
 | 
			
		||||
Connect to the XRPL ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
async function getMPTs() {
 | 
			
		||||
@@ -150,46 +157,59 @@ async function getMPTs() {
 | 
			
		||||
  const client = new xrpl.Client(net)
 | 
			
		||||
  await client.connect()
 | 
			
		||||
  const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
  let results = `Connected to ${net}....`
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  let results = ''
 | 
			
		||||
  resultField.value = `===Connected to ${net}. Getting MPTs.===`
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Send an `account_objects` request, specifying the type _mptoken_.
 | 
			
		||||
Send an `account_objects` request, specifying the type _mptoken_. Wait for the results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  const mpts = await client.request({
 | 
			
		||||
      command: "account_objects",
 | 
			
		||||
      account: wallet.address,
 | 
			
		||||
      ledger_index: "validated",
 | 
			
		||||
      type: "mptoken"
 | 
			
		||||
    })
 | 
			
		||||
  try {
 | 
			
		||||
    const wallet = xrpl.Wallet.fromSeed(accountSeedField.value)
 | 
			
		||||
    const mpts = await client.request({
 | 
			
		||||
        command: "account_objects",
 | 
			
		||||
        account: wallet.address,
 | 
			
		||||
        ledger_index: "validated",
 | 
			
		||||
        type: "mptoken"
 | 
			
		||||
      })
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Stringify and parse the JSON result string.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
  let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
  let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
    let JSONString = JSON.stringify(mpts.result, null, 2)
 | 
			
		||||
    let JSONParse = JSON.parse(JSONString)
 | 
			
		||||
    let numberOfMPTs = JSONParse.account_objects.length
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Loop through the filtered array of account_objects to list all of the MPTs held by the account.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  let x = 0
 | 
			
		||||
  while (x < numberOfMPTs){
 | 
			
		||||
    results += "\n\nMPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
             + "\nMPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
    x++
 | 
			
		||||
  }
 | 
			
		||||
    let x = 0
 | 
			
		||||
    while (x < numberOfMPTs){
 | 
			
		||||
      results += "\n\n===MPT Issuance ID: " + JSONParse.account_objects[x].MPTokenIssuanceID
 | 
			
		||||
              + "\n===MPT Amount: " + JSONParse.account_objects[x].MPTAmount
 | 
			
		||||
      x++
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Return the parsed results, followed by the raw results.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  results += "\n\n" + JSONString
 | 
			
		||||
  resultField.value = results
 | 
			
		||||
  client.disconnect()
 | 
			
		||||
    results += "\n\n" + JSONString
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Catch and report any errors, then disconnect from the XRP Ledger.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    results = `===Error getting MPTs: ${error}`
 | 
			
		||||
    resultField.value += results
 | 
			
		||||
  }
 | 
			
		||||
  finally {
 | 
			
		||||
    client.disconnect()
 | 
			
		||||
  }
 | 
			
		||||
} // End of getMPTs()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										76
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										76
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -18,6 +18,7 @@
 | 
			
		||||
        "@uiw/react-codemirror": "^4.21.21",
 | 
			
		||||
        "@xrplf/isomorphic": "^1.0.0-beta.1",
 | 
			
		||||
        "clsx": "^2.0.0",
 | 
			
		||||
        "five-bells-condition": "^5.0.1",
 | 
			
		||||
        "lottie-react": "^2.4.0",
 | 
			
		||||
        "moment": "^2.29.4",
 | 
			
		||||
        "node-fetch": "^3.3.2",
 | 
			
		||||
@@ -3067,6 +3068,17 @@
 | 
			
		||||
        "safer-buffer": "~2.1.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/asn1.js": {
 | 
			
		||||
      "version": "4.10.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz",
 | 
			
		||||
      "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==",
 | 
			
		||||
      "license": "MIT",
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "bn.js": "^4.0.0",
 | 
			
		||||
        "inherits": "^2.0.1",
 | 
			
		||||
        "minimalistic-assert": "^1.0.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/assert-plus": {
 | 
			
		||||
      "version": "1.0.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
 | 
			
		||||
@@ -3186,6 +3198,22 @@
 | 
			
		||||
        "url": "https://github.com/sponsors/sindresorhus"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/bindings": {
 | 
			
		||||
      "version": "1.5.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
 | 
			
		||||
      "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
 | 
			
		||||
      "license": "MIT",
 | 
			
		||||
      "optional": true,
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "file-uri-to-path": "1.0.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/bn.js": {
 | 
			
		||||
      "version": "4.12.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.2.tgz",
 | 
			
		||||
      "integrity": "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw==",
 | 
			
		||||
      "license": "MIT"
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/bootstrap": {
 | 
			
		||||
      "version": "4.6.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.2.tgz",
 | 
			
		||||
@@ -3857,6 +3885,18 @@
 | 
			
		||||
        "safer-buffer": "^2.1.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/ed25519": {
 | 
			
		||||
      "version": "0.0.4",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/ed25519/-/ed25519-0.0.4.tgz",
 | 
			
		||||
      "integrity": "sha512-81yyGDHl4hhTD2YY779FRRMMAuKR3IQ2MmPFdwTvLnmZ+O02PgONzVgeyTWCjs/NCNAr35Ccg+hUd1y84Kdkbg==",
 | 
			
		||||
      "hasInstallScript": true,
 | 
			
		||||
      "license": "BSD-2-Clause",
 | 
			
		||||
      "optional": true,
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "bindings": "^1.2.1",
 | 
			
		||||
        "nan": "^2.0.9"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/electron-to-chromium": {
 | 
			
		||||
      "version": "1.5.13",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz",
 | 
			
		||||
@@ -4131,6 +4171,13 @@
 | 
			
		||||
      "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==",
 | 
			
		||||
      "license": "MIT"
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/file-uri-to-path": {
 | 
			
		||||
      "version": "1.0.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
 | 
			
		||||
      "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
 | 
			
		||||
      "license": "MIT",
 | 
			
		||||
      "optional": true
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/fill-range": {
 | 
			
		||||
      "version": "7.1.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
 | 
			
		||||
@@ -4148,6 +4195,19 @@
 | 
			
		||||
      "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",
 | 
			
		||||
      "license": "MIT"
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/five-bells-condition": {
 | 
			
		||||
      "version": "5.0.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/five-bells-condition/-/five-bells-condition-5.0.1.tgz",
 | 
			
		||||
      "integrity": "sha512-rmVJAyyTBOBIYTWHGQzxCWKlSobwwuOb3adeHrBANddTs4IH5HDkWsbNFjGtx8LlGRPHN2/UoU/f6iA1QlaIow==",
 | 
			
		||||
      "license": "Apache-2.0",
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "asn1.js": "^4.9.0",
 | 
			
		||||
        "tweetnacl": "^0.14.1"
 | 
			
		||||
      },
 | 
			
		||||
      "optionalDependencies": {
 | 
			
		||||
        "ed25519": "0.0.4"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/flexsearch": {
 | 
			
		||||
      "version": "0.7.43",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/flexsearch/-/flexsearch-0.7.43.tgz",
 | 
			
		||||
@@ -5677,6 +5737,12 @@
 | 
			
		||||
        "node": ">=8"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/minimalistic-assert": {
 | 
			
		||||
      "version": "1.0.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
 | 
			
		||||
      "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==",
 | 
			
		||||
      "license": "ISC"
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/minimatch": {
 | 
			
		||||
      "version": "7.4.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.2.tgz",
 | 
			
		||||
@@ -5727,6 +5793,13 @@
 | 
			
		||||
        "mustache": "bin/mustache"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/nan": {
 | 
			
		||||
      "version": "2.22.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.2.tgz",
 | 
			
		||||
      "integrity": "sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==",
 | 
			
		||||
      "license": "MIT",
 | 
			
		||||
      "optional": true
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/nanoid": {
 | 
			
		||||
      "version": "5.0.9",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.9.tgz",
 | 
			
		||||
@@ -7867,8 +7940,7 @@
 | 
			
		||||
    "node_modules/tweetnacl": {
 | 
			
		||||
      "version": "0.14.5",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
 | 
			
		||||
      "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
 | 
			
		||||
      "dev": true
 | 
			
		||||
      "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/typescript": {
 | 
			
		||||
      "version": "5.7.3",
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,7 @@
 | 
			
		||||
    "@uiw/react-codemirror": "^4.21.21",
 | 
			
		||||
    "@xrplf/isomorphic": "^1.0.0-beta.1",
 | 
			
		||||
    "clsx": "^2.0.0",
 | 
			
		||||
    "five-bells-condition": "^5.0.1",
 | 
			
		||||
    "lottie-react": "^2.4.0",
 | 
			
		||||
    "moment": "^2.29.4",
 | 
			
		||||
    "node-fetch": "^3.3.2",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user