feat: add batch_time and batched to cash_in_txs

feat: add batched flag to clear tx to send
feat: add batch information to front-end
feat: change transaction sending info on batch sending
fix: batching support function added to all wallet plugins
fix: mock-wallet batching check
feat: send machine information about batchable coins
This commit is contained in:
Sérgio Salgado 2021-05-24 19:32:45 +01:00
parent 8289c55acf
commit 00c38ea721
8 changed files with 43 additions and 19 deletions

View file

@ -102,7 +102,7 @@ function diff (oldTx, newTx) {
}
function ensureRatchet (oldField, newField, fieldKey) {
const monotonic = ['cryptoAtoms', 'fiat', 'cashInFeeCrypto', 'send', 'sendConfirmed', 'operatorCompleted', 'timedout', 'txVersion']
const monotonic = ['cryptoAtoms', 'fiat', 'cashInFeeCrypto', 'send', 'sendConfirmed', 'operatorCompleted', 'timedout', 'txVersion', 'batched']
const free = ['sendPending', 'error', 'errorCode', 'customerId']
if (_.isNil(oldField)) return true
@ -138,11 +138,11 @@ function nilEqual (a, b) {
function isClearToSend (oldTx, newTx) {
const now = Date.now()
return newTx.send &&
return (newTx.send || newTx.batched) &&
(!oldTx || (!oldTx.sendPending && !oldTx.sendConfirmed)) &&
(newTx.created > now - PENDING_INTERVAL_MS)
}
function isFinalTxStage (txChanges) {
return txChanges.send
return txChanges.send || txChanges.batched
}