diff options
author | frankiebee <frankie.diamond@gmail.com> | 2017-09-13 00:59:59 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2017-09-13 00:59:59 +0800 |
commit | 3ad67d1b14b5b56002cf34ab6dbb18d602705827 (patch) | |
tree | 14226bfb3d9705b9a79c428dbaa251c9a3cfc313 /app/scripts/controllers | |
parent | 62f26c5ba873280b536aa7ce31cf92733a3e707c (diff) | |
download | tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.gz tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.bz2 tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.lz tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.xz tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.tar.zst tangerine-wallet-browser-3ad67d1b14b5b56002cf34ab6dbb18d602705827.zip |
match other controller patterns
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r-- | app/scripts/controllers/transactions.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 636424c64..3cb6a609e 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -40,9 +40,7 @@ module.exports = class TransactionController extends EventEmitter { this.txGasUtil = new TxGasUtil(this.provider) this.txStateManager = new TransactionStateManger({ - initState: extend({ - transactions: [], - }, opts.initState), + initState: opts.initState, txHistoryLimit: opts.txHistoryLimit, getNetwork: this.getNetwork.bind(this), }) @@ -70,15 +68,12 @@ module.exports = class TransactionController extends EventEmitter { publishTransaction: this.query.sendRawTransaction, getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager), giveUpOnTransaction: (txId) => { - const msg = `Gave up submitting after 3500 blocks un-mined.` - this.setTxStatusFailed(txId, msg) + const err = new Error(`Gave up submitting after 3500 blocks un-mined.`) + this.setTxStatusFailed(txId, err) }, }) - this.txStateManager.subscribe(() => { - this.emit('update') - this.emit('updateBadge') - }) + this.txStateManager.store.subscribe(() => this.emit('updateBadge')) this.pendingTxTracker.on('txWarning', this.txStateManager.updateTx.bind(this.txStateManager)) this.pendingTxTracker.on('txFailed', this.txStateManager.setTxStatusFailed.bind(this.txStateManager)) @@ -94,7 +89,7 @@ module.exports = class TransactionController extends EventEmitter { this.blockTracker.on('sync', this.pendingTxTracker.queryPendingTxs.bind(this.pendingTxTracker)) // memstore is computed from a few different stores this._updateMemstore() - this.txStateManager.subscribe(() => this._updateMemstore()) + this.txStateManager.store.subscribe(() => this._updateMemstore()) this.networkStore.subscribe(() => this._updateMemstore()) this.preferencesStore.subscribe(() => this._updateMemstore()) } @@ -250,10 +245,9 @@ module.exports = class TransactionController extends EventEmitter { this.txStateManager.updateTx(txMeta) } -/* _____________________________________ -| | -| PRIVATE METHODS | -|______________________________________*/ +// +// PRIVATE METHODS +// _updateMemstore () { const unapprovedTxs = this.txStateManager.getUnapprovedTxList() |