Home > OS >  I am unable to send custom token to other wallet on XRP Ledger
I am unable to send custom token to other wallet on XRP Ledger

Time:08-17

I have manually added trust line to account which I have to receive the token. I have token SOX token in issuer wallet. I want to send to receiver wallet mentioned below. I am trying on testnet.

var xrpl = require('xrpl');

// Issuer wallet
// Address = rnA9soPJPtfuTaEhGR7C6VKWei2CtzmLxJ
// Secret = sn2tgPrdCr72jvMxjKskGmPH2a1VH

// receiver Account
// Address = rbBuZYumQhogsq6FFP6nkvm1GEiyLvNTz;
// Secret = sndPAYk5CcqwRpm4oTcofvjx7jAXX;

// Connect ---------------------------------------------------------------------
async function main() {
  const client = new xrpl.Client('wss://s.altnet.rippletest.net:51233');

  await client.connect();

  const hot_wallet = xrpl.Wallet.fromSeed('sn2tgPrdCr72jvMxjKskGmPH2a1VH');

  // Send token ----------------------------------------------------------------
  const currency_code = 'SOX';
  const issue_quantity = '100';

  const send_token_tx = {
    TransactionType: 'Payment',
    Account: hot_wallet.address,
    Amount: {
      currency: currency_code,
      value: issue_quantity,
      issuer: hot_wallet.address,
    },
    Destination: 'rbBuZYumQhogsq6FFP6nkvm1GEiyLvNTz',
    DestinationTag: 1, // Needed since we enabled Require Destination Tags
    // on the hot account earlier.
  };

  const pay_prepared = await client.autofill(send_token_tx);
  const pay_signed = hot_wallet.sign(pay_prepared);
  const pay_result = await client.submitAndWait(pay_signed.tx_blob);

  console.log(pay_result);

  client.disconnect();
}

main();

CodePudding user response:

You have put the wrong address on the issuer the correct way should be

issuer: 'rn2sbUWaB2iDPjuDncEUXePRwtVdafTBk3',
  • Related