aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-02-01 16:31:26 +0800
committerkumavis <aaron@kumavis.me>2017-02-01 16:31:26 +0800
commit1cb730144d6b1c05007323bbc31e4375373628fb (patch)
tree6179fd2b6ea1130561fff4b0ffa4bbd71fa0d854
parentcd5d95260026333735f25a179c7018077e0da44e (diff)
downloadtangerine-wallet-browser-1cb730144d6b1c05007323bbc31e4375373628fb.tar
tangerine-wallet-browser-1cb730144d6b1c05007323bbc31e4375373628fb.tar.gz
tangerine-wallet-browser-1cb730144d6b1c05007323bbc31e4375373628fb.tar.bz2
tangerine-wallet-browser-1cb730144d6b1c05007323bbc31e4375373628fb.tar.lz
tangerine-wallet-browser-1cb730144d6b1c05007323bbc31e4375373628fb.tar.xz
tangerine-wallet-browser-1cb730144d6b1c05007323bbc31e4375373628fb.tar.zst
tangerine-wallet-browser-1cb730144d6b1c05007323bbc31e4375373628fb.zip
metamask - adopt isInitialized from keyring controller
-rw-r--r--app/scripts/keyring-controller.js3
-rw-r--r--app/scripts/metamask-controller.js9
-rw-r--r--test/unit/idStore-migration-test.js9
3 files changed, 8 insertions, 13 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index 22ceec889..be54ab00b 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -78,13 +78,10 @@ class KeyringController extends EventEmitter {
// in this class, but will need to be Promisified when we move our
// persistence to an async model.
getState () {
- const state = this.store.getState()
// old wallet
- const wallet = this.configManager.getWallet()
const memState = this.memStore.getState()
const result = {
// computed
- isInitialized: (!!wallet || !!state.vault),
isUnlocked: (!!this.password),
// memStore
keyringTypes: memState.keyringTypes,
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 23ced75f1..222a1d618 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -169,14 +169,21 @@ module.exports = class MetamaskController extends EventEmitter {
//
getState () {
+ const wallet = this.configManager.getWallet()
+ const vault = this.keyringController.store.getState().vault
+ const isInitialized = (!!wallet || !!vault)
return extend(
+ {
+ isInitialized,
+ },
this.state,
this.ethStore.getState(),
- this.configManager.getConfig(),
this.txManager.getState(),
this.keyringController.getState(),
this.preferencesController.store.getState(),
this.noticeController.getState(),
+ // config manager
+ this.configManager.getConfig(),
{
shapeShiftTxList: this.configManager.getShapeShiftTxList(),
lostAccounts: this.configManager.getLostAccounts(),
diff --git a/test/unit/idStore-migration-test.js b/test/unit/idStore-migration-test.js
index 1537e88ec..81a99ef63 100644
--- a/test/unit/idStore-migration-test.js
+++ b/test/unit/idStore-migration-test.js
@@ -80,13 +80,4 @@ describe('IdentityStore to KeyringController migration', function() {
})
})
- describe('entering a password', function() {
- it('should identify an old wallet as an initialized keyring', function(done) {
- keyringController.configManager.setWallet('something')
- const state = keyringController.getState()
- assert(state.isInitialized, 'old vault counted as initialized.')
- assert(!state.lostAccounts, 'no lost accounts')
- done()
- })
- })
})