aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-02-02 05:05:58 +0800
committerGitHub <noreply@github.com>2017-02-02 05:05:58 +0800
commit54b1339f6a2a8a66a01ac224c6dbb569911cfc9a (patch)
tree675d11564292df8871ceea4b3e4a883b0ed2da57 /app/scripts/metamask-controller.js
parentce0c3ed03c20eb0b7438cb9add7cbce490d7de64 (diff)
parent25c5a4462369f5209924a99cbe0395da13a6a0a7 (diff)
downloadtangerine-wallet-browser-54b1339f6a2a8a66a01ac224c6dbb569911cfc9a.tar.gz
tangerine-wallet-browser-54b1339f6a2a8a66a01ac224c6dbb569911cfc9a.tar.zst
tangerine-wallet-browser-54b1339f6a2a8a66a01ac224c6dbb569911cfc9a.zip
Merge branch 'dev' into messageManagerCleanUp
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js51
1 files changed, 28 insertions, 23 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 84ac2130e..fb5234c24 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -166,23 +166,31 @@ module.exports = class MetamaskController extends EventEmitter {
//
getState () {
- return this.keyringController.getState()
- .then((keyringControllerState) => {
- return extend(
- this.state,
- this.ethStore.getState(),
- this.configManager.getConfig(),
- this.txManager.getState(),
- this.messageManager.getState(),
- keyringControllerState,
- this.preferencesController.store.getState(),
- this.noticeController.getState(),
- {
- shapeShiftTxList: this.configManager.getShapeShiftTxList(),
- lostAccounts: this.configManager.getLostAccounts(),
- }
- )
- })
+
+ const wallet = this.configManager.getWallet()
+ const vault = this.keyringController.store.getState().vault
+ const isInitialized = (!!wallet || !!vault)
+ return extend(
+ {
+ isInitialized,
+ },
+ this.state,
+ this.ethStore.getState(),
+ this.txManager.getState(),
+ this.messageManager.getState(),
+ this.keyringController.getState(),
+ this.preferencesController.store.getState(),
+ this.noticeController.getState(),
+ // config manager
+ this.configManager.getConfig(),
+ {
+ shapeShiftTxList: this.configManager.getShapeShiftTxList(),
+ lostAccounts: this.configManager.getLostAccounts(),
+ currentFiat: this.configManager.getCurrentFiat(),
+ conversionRate: this.configManager.getConversionRate(),
+ conversionDate: this.configManager.getConversionDate(),
+ }
+ )
}
//
@@ -198,7 +206,7 @@ module.exports = class MetamaskController extends EventEmitter {
return {
// etc
- getState: nodeify(this.getState.bind(this)),
+ getState: (cb) => cb(null, this.getState()),
setRpcTarget: this.setRpcTarget.bind(this),
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),
@@ -294,11 +302,8 @@ module.exports = class MetamaskController extends EventEmitter {
)
}
- sendUpdate () {
- this.getState()
- .then((state) => {
- this.emit('update', state)
- })
+ sendUpdate () {
+ this.emit('update', this.getState())
}
//