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:
parent
8289c55acf
commit
00c38ea721
8 changed files with 43 additions and 19 deletions
|
|
@ -2,6 +2,7 @@ const _ = require('lodash/fp')
|
|||
const pgp = require('pg-promise')()
|
||||
const uuid = require('uuid')
|
||||
|
||||
const BN = require('./bn')
|
||||
const db = require('./db')
|
||||
const wallet = require('./wallet')
|
||||
|
||||
|
|
@ -17,10 +18,13 @@ function closeTransactionBatch (batch) {
|
|||
return db.none(sql, [batch.id])
|
||||
}
|
||||
|
||||
function confirmSentBatch (batch) {
|
||||
const sql = `UPDATE transaction_batches SET status='sent', error_message=NULL WHERE id=$1`
|
||||
function confirmSentBatch (batch, tx) {
|
||||
return db.tx(t => {
|
||||
const q1 = t.none(`UPDATE transaction_batches SET status='sent', error_message=NULL WHERE id=$1`, [batch.id])
|
||||
const q2 = t.none(`UPDATE cash_in_txs SET tx_hash=$1, fee=$2, send=true, send_confirmed=true, send_time=now(), send_pending=false, error=NULL, error_code=NULL WHERE batch_id=$3`, [tx.txid, tx.fee.toString(), batch.id])
|
||||
|
||||
return db.none(sql, [batch.id])
|
||||
return t.batch([q1, q2])
|
||||
})
|
||||
}
|
||||
|
||||
function setErroredBatch (batch, errorMsg) {
|
||||
|
|
@ -57,7 +61,7 @@ function submitBatch (settings, batch) {
|
|||
getBatchTransactions(batch)
|
||||
.then(txs => {
|
||||
wallet.sendCoinsBatch(settings, txs, batch.crypto_code)
|
||||
.then(() => confirmSentBatch(batch))
|
||||
.then(res => confirmSentBatch(batch, res))
|
||||
.catch(err => setErroredBatch(batch, err.message))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue