aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/background.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-05-11 06:37:13 +0800
committerDan Finlay <dan@danfinlay.com>2016-05-11 06:37:13 +0800
commitd8bee4f5992c5a1d0851e87c49e13c97d9279411 (patch)
tree56f225263d4e8ff3e0b106afc7e28770075e92e9 /app/scripts/background.js
parentab273ba4443f83d81d3530bc18d14b1795f54d0b (diff)
downloadtangerine-wallet-browser-d8bee4f5992c5a1d0851e87c49e13c97d9279411.tar
tangerine-wallet-browser-d8bee4f5992c5a1d0851e87c49e13c97d9279411.tar.gz
tangerine-wallet-browser-d8bee4f5992c5a1d0851e87c49e13c97d9279411.tar.bz2
tangerine-wallet-browser-d8bee4f5992c5a1d0851e87c49e13c97d9279411.tar.lz
tangerine-wallet-browser-d8bee4f5992c5a1d0851e87c49e13c97d9279411.tar.xz
tangerine-wallet-browser-d8bee4f5992c5a1d0851e87c49e13c97d9279411.tar.zst
tangerine-wallet-browser-d8bee4f5992c5a1d0851e87c49e13c97d9279411.zip
Make default providers more easiliy configurable for metamask devs
No longer do our `mainnet` and `testnet` buttons set specific RPC urls. Now they set `provider.type`, which gets interpreted with code. Currently the provider types of `mainnet` and `testnet` point to our new scalable backends, but these could be re-interpreted to use any other provider, be it etherscan, peer to peer, or otherwise. Makes it easier for us to upgrade our infrastructure without incorporating migration logic into the program.
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r--app/scripts/background.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 0f9ecc1c9..a52eab2d3 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -168,6 +168,7 @@ function setupControllerConnection(stream){
var dnode = Dnode({
getState: function(cb){ cb(null, getState()) },
setRpcTarget: setRpcTarget,
+ setProviderType: setProviderType,
useEtherscanProvider: useEtherscanProvider,
// forward directly to idStore
createNewVault: idStore.createNewVault.bind(idStore),
@@ -255,6 +256,12 @@ function setRpcTarget(rpcTarget){
idStore.getNetwork(3) // 3 retry attempts
}
+function setProviderType(type) {
+ configManager.setProviderType(type)
+ chrome.runtime.reload()
+ idStore.getNetwork(3)
+}
+
function useEtherscanProvider() {
configManager.useEtherscanProvider()
chrome.runtime.reload()