feat: add transaction batching module

feat: plugin sendCoins batching support
feat: batching processing on poller
feat: mock-wallet batching
fix: bitcoin tx batching
fix: transaction batching db table
This commit is contained in:
Sérgio Salgado 2021-05-24 02:53:36 +01:00
parent c8adaabf85
commit 73c0d09198
7 changed files with 154 additions and 6 deletions

View file

@ -22,6 +22,7 @@ const machineLoader = require('./machine-loader')
const customers = require('./customers')
const commissionMath = require('./commission-math')
const loyalty = require('./loyalty')
const transactionBatching = require('./tx-batching')
const { cassetteMaxCapacity, CASH_OUT_DISPENSE_READY, CONFIRMATION_CODE } = require('./constants')
@ -277,6 +278,15 @@ function plugins (settings, deviceId) {
}
function sendCoins (tx) {
if (wallet.supportsBatching(settings, tx.cryptoCode)) {
return transactionBatching.addTransactionToBatch(tx)
.then(() => ({
batched: true,
sendPending: false,
error: null,
errorCode: null
}))
}
return wallet.sendCoins(settings, tx)
}