diff options
author | Frankie <frankie.diamond@gmail.com> | 2017-01-30 16:46:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 16:46:13 +0800 |
commit | b6909574a7036c396ed85809cbd90aa2171b012f (patch) | |
tree | e701cb7d85f2feddb20e3293c5461a65b09778d3 | |
parent | 47b48c0e02b2b9508813abfda0d89a1bbe677694 (diff) | |
parent | dd528d886f1d2e017cd55ba7e003493f0bc4579c (diff) | |
download | tangerine-wallet-browser-b6909574a7036c396ed85809cbd90aa2171b012f.tar tangerine-wallet-browser-b6909574a7036c396ed85809cbd90aa2171b012f.tar.gz tangerine-wallet-browser-b6909574a7036c396ed85809cbd90aa2171b012f.tar.bz2 tangerine-wallet-browser-b6909574a7036c396ed85809cbd90aa2171b012f.tar.lz tangerine-wallet-browser-b6909574a7036c396ed85809cbd90aa2171b012f.tar.xz tangerine-wallet-browser-b6909574a7036c396ed85809cbd90aa2171b012f.tar.zst tangerine-wallet-browser-b6909574a7036c396ed85809cbd90aa2171b012f.zip |
Merge pull request #1068 from MetaMask/kumavis-refactor3
public config - get selectedAccount from keyring controller substate
-rw-r--r-- | app/scripts/keyring-controller.js | 9 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index 68fc6e882..40cc975f9 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -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 diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index cf58d2477..b9a94b0c9 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -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) { |