mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #990 from MetaMask/sync-accounts
rpc - fix sync account cache setting
This commit is contained in:
commit
479da07897
@ -228,37 +228,21 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
|
||||
initPublicConfigStore () {
|
||||
// get init state
|
||||
var initPublicState = extend(
|
||||
keyringControllerToPublic(this.keyringController.getState()),
|
||||
configToPublic(this.configManager.getConfig())
|
||||
)
|
||||
|
||||
var initPublicState = configToPublic(this.configManager.getConfig())
|
||||
var publicConfigStore = new HostStore(initPublicState)
|
||||
|
||||
// subscribe to changes
|
||||
this.configManager.subscribe(function (state) {
|
||||
storeSetFromObj(publicConfigStore, configToPublic(state))
|
||||
})
|
||||
this.keyringController.on('update', () => {
|
||||
const state = this.keyringController.getState()
|
||||
storeSetFromObj(publicConfigStore, keyringControllerToPublic(state))
|
||||
this.sendUpdate()
|
||||
})
|
||||
|
||||
this.keyringController.on('newAccount', (account) => {
|
||||
autoFaucet(account)
|
||||
})
|
||||
|
||||
// keyringController substate
|
||||
function keyringControllerToPublic (state) {
|
||||
return {
|
||||
selectedAccount: state.selectedAccount,
|
||||
}
|
||||
}
|
||||
// config substate
|
||||
function configToPublic (state) {
|
||||
return {
|
||||
provider: state.provider,
|
||||
selectedAccount: state.selectedAccount,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user