aboutsummaryrefslogtreecommitdiffstats
path: root/ui/lib/tx-helper.js
blob: 7f64f9fbec33477d20ea7a678e70e21bf9db8a91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
const valuesFor = require('../app/util').valuesFor

module.exports = function (unapprovedTxs, unapprovedMsgs, network) {
  log.debug('tx-helper called with params:')
  log.debug({ unapprovedTxs, unapprovedMsgs, network })

  var txValues = network ? valuesFor(unapprovedTxs).filter(tx => tx.txParams.metamaskNetworkId === network) : valuesFor(unapprovedTxs)
  log.debug(`tx helper found ${txValues.length} unapproved txs`)
  var msgValues = valuesFor(unapprovedMsgs)
  log.debug(`tx helper found ${msgValues.length} unsigned messages`)
  var allValues = txValues.concat(msgValues)
  return allValues.sort(tx => tx.time)
}