aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-03-09 02:16:50 +0800
committerGitHub <noreply@github.com>2017-03-09 02:16:50 +0800
commit67c3126e63aa073d4426b751004c357ee7ed7d60 (patch)
tree815f163d7983225c56a165dd26b7bc33d96bdad1 /app/scripts/metamask-controller.js
parent92b8443824bffca219b146028d5685e6aa1ffabf (diff)
parent26cac57838edc0783e42350d71c45d989329cf2a (diff)
downloadtangerine-wallet-browser-67c3126e63aa073d4426b751004c357ee7ed7d60.tar
tangerine-wallet-browser-67c3126e63aa073d4426b751004c357ee7ed7d60.tar.gz
tangerine-wallet-browser-67c3126e63aa073d4426b751004c357ee7ed7d60.tar.bz2
tangerine-wallet-browser-67c3126e63aa073d4426b751004c357ee7ed7d60.tar.lz
tangerine-wallet-browser-67c3126e63aa073d4426b751004c357ee7ed7d60.tar.xz
tangerine-wallet-browser-67c3126e63aa073d4426b751004c357ee7ed7d60.tar.zst
tangerine-wallet-browser-67c3126e63aa073d4426b751004c357ee7ed7d60.zip
Merge branch 'master' into kumavis-patch-1
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 3dddf7065..536891dc6 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -11,10 +11,10 @@ const streamIntoProvider = require('web3-stream-provider/handler')
const MetaMaskProvider = require('web3-provider-engine/zero.js')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
const KeyringController = require('./keyring-controller')
-const PreferencesController = require('./lib/controllers/preferences')
-const CurrencyController = require('./lib/controllers/currency')
+const PreferencesController = require('./controllers/preferences')
+const CurrencyController = require('./controllers/currency')
const NoticeController = require('./notice-controller')
-const ShapeShiftController = require('./lib/controllers/shapeshift')
+const ShapeShiftController = require('./controllers/shapeshift')
const MessageManager = require('./lib/message-manager')
const PersonalMessageManager = require('./lib/personal-message-manager')
const TxManager = require('./transaction-manager')
@@ -244,7 +244,6 @@ module.exports = class MetamaskController extends EventEmitter {
return {
// etc
getState: (cb) => cb(null, this.getState()),
- setRpcTarget: this.setRpcTarget.bind(this),
setProviderType: this.setProviderType.bind(this),
useEtherscanProvider: this.useEtherscanProvider.bind(this),
setCurrentCurrency: this.setCurrentCurrency.bind(this),
@@ -265,6 +264,8 @@ module.exports = class MetamaskController extends EventEmitter {
// PreferencesController
setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController),
+ setDefaultRpc: nodeify(this.setDefaultRpc).bind(this),
+ setCustomRpc: nodeify(this.setCustomRpc).bind(this),
// KeyringController
setLocked: nodeify(keyringController.setLocked).bind(keyringController),
@@ -661,10 +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()
+ return Promise.resolve('http://localhost:8545')
+ }
+
+ setCustomRpc (rpcTarget, rpcList) {
+ this.configManager.setRpcTarget(rpcTarget)
+ return this.preferencesController.updateFrequentRpcList(rpcTarget)
+ .then(() => {
+ extension.runtime.reload()
+ this.lookupNetwork()
+ return Promise.resolve(rpcTarget)
+ })
}
setProviderType (type) {