diff --git a/lib/plugins/wallet/bitcoind/bitcoind.js b/lib/plugins/wallet/bitcoind/bitcoind.js index 0f61be64..6d7a9889 100644 --- a/lib/plugins/wallet/bitcoind/bitcoind.js +++ b/lib/plugins/wallet/bitcoind/bitcoind.js @@ -84,10 +84,10 @@ function sendCoinsBatch (account, txs, cryptoCode, feeMultiplier) { .then(() => calculateFeeDiscount(feeMultiplier)) .then(newFee => fetch('settxfee', [newFee])) .then(() => { - const txAddressAmountPairs = _.map(tx => [tx.address, tx.cryptoAtoms.shiftedBy(-unitScale).toFixed(8)], txs) - return Promise.all([JSON.stringify(_.fromPairs(txAddressAmountPairs))]) + const txAddressAmountPairs = _.map(tx => [tx.toAddress, BN(tx.cryptoAtoms).shiftedBy(-unitScale).toFixed(8)], txs) + return _.fromPairs(txAddressAmountPairs) }) - .then(([obj]) => fetch('sendmany', ['', obj])) + .then((obj) => fetch('sendmany', ['', obj])) .then((txId) => fetch('gettransaction', [txId])) .then((res) => _.pick(['fee', 'txid'], res)) .then((pickedObj) => ({ diff --git a/lib/tx-batching.js b/lib/tx-batching.js index e36c48d7..b395c791 100644 --- a/lib/tx-batching.js +++ b/lib/tx-batching.js @@ -48,6 +48,7 @@ function setErroredBatch (batch, errorMsg) { function getBatchTransactions (batch) { const sql = `SELECT * FROM cash_in_txs WHERE batch_id=$1` return db.manyOrNone(sql, [batch.id]) + .then(res => _.map(_.mapKeys(_.camelCase), res)) } function getBatchesByStatus (statuses) {