aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-09-27 07:52:08 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-09-27 07:54:04 +0800
commit9fd545811226c16e11e4f2dc100a348e07f094bf (patch)
tree6953acde88e0c7ba8f39382c7a9947a0393ffe81 /app/scripts/lib
parent8ab23c713db1f5d45abb0ba433450591b8759809 (diff)
downloadtangerine-wallet-browser-9fd545811226c16e11e4f2dc100a348e07f094bf.tar
tangerine-wallet-browser-9fd545811226c16e11e4f2dc100a348e07f094bf.tar.gz
tangerine-wallet-browser-9fd545811226c16e11e4f2dc100a348e07f094bf.tar.bz2
tangerine-wallet-browser-9fd545811226c16e11e4f2dc100a348e07f094bf.tar.lz
tangerine-wallet-browser-9fd545811226c16e11e4f2dc100a348e07f094bf.tar.xz
tangerine-wallet-browser-9fd545811226c16e11e4f2dc100a348e07f094bf.tar.zst
tangerine-wallet-browser-9fd545811226c16e11e4f2dc100a348e07f094bf.zip
transactions: lint fixes and reveal status-update event for balance controller
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/tx-state-manager.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js
index d7b76fe22..abb9d7910 100644
--- a/app/scripts/lib/tx-state-manager.js
+++ b/app/scripts/lib/tx-state-manager.js
@@ -5,7 +5,7 @@ const ethUtil = require('ethereumjs-util')
const txStateHistoryHelper = require('./tx-state-history-helper')
module.exports = class TransactionStateManger extends EventEmitter {
- constructor ({initState, txHistoryLimit, getNetwork}) {
+ constructor ({ initState, txHistoryLimit, getNetwork }) {
super()
this.store = new ObservableStore(
@@ -15,7 +15,8 @@ module.exports = class TransactionStateManger extends EventEmitter {
this.txHistoryLimit = txHistoryLimit
this.getNetwork = getNetwork
}
- // Returns the number of txs for the current network.
+
+ // Returns the number of txs for the current network.
getTxCount () {
return this.getTxList().length
}
@@ -31,7 +32,6 @@ module.exports = class TransactionStateManger extends EventEmitter {
}
// Returns the tx list
-
getUnapprovedTxList () {
const txList = this.getTxsByMetaData('status', 'unapproved')
return txList.reduce((result, tx) => {
@@ -69,7 +69,7 @@ module.exports = class TransactionStateManger extends EventEmitter {
// or rejected tx's.
// not tx's that are pending or unapproved
if (txCount > txHistoryLimit - 1) {
- const index = transactions.findIndex((metaTx) => ((metaTx.status === 'confirmed' || metaTx.status === 'rejected')))
+ const index = transactions.findIndex((metaTx) => metaTx.status === 'confirmed' || metaTx.status === 'rejected')
transactions.splice(index, 1)
}
transactions.push(txMeta)
@@ -229,12 +229,12 @@ module.exports = class TransactionStateManger extends EventEmitter {
const txMeta = this.getTx(txId)
txMeta.status = status
this.emit(`${txMeta.id}:${status}`, txId)
- this.emit(`${status}`, txId)
+ this.emit(`tx:status-update`, txId, status)
if (status === 'submitted' || status === 'rejected') {
this.emit(`${txMeta.id}:finished`, txMeta)
}
this.updateTx(txMeta)
- this.emit('updateBadge')
+ this.emit('update:badge')
}
// Saves the new/updated txList.