diff options
metamask - adopt isInitialized from keyring controller
-rw-r--r-- | app/scripts/keyring-controller.js | 3 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 9 | ||||
-rw-r--r-- | test/unit/idStore-migration-test.js | 9 |
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() - }) - }) }) |