diff options
author | Frances Pangilinan <frankie.diamond@gmail.com> | 2016-12-15 04:55:41 +0800 |
---|---|---|
committer | Frances Pangilinan <frankie.diamond@gmail.com> | 2016-12-15 04:55:41 +0800 |
commit | 090935f90aa3c2589fee7bc038c8f4fcf77da03c (patch) | |
tree | 82a21bd7d0df26d6de637892cbd9322d52b7785b /app/scripts/lib/idStore.js | |
parent | 9e3fa3cfba20299413df87d18158180c7798d2ac (diff) | |
download | tangerine-wallet-browser-090935f90aa3c2589fee7bc038c8f4fcf77da03c.tar tangerine-wallet-browser-090935f90aa3c2589fee7bc038c8f4fcf77da03c.tar.gz tangerine-wallet-browser-090935f90aa3c2589fee7bc038c8f4fcf77da03c.tar.bz2 tangerine-wallet-browser-090935f90aa3c2589fee7bc038c8f4fcf77da03c.tar.lz tangerine-wallet-browser-090935f90aa3c2589fee7bc038c8f4fcf77da03c.tar.xz tangerine-wallet-browser-090935f90aa3c2589fee7bc038c8f4fcf77da03c.tar.zst tangerine-wallet-browser-090935f90aa3c2589fee7bc038c8f4fcf77da03c.zip |
Create a TxManager
Diffstat (limited to 'app/scripts/lib/idStore.js')
-rw-r--r-- | app/scripts/lib/idStore.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index d36504f13..71bee8026 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -13,6 +13,8 @@ const autoFaucet = require('./auto-faucet') const messageManager = require('./message-manager') const DEFAULT_RPC = 'https://testrpc.metamask.io/' const IdManagement = require('./id-management') +const TxManager = require('../transaction-manager') + module.exports = IdentityStore @@ -36,6 +38,11 @@ function IdentityStore (opts = {}) { } // not part of serilized metamask state - only kept in memory + this.txManager = new TxManager({ + TxListFromStore: opts.configManager.getTxList(), + setTxList: opts.configManager.setTxList.bind(opts.configManager), + txLimit: 40, + }) this._unconfTxCbs = {} this._unconfMsgCbs = {} } @@ -87,6 +94,7 @@ IdentityStore.prototype.recoverFromSeed = function (password, seed, cb) { IdentityStore.prototype.setStore = function (store) { this._ethStore = store + this.txManager.setProvider(this._ethStore._query.currentProvider) } IdentityStore.prototype.clearSeedWordCache = function (cb) { @@ -97,14 +105,15 @@ IdentityStore.prototype.clearSeedWordCache = function (cb) { IdentityStore.prototype.getState = function () { const configManager = this.configManager + const TxManager = this.txManager var seedWords = this.getSeedIfUnlocked() return clone(extend(this._currentState, { isInitialized: !!configManager.getWallet() && !seedWords, isUnlocked: this._isUnlocked(), seedWords: seedWords, isDisclaimerConfirmed: configManager.getConfirmedDisclaimer(), - unconfTxs: configManager.unconfirmedTxs(), - transactions: configManager.getTxList(), + unconfTxs: TxManager.getUnapprovedTxList(), + transactions: TxManager.getTxList(), unconfMsgs: messageManager.unconfirmedMsgs(), messages: messageManager.getMsgList(), selectedAddress: configManager.getSelectedAccount(), |