1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

metamask - adopt isInitialized from keyring controller

This commit is contained in:
kumavis 2017-02-01 00:31:26 -08:00
parent cd5d952600
commit 1cb730144d
3 changed files with 8 additions and 13 deletions

View File

@ -78,13 +78,10 @@ class KeyringController extends EventEmitter {
// in this class, but will need to be Promisified when we move our // in this class, but will need to be Promisified when we move our
// persistence to an async model. // persistence to an async model.
getState () { getState () {
const state = this.store.getState()
// old wallet // old wallet
const wallet = this.configManager.getWallet()
const memState = this.memStore.getState() const memState = this.memStore.getState()
const result = { const result = {
// computed // computed
isInitialized: (!!wallet || !!state.vault),
isUnlocked: (!!this.password), isUnlocked: (!!this.password),
// memStore // memStore
keyringTypes: memState.keyringTypes, keyringTypes: memState.keyringTypes,

View File

@ -169,14 +169,21 @@ module.exports = class MetamaskController extends EventEmitter {
// //
getState () { getState () {
const wallet = this.configManager.getWallet()
const vault = this.keyringController.store.getState().vault
const isInitialized = (!!wallet || !!vault)
return extend( return extend(
{
isInitialized,
},
this.state, this.state,
this.ethStore.getState(), this.ethStore.getState(),
this.configManager.getConfig(),
this.txManager.getState(), this.txManager.getState(),
this.keyringController.getState(), this.keyringController.getState(),
this.preferencesController.store.getState(), this.preferencesController.store.getState(),
this.noticeController.getState(), this.noticeController.getState(),
// config manager
this.configManager.getConfig(),
{ {
shapeShiftTxList: this.configManager.getShapeShiftTxList(), shapeShiftTxList: this.configManager.getShapeShiftTxList(),
lostAccounts: this.configManager.getLostAccounts(), lostAccounts: this.configManager.getLostAccounts(),

View File

@ -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()
})
})
}) })