feat: add batch_id to cash_in_txs
feat: bitcoind sendmany request feat: check if wallet supports transaction batching
This commit is contained in:
parent
24ed69244c
commit
c8adaabf85
3 changed files with 43 additions and 0 deletions
|
|
@ -79,6 +79,22 @@ function sendCoins (account, tx, settings, operatorId, feeMultiplier) {
|
|||
})
|
||||
}
|
||||
|
||||
function sendCoinsBatch (account, txs, cryptoCode) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => {
|
||||
const txAddressAmountPairs = _.map(tx => [tx.address, tx.cryptoAtoms.shift(-unitScale).toFixed(8)], txs)
|
||||
return Promise.all([JSON.stringify(_.fromPairs(txAddressAmountPairs))])
|
||||
})
|
||||
.then(([obj]) => fetch('sendmany', ['', obj]))
|
||||
.then(res => ({
|
||||
txid: res.txid
|
||||
}))
|
||||
.catch(err => {
|
||||
if (err.code === -6) throw new E.InsufficientFundsError()
|
||||
throw err
|
||||
})
|
||||
}
|
||||
|
||||
function newAddress (account, info, tx, settings, operatorId) {
|
||||
return checkCryptoCode(info.cryptoCode)
|
||||
.then(() => fetch('getnewaddress'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue