diff options
author | kumavis <aaron@kumavis.me> | 2017-10-11 01:26:59 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2017-10-11 01:26:59 +0800 |
commit | e79037261ec4b232299dbef14e6c30fc46c48ac7 (patch) | |
tree | 07fe0f1761dfae2925671e34ff6f5cc67a99cdf0 /app | |
parent | f18615a82abafee1a648e8de6f60ecc54e1aabb4 (diff) | |
download | tangerine-wallet-browser-e79037261ec4b232299dbef14e6c30fc46c48ac7.tar.gz tangerine-wallet-browser-e79037261ec4b232299dbef14e6c30fc46c48ac7.tar.zst tangerine-wallet-browser-e79037261ec4b232299dbef14e6c30fc46c48ac7.zip |
metamask controller - breakout getAccounts method
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/metamask-controller.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 727f48f1c..840012e81 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -225,19 +225,9 @@ module.exports = class MetamaskController extends EventEmitter { web3_clientVersion: `MetaMask/v${version}`, }, // account mgmt - getAccounts: (cb) => { - const isUnlocked = this.keyringController.memStore.getState().isUnlocked - const result = [] - const selectedAddress = this.preferencesController.getSelectedAddress() - - // only show address if account is unlocked - if (isUnlocked && selectedAddress) { - result.push(selectedAddress) - } - cb(null, result) - }, + getAccounts: nodeify(this.getAccounts, this), // tx signing - processTransaction: nodeify(async (txParams) => await this.txController.newUnapprovedTransaction(txParams), this), + processTransaction: nodeify(this.txController.newUnapprovedTransaction, this.txController), // old style msg signing processMessage: this.newUnsignedMessage.bind(this), // personal_sign msg signing @@ -483,6 +473,18 @@ module.exports = class MetamaskController extends EventEmitter { // Opinionated Keyring Management // + async getAccounts () { + const isUnlocked = this.keyringController.memStore.getState().isUnlocked + const result = [] + const selectedAddress = this.preferencesController.getSelectedAddress() + + // only show address if account is unlocked + if (isUnlocked && selectedAddress) { + result.push(selectedAddress) + } + return result + }, + addNewAccount (cb) { const primaryKeyring = this.keyringController.getKeyringsByType('HD Key Tree')[0] if (!primaryKeyring) return cb(new Error('MetamaskController - No HD Key Tree found')) |