2016-05-03 23:32:22 +02:00
|
|
|
const valuesFor = require('../app/util').valuesFor
|
|
|
|
|
2017-01-28 01:11:59 +01:00
|
|
|
module.exports = function (unapprovedTxs, unapprovedMsgs, network) {
|
2017-02-21 08:33:21 +01:00
|
|
|
log.debug('tx-helper called with params:')
|
|
|
|
log.debug({ unapprovedTxs, unapprovedMsgs, network })
|
|
|
|
|
2017-01-28 01:11:59 +01:00
|
|
|
var txValues = network ? valuesFor(unapprovedTxs).filter(tx => tx.txParams.metamaskNetworkId === network) : valuesFor(unapprovedTxs)
|
2017-02-21 08:33:21 +01:00
|
|
|
log.debug(`tx helper found ${txValues.length} unapproved txs`)
|
2017-01-28 01:11:59 +01:00
|
|
|
var msgValues = valuesFor(unapprovedMsgs)
|
2017-02-21 08:33:21 +01:00
|
|
|
log.debug(`tx helper found ${msgValues.length} unsigned messages`)
|
2016-05-03 23:32:22 +02:00
|
|
|
var allValues = txValues.concat(msgValues)
|
|
|
|
return allValues.sort(tx => tx.time)
|
|
|
|
}
|