pooja
pooja

Reputation: 23

how to send xrp tokens using bitgo

const BitGoJS = require(__dirname + '/BitGoJS/src/index.js');
const bitgo = new BitGoJS.BitGo({ env: 'test' });

const Promise = require('bluebird');
const coin = 'txrp';
const basecoin = bitgo.coin(coin);
// TODO: set your access token here
const accessToken = 'xxxxxxxxxx';
const walletId = 'xxxxxxxxxx';
// TODO: set your passphrase here
const walletPassphrase = 'xxxxxxxxxxxx';

Promise.coroutine(function *() 
{
        bitgo.authenticateWithAccessToken({ accessToken: accessToken });

    bitgo.unlock({ otp: '0000000' }).then(function(unlockResponse) {
    });    
    let user_walletId    =  'xxxx';
        const walletInstance = yield basecoin.wallets().get({ id: walletId });
        const wallet         = yield basecoin.wallets().get({ id: user_walletId });
    const newReceiveAddress1 = wallet.receiveAddress();
    console.log('receiveAddress is :'+newReceiveAddress1);
    console.log('Balance is: ' + (walletInstance.balance() / 1e8).toFixed(4));
    const transaction = yield walletInstance.sendMany
    ({
        recipients: [
        {  
        amount:  '0.1' * 1e8,           
        address: newReceiveAddress1 
        },
],
walletPassphrase: walletPassphrase
       });  
        const explanation = basecoin.explainTransaction({ txHex: transaction.tx });  
    console.log(transaction.tx);

})();

i am not able to send xrp token. show error below Unhandled rejection Error: Cannot read property 'nonNumericString' of undefined requestId=cjjs6t6242xd1p9rx1h5u9lch

Upvotes: 2

Views: 264

Answers (1)

ycdesu
ycdesu

Reputation: 735

You have to modify your amount to valid string. Amount '8000.0' is not accepted by bitgo, and you have to remove the fraction part of the string. So the valid amount is '8000'.

Upvotes: 1

Related Questions