aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-06-25 07:46:18 +0800
committerDan Finlay <dan@danfinlay.com>2016-06-25 07:46:18 +0800
commitd3e0e7fe45a1dc2159b26155b974ced16548ea44 (patch)
tree7eacaee6ef26915ea6c00a12f784014a10749059 /app/scripts/metamask-controller.js
parent122018a96a1b2b6d9b7eefe150ff76a9de69bdd7 (diff)
downloadtangerine-wallet-browser-d3e0e7fe45a1dc2159b26155b974ced16548ea44.tar
tangerine-wallet-browser-d3e0e7fe45a1dc2159b26155b974ced16548ea44.tar.gz
tangerine-wallet-browser-d3e0e7fe45a1dc2159b26155b974ced16548ea44.tar.bz2
tangerine-wallet-browser-d3e0e7fe45a1dc2159b26155b974ced16548ea44.tar.lz
tangerine-wallet-browser-d3e0e7fe45a1dc2159b26155b974ced16548ea44.tar.xz
tangerine-wallet-browser-d3e0e7fe45a1dc2159b26155b974ced16548ea44.tar.zst
tangerine-wallet-browser-d3e0e7fe45a1dc2159b26155b974ced16548ea44.zip
Manually debugged refactor
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 262c20b96..d09b4c5f9 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -7,18 +7,16 @@ const HostStore = require('./lib/remote-store.js').HostStore
const Web3 = require('web3')
const ConfigManager = require('./lib/config-manager')
-module.exports = MetamaskController
-
-class MetamaskController {
+module.exports = class MetamaskController {
constructor (opts) {
this.configManager = new ConfigManager(opts)
- this.provider = this.initializeProvider(opts)
- this.ethStore = new EthStore(this.provider)
this.idStore = new IdentityStore({
configManager: this.configManager,
- ethStore: this.ethStore,
})
+ this.provider = this.initializeProvider(opts)
+ this.ethStore = new EthStore(this.provider)
+ this.idStore.setStore(this.ethStore)
this.messageManager = messageManager
this.publicConfigStore = this.initPublicConfigStore()
}
@@ -35,7 +33,7 @@ class MetamaskController {
const idStore = this.idStore
return {
- getState: function (cb) { cb(null, this.getState()) },
+ getState: (cb) => { cb(null, this.getState()) },
setRpcTarget: this.setRpcTarget.bind(this),
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),
@@ -99,7 +97,9 @@ class MetamaskController {
}
sendUpdate () {
- this.remote.sendUpdate(this.getState())
+ if (this.remote) {
+ this.remote.sendUpdate(this.getState())
+ }
}
initializeProvider (opts) {
@@ -126,7 +126,7 @@ class MetamaskController {
idStore.web3 = web3
idStore.getNetwork()
- provider.on('block', this.processBlock)
+ provider.on('block', this.processBlock.bind(this))
provider.on('error', idStore.getNetwork.bind(idStore))
return provider