fix: BN functions on sendCoinsBatch
This commit is contained in:
parent
2da14d64b3
commit
418668d232
1 changed files with 2 additions and 2 deletions
|
|
@ -85,14 +85,14 @@ function sendCoinsBatch (account, txs, cryptoCode) {
|
||||||
.then(() => calculateFeeDiscount(feeMultiplier))
|
.then(() => calculateFeeDiscount(feeMultiplier))
|
||||||
.then(newFee => fetch('settxfee', [newFee]))
|
.then(newFee => fetch('settxfee', [newFee]))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const txAddressAmountPairs = _.map(tx => [tx.address, tx.cryptoAtoms.shift(-unitScale).toFixed(8)], txs)
|
const txAddressAmountPairs = _.map(tx => [tx.address, tx.cryptoAtoms.shiftedBy(-unitScale).toFixed(8)], txs)
|
||||||
return Promise.all([JSON.stringify(_.fromPairs(txAddressAmountPairs))])
|
return Promise.all([JSON.stringify(_.fromPairs(txAddressAmountPairs))])
|
||||||
})
|
})
|
||||||
.then(([obj]) => fetch('sendmany', ['', obj]))
|
.then(([obj]) => fetch('sendmany', ['', obj]))
|
||||||
.then((txId) => fetch('gettransaction', [txId]))
|
.then((txId) => fetch('gettransaction', [txId]))
|
||||||
.then((res) => _.pick(['fee', 'txid'], res))
|
.then((res) => _.pick(['fee', 'txid'], res))
|
||||||
.then((pickedObj) => ({
|
.then((pickedObj) => ({
|
||||||
fee: BN(pickedObj.fee).abs().shift(unitScale).round(),
|
fee: new BN(pickedObj.fee).abs().shiftedBy(unitScale).decimalPlaces(0),
|
||||||
txid: pickedObj.txid
|
txid: pickedObj.txid
|
||||||
}))
|
}))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue