mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #1068 from MetaMask/kumavis-refactor3
public config - get selectedAccount from keyring controller substate
This commit is contained in:
commit
b6909574a7
@ -244,6 +244,15 @@ class KeyringController extends EventEmitter {
|
||||
return this.fullUpdate()
|
||||
}
|
||||
|
||||
// Get Selected Account
|
||||
//
|
||||
// returns String
|
||||
//
|
||||
// Gets the state's `selectedAccount` value
|
||||
getSelectedAccount () {
|
||||
return this.store.getState().selectedAccount
|
||||
}
|
||||
|
||||
// Save Account Label
|
||||
// @string account
|
||||
// @string label
|
||||
|
@ -65,7 +65,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
txList: this.configManager.getTxList(),
|
||||
txHistoryLimit: 40,
|
||||
setTxList: this.configManager.setTxList.bind(this.configManager),
|
||||
getSelectedAccount: this.configManager.getSelectedAccount.bind(this.configManager),
|
||||
getSelectedAccount: this.keyringController.getSelectedAccount.bind(this.keyringController),
|
||||
getGasMultiplier: this.configManager.getGasMultiplier.bind(this.configManager),
|
||||
getNetwork: this.getStateNetwork.bind(this),
|
||||
signTransaction: this.keyringController.signTransaction.bind(this.keyringController),
|
||||
@ -116,7 +116,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
rpcUrl: this.configManager.getCurrentRpcAddress(),
|
||||
// account mgmt
|
||||
getAccounts: (cb) => {
|
||||
let selectedAccount = this.configManager.getSelectedAccount()
|
||||
let selectedAccount = this.keyringController.getSelectedAccount()
|
||||
let result = selectedAccount ? [selectedAccount] : []
|
||||
cb(null, result)
|
||||
},
|
||||
@ -146,7 +146,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
function selectPublicState(state) {
|
||||
const result = { selectedAccount: undefined }
|
||||
try {
|
||||
result.selectedAccount = state.config.selectedAccount
|
||||
result.selectedAccount = state.KeyringController.selectedAccount
|
||||
} catch (_) {}
|
||||
return result
|
||||
}
|
||||
@ -330,7 +330,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
// ensuring they are only ever available in the background process.
|
||||
clearSeedWordCache (cb) {
|
||||
this.configManager.setSeedWords(null)
|
||||
cb(null, this.configManager.getSelectedAccount())
|
||||
cb(null, this.keyringController.getSelectedAccount())
|
||||
}
|
||||
|
||||
importAccountWithStrategy (strategy, args, cb) {
|
||||
|
Loading…
Reference in New Issue
Block a user