尝试发送ltc硬币uisng Bitgo js

时间:2018-07-05 06:53:55

标签: node.js

我想使用bitGo js api发送ltc,但是它没有引起问题,对于btc来说效果很好,但对于ltc却不起作用。我试图将金额隐蔽到satoshi和litoshi中,但直到不行工作。以下是我的代码:

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

    const coin = 'tltc';
    const basecoin = bitgo.coin(coin);
    // TODO: set your access token here
    const accessToken = null;
    const walletId = '5941ce2db42fcbc70717e5a898fd1595';
    // TODO: set your passphrase here
    const walletPassphrase = null;

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

      const walletInstance = yield basecoin.wallets().get({ id: walletId });

      const newReceiveAddress1 = yield walletInstance.createAddress();
      const newReceiveAddress2 = yield walletInstance.createAddress();

      const transaction = yield walletInstance.sendMany({
        recipients: [
          {
            amount: '12341234', //not getting how to convert the  amount here
            address: newReceiveAddress1.address
          },
],
        walletPassphrase: walletPassphrase
      });
      const explanation = basecoin.explainTransaction({ txHex: transaction.tx });

      console.log('Wallet ID:', walletInstance.id());
      console.log('Current Receive Address:', walletInstance.receiveAddress());
      console.log('New Transaction:', JSON.stringify(transaction, null, 4));
      console.log('Transaction Explanation:', JSON.stringify(explanation, null, 4));
    })();

请提出一些解决方案,以解决如何在bitGo js中传递给api的send方法时解决金额问题

0 个答案:

没有答案