diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-03-08 08:01:51 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-03-08 08:01:51 +0800 |
commit | e7e024bcdd2c93b34a0baf8bc27e6c571c098476 (patch) | |
tree | 26ab0b013f3c10d0db040aeea3baac798e3bb390 /app | |
parent | 08ca7dac5a15e104084c6da3eb6015136b316809 (diff) | |
download | tangerine-wallet-browser-e7e024bcdd2c93b34a0baf8bc27e6c571c098476.tar tangerine-wallet-browser-e7e024bcdd2c93b34a0baf8bc27e6c571c098476.tar.gz tangerine-wallet-browser-e7e024bcdd2c93b34a0baf8bc27e6c571c098476.tar.bz2 tangerine-wallet-browser-e7e024bcdd2c93b34a0baf8bc27e6c571c098476.tar.lz tangerine-wallet-browser-e7e024bcdd2c93b34a0baf8bc27e6c571c098476.tar.xz tangerine-wallet-browser-e7e024bcdd2c93b34a0baf8bc27e6c571c098476.tar.zst tangerine-wallet-browser-e7e024bcdd2c93b34a0baf8bc27e6c571c098476.zip |
Refactor of code into separate reducers and actions.
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/controllers/preferences.js | 2 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 8fd5fb8a0..18fccf11b 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -29,7 +29,7 @@ class PreferencesController { return this.addToFrequentRpcList(_url) .then((rpcList) => { this.store.updateState({ frequentRpcList: rpcList }) - return rpcList + return Promise.resolve() }) } diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index f6dbf899d..3b3329b58 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -244,7 +244,8 @@ module.exports = class MetamaskController extends EventEmitter { return { // etc getState: (cb) => cb(null, this.getState()), - setRpcTarget: this.setRpcTarget.bind(this), + setDefaultRpc: this.setDefaultRpc.bind(this), + setCustomRpc: this.setCustomRpc.bind(this), setProviderType: this.setProviderType.bind(this), useEtherscanProvider: this.useEtherscanProvider.bind(this), setCurrentCurrency: this.setCurrentCurrency.bind(this), @@ -265,7 +266,6 @@ module.exports = class MetamaskController extends EventEmitter { // PreferencesController setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController), - updateFrequentRpcList: nodeify(preferencesController.updateFrequentRpcList).bind(preferencesController), // KeyringController setLocked: nodeify(keyringController.setLocked).bind(keyringController), @@ -662,12 +662,21 @@ module.exports = class MetamaskController extends EventEmitter { if (this.isNetworkLoading()) this.lookupNetwork() } - setRpcTarget (rpcTarget) { - this.configManager.setRpcTarget(rpcTarget) + setDefaultRpc () { + this.configManager.setRpcTarget('http://localhost:8545') extension.runtime.reload() this.lookupNetwork() } + setCustomRpc (rpcTarget, rpcList) { + this.configManager.setRpcTarget(rpcTarget) + return this.preferencesController.updateFrequentRpcList(rpcTarget) + .then(() => { + extension.runtime.reload() + this.lookupNetwork() + }) + } + setProviderType (type) { this.configManager.setProviderType(type) extension.runtime.reload() |