aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-12-23 08:28:14 +0800
committerDan Finlay <dan@danfinlay.com>2016-12-23 09:17:07 +0800
commita10fe6b6f4217b3984f861bb8ad69d075f672872 (patch)
tree91f0b3d1cd2969d5e4ab00e75e889a16bd3225b9 /app/scripts/metamask-controller.js
parent2ab34760b0e2e006c0b87722e8397c642eb86981 (diff)
downloadtangerine-wallet-browser-a10fe6b6f4217b3984f861bb8ad69d075f672872.tar
tangerine-wallet-browser-a10fe6b6f4217b3984f861bb8ad69d075f672872.tar.gz
tangerine-wallet-browser-a10fe6b6f4217b3984f861bb8ad69d075f672872.tar.bz2
tangerine-wallet-browser-a10fe6b6f4217b3984f861bb8ad69d075f672872.tar.lz
tangerine-wallet-browser-a10fe6b6f4217b3984f861bb8ad69d075f672872.tar.xz
tangerine-wallet-browser-a10fe6b6f4217b3984f861bb8ad69d075f672872.tar.zst
tangerine-wallet-browser-a10fe6b6f4217b3984f861bb8ad69d075f672872.zip
Return keyring metadata on metamask state object
Required making the getState methods for both keyringController and metamaskController async. They both now return promises, and the main metamask-controller.getState method is now nodeified. Will allow the UI to render loose keys differently than persisted keys.
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 983a590d7..78e5a6f0a 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -53,15 +53,18 @@ module.exports = class MetamaskController {
}
getState () {
- return extend(
- this.state,
- this.ethStore.getState(),
- this.configManager.getConfig(),
- this.keyringController.getState(),
- this.noticeController.getState(), {
- lostAccounts: this.configManager.getLostAccounts(),
- }
- )
+ return this.keyringController.getState()
+ .then((keyringControllerState) => {
+ return extend(
+ this.state,
+ this.ethStore.getState(),
+ this.configManager.getConfig(),
+ keyringControllerState,
+ this.noticeController.getState(), {
+ lostAccounts: this.configManager.getLostAccounts(),
+ }
+ )
+ })
}
getApi () {
@@ -69,7 +72,7 @@ module.exports = class MetamaskController {
const noticeController = this.noticeController
return {
- getState: (cb) => { cb(null, this.getState()) },
+ getState: nodeify(this.getState.bind(this)),
setRpcTarget: this.setRpcTarget.bind(this),
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),