aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-30 08:10:34 +0800
committerkumavis <aaron@kumavis.me>2017-09-30 08:10:34 +0800
commit1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8 (patch)
treec2b393aa23d946f7a3a9fddf7905c38fd63ad88e /app
parenta2b6d3ffc56a3f7fdab6b5ef42426f0a65fda7c7 (diff)
downloadtangerine-wallet-browser-1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8.tar
tangerine-wallet-browser-1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8.tar.gz
tangerine-wallet-browser-1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8.tar.bz2
tangerine-wallet-browser-1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8.tar.lz
tangerine-wallet-browser-1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8.tar.xz
tangerine-wallet-browser-1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8.tar.zst
tangerine-wallet-browser-1ad8a9a0ffb84d11baeb2ae143986d3fb10b89c8.zip
network - make network controller internal network switching explicit
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/network.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/scripts/controllers/network.js b/app/scripts/controllers/network.js
index 9079e0653..0f9db4d53 100644
--- a/app/scripts/controllers/network.js
+++ b/app/scripts/controllers/network.js
@@ -10,7 +10,7 @@ const RPC_ADDRESS_LIST = require('../config.js').network
const DEFAULT_RPC = RPC_ADDRESS_LIST['rinkeby']
module.exports = class NetworkController extends EventEmitter {
-
+
constructor (config) {
super()
config.provider.rpcTarget = this.getRpcAddressForType(config.provider.type, config.provider)
@@ -20,7 +20,6 @@ module.exports = class NetworkController extends EventEmitter {
this._proxy = createEventEmitterProxy()
this.on('networkDidChange', this.lookupNetwork)
- this.providerStore.subscribe((state) => this._switchNetwork({ rpcUrl: state.rpcTarget }))
}
initializeProvider (_providerParams) {
@@ -64,6 +63,7 @@ module.exports = class NetworkController extends EventEmitter {
type: 'rpc',
rpcTarget: rpcUrl,
})
+ this._switchNetwork({ rpcUrl })
}
getCurrentRpcAddress () {
@@ -79,6 +79,7 @@ module.exports = class NetworkController extends EventEmitter {
const rpcTarget = this.getRpcAddressForType(type)
assert(rpcTarget, `NetworkController - unknown rpc address for type "${type}"`)
this.providerStore.updateState({ type, rpcTarget })
+ this._switchNetwork({ rpcUrl: rpcTarget })
}
getProviderConfig () {