aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-02-03 13:09:17 +0800
committerkumavis <aaron@kumavis.me>2017-02-03 13:09:17 +0800
commitf08f40aee2614c9e72efce5d2d10f6e4b84d7a10 (patch)
treef05cf72abb63e1ca9db0ac35c8b52a7b0237b929
parent0c6df24ecff566c84810a1b29316c1efa2c83870 (diff)
downloadtangerine-wallet-browser-f08f40aee2614c9e72efce5d2d10f6e4b84d7a10.tar
tangerine-wallet-browser-f08f40aee2614c9e72efce5d2d10f6e4b84d7a10.tar.gz
tangerine-wallet-browser-f08f40aee2614c9e72efce5d2d10f6e4b84d7a10.tar.bz2
tangerine-wallet-browser-f08f40aee2614c9e72efce5d2d10f6e4b84d7a10.tar.lz
tangerine-wallet-browser-f08f40aee2614c9e72efce5d2d10f6e4b84d7a10.tar.xz
tangerine-wallet-browser-f08f40aee2614c9e72efce5d2d10f6e4b84d7a10.tar.zst
tangerine-wallet-browser-f08f40aee2614c9e72efce5d2d10f6e4b84d7a10.zip
txManager - depend on preferencesStore
-rw-r--r--app/scripts/metamask-controller.js2
-rw-r--r--app/scripts/transaction-manager.js10
-rw-r--r--test/unit/tx-manager-test.js1
3 files changed, 8 insertions, 5 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index cc30a97e6..de6e08e0b 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -72,8 +72,8 @@ module.exports = class MetamaskController extends EventEmitter {
this.txManager = new TxManager({
initState: initState.TransactionManager,
networkStore: this.networkStore,
+ preferencesStore: this.preferencesController.store,
txHistoryLimit: 40,
- getSelectedAddress: this.preferencesController.getSelectedAddress.bind(this.preferencesController),
getNetwork: this.getNetworkState.bind(this),
signTransaction: this.keyringController.signTransaction.bind(this.keyringController),
provider: this.provider,
diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js
index 8d4cf6df3..6299091f2 100644
--- a/app/scripts/transaction-manager.js
+++ b/app/scripts/transaction-manager.js
@@ -17,9 +17,8 @@ module.exports = class TransactionManager extends EventEmitter {
}, opts.initState))
this.memStore = new ObservableStore({})
this.networkStore = opts.networkStore || new ObservableStore({})
-
+ this.preferencesStore = opts.preferencesStore || new ObservableStore({})
this.txHistoryLimit = opts.txHistoryLimit
- this.getSelectedAddress = opts.getSelectedAddress
this.provider = opts.provider
this.blockTracker = opts.blockTracker
this.txProviderUtils = new TxProviderUtil(this.provider)
@@ -27,10 +26,11 @@ module.exports = class TransactionManager extends EventEmitter {
this.signEthTx = opts.signTransaction
this.nonceLock = Semaphore(1)
- // memstore is computed from diskStore
+ // memstore is computed from a few different stores
this._updateMemstore()
this.store.subscribe(() => this._updateMemstore() )
this.networkStore.subscribe(() => this._updateMemstore() )
+ this.preferencesStore.subscribe(() => this._updateMemstore() )
}
getState () {
@@ -41,6 +41,10 @@ module.exports = class TransactionManager extends EventEmitter {
return this.networkStore.getState().network
}
+ getSelectedAddress () {
+ return this.preferencesStore.getState().selectedAddress
+ }
+
// Returns the tx list
getTxList () {
let network = this.getNetwork()
diff --git a/test/unit/tx-manager-test.js b/test/unit/tx-manager-test.js
index 3b64f340b..f64f048e3 100644
--- a/test/unit/tx-manager-test.js
+++ b/test/unit/tx-manager-test.js
@@ -14,7 +14,6 @@ describe('Transaction Manager', function() {
networkStore: new ObservableStore({ network: 'unit test' }),
txHistoryLimit: 10,
blockTracker: new EventEmitter(),
- getSelectedAddress: function(){ return '0xabcd' },
})
})