aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/scripts/background.js8
-rw-r--r--app/scripts/lib/config-manager.js1
-rw-r--r--app/scripts/lib/idStore.js7
-rw-r--r--app/scripts/metamask-controller.js23
4 files changed, 21 insertions, 18 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index d23951015..09cdffecd 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -1,4 +1,5 @@
const urlUtil = require('url')
+const extend = require('xtend')
const Dnode = require('dnode')
const eos = require('end-of-stream')
const PortStream = require('./lib/port-stream.js')
@@ -22,7 +23,7 @@ const controller = new MetamaskController({
})
const idStore = controller.idStore
-function unlockAccountMessage() {
+function unlockAccountMessage () {
createUnlockRequestNotification({
title: 'Account Unlock Request',
})
@@ -37,7 +38,7 @@ function showUnconfirmedMessage (msgParams, msgId) {
})
}
-function showUnconfirmedTx(txParams, txData, onTxDoneCb) {
+function showUnconfirmedTx (txParams, txData, onTxDoneCb) {
createTxNotification({
title: 'New Unsigned Transaction',
txParams: txParams,
@@ -89,7 +90,7 @@ function setupControllerConnection (stream) {
var api = controller.getApi()
var dnode = Dnode(api)
stream.pipe(dnode).pipe(stream)
- dnode.on('remote', function() {
+ dnode.on('remote', () => {
// push updates to popup
controller.ethStore.on('update', controller.sendUpdate)
idStore.on('update', controller.sendUpdate)
@@ -99,7 +100,6 @@ function setupControllerConnection (stream) {
controller.ethStore.removeListener('update', controller.sendUpdate)
})
})
-
}
//
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js
index 9793728bb..0af82c89c 100644
--- a/app/scripts/lib/config-manager.js
+++ b/app/scripts/lib/config-manager.js
@@ -1,5 +1,4 @@
const Migrator = require('pojo-migrator')
-const extend = require('xtend')
const MetamaskConfig = require('../config.js')
const migrations = require('./migrations')
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js
index 568d9f9a5..f705c07a7 100644
--- a/app/scripts/lib/idStore.js
+++ b/app/scripts/lib/idStore.js
@@ -43,7 +43,10 @@ function IdentityStore (opts = {}) {
IdentityStore.prototype.createNewVault = function (password, entropy, cb) {
delete this._keyStore
- this.configManager.clearWallet()
+ if (this.configManager) {
+ this.configManager.clearWallet()
+ }
+
this._createIdmgmt(password, null, entropy, (err) => {
if (err) return cb(err)
@@ -439,7 +442,7 @@ IdentityStore.prototype._createIdmgmt = function (password, seed, entropy, cb) {
keyStore: keyStore,
derivedKey: derivedKey,
hdPathSTring: this.hdPathString,
- this.configManager,
+ configManager: this.configManager,
})
cb()
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index aef280310..262c20b96 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -13,11 +13,13 @@ class MetamaskController {
constructor (opts) {
this.configManager = new ConfigManager(opts)
- this.idStore = new IdentityStore({ configManager })
- this.messageManager = messageManager
this.provider = this.initializeProvider(opts)
this.ethStore = new EthStore(this.provider)
- this.idStore.setStore(this.ethStore)
+ this.idStore = new IdentityStore({
+ configManager: this.configManager,
+ ethStore: this.ethStore,
+ })
+ this.messageManager = messageManager
this.publicConfigStore = this.initPublicConfigStore()
}
@@ -203,7 +205,7 @@ class MetamaskController {
}
setupPublicConfig (stream) {
- var storeStream = publicConfigStore.createStream()
+ var storeStream = this.publicConfigStore.createStream()
stream.pipe(storeStream).pipe(stream)
}
@@ -223,7 +225,7 @@ class MetamaskController {
// config
//
- function agreeToDisclaimer (cb) {
+ agreeToDisclaimer (cb) {
try {
this.configManager.setConfirmed(true)
cb()
@@ -233,23 +235,22 @@ class MetamaskController {
}
// called from popup
- function setRpcTarget (rpcTarget) {
+ setRpcTarget (rpcTarget) {
this.configManager.setRpcTarget(rpcTarget)
chrome.runtime.reload()
- idStore.getNetwork()
+ this.idStore.getNetwork()
}
- function setProviderType (type) {
+ setProviderType (type) {
this.configManager.setProviderType(type)
chrome.runtime.reload()
- idStore.getNetwork()
+ this.idStore.getNetwork()
}
- function useEtherscanProvider () {
+ useEtherscanProvider () {
this.configManager.useEtherscanProvider()
chrome.runtime.reload()
}
-
}
function noop () {}