From eddaf71e31a2267616c2665c76113bfb6c589bcb Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 12 Apr 2016 14:16:39 -0700 Subject: Migrate etherscan providers to our RPC --- app/scripts/migrations/002.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/scripts/migrations/002.js (limited to 'app') diff --git a/app/scripts/migrations/002.js b/app/scripts/migrations/002.js new file mode 100644 index 000000000..ab6a256ab --- /dev/null +++ b/app/scripts/migrations/002.js @@ -0,0 +1,13 @@ +module.exports = { + version: 2, + + migrate: function(data) { + try { + if (data.config.provider.type === 'etherscan') { + data.config.provider.type = 'rpc' + data.config.provider.rpcTarget = 'https://rpc.metamask.io/' + } + } catch (e) {} + return data + } +} -- cgit v1.2.3 From be4818564a065f166124c05b037ceb22eb5f242b Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 12 Apr 2016 14:41:58 -0700 Subject: Migrate etherscan configs to our new production RPC. --- app/scripts/background.js | 1 - app/scripts/lib/config-manager.js | 10 +++++++--- app/scripts/lib/migrations.js | 8 ++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 app/scripts/lib/migrations.js (limited to 'app') diff --git a/app/scripts/background.js b/app/scripts/background.js index dfcdcc06c..a4f80d7f6 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -48,7 +48,6 @@ var providerOpts = { }, approveTransaction: addUnconfirmedTx, signTransaction: idStore.signTransaction.bind(idStore), - etherscan: providerConfig.type === 'etherscan', } var provider = MetaMaskProvider(providerOpts) diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 121ede838..425dee3ac 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -2,7 +2,9 @@ const Migrator = require('pojo-migrator') const extend = require('xtend') const STORAGE_KEY = 'metamask-config' -var DEFAULT_RPC = 'https://rawtestrpc.metamask.io/' +const DEFAULT_RPC = 'https://rawtestrpc.metamask.io/' + +const migrations = require('./migrations') /* The config-manager is a convenience object * wrapping a pojo-migrator. @@ -28,7 +30,7 @@ function ConfigManager() { // // The `migrate` function receives the previous // config data format, and returns the new one. - migrations: [], + migrations: migrations, // How to load initial config. // Includes step on migrating pre-pojo-migrator data. @@ -134,7 +136,9 @@ function loadData() { } catch (e) {} var data = extend({ - version: 0, + meta: { + version: 0, + }, data: { config: { rpcTarget: DEFAULT_RPC, diff --git a/app/scripts/lib/migrations.js b/app/scripts/lib/migrations.js new file mode 100644 index 000000000..cab5bec66 --- /dev/null +++ b/app/scripts/lib/migrations.js @@ -0,0 +1,8 @@ +var path = require('path') +var fs = require('fs') + +var migration2 = require('../migrations/002') + +module.exports = [ + migration2, +] -- cgit v1.2.3 From d4e918cc77e47979fadeefbc7a1f90bb567c8d05 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 12 Apr 2016 14:48:48 -0700 Subject: Point rawtestrpc at new testrpc --- app/scripts/inpage.js | 4 ++-- app/scripts/lib/config-manager.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index c46d0b213..065f69629 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -11,7 +11,7 @@ const createPayload = require('web3-provider-engine/util/create-payload') const StreamProvider = require('./lib/stream-provider.js') const LocalMessageDuplexStream = require('./lib/local-message-stream.js') -const RPC_URL = 'https://rawtestrpc.metamask.io/' +const RPC_URL = 'https://testrpc.metamask.io/' // @@ -57,7 +57,7 @@ var syncProvider = new Web3.providers.HttpProvider(RPC_URL) remoteProvider.send = function(payload){ var result = null switch (payload.method) { - + case 'eth_accounts': // read from localStorage accountsCache = JSON.parse(localStorage['MetaMask-Accounts'] || '[]') diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 425dee3ac..c557891fe 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -2,7 +2,7 @@ const Migrator = require('pojo-migrator') const extend = require('xtend') const STORAGE_KEY = 'metamask-config' -const DEFAULT_RPC = 'https://rawtestrpc.metamask.io/' +const DEFAULT_RPC = 'https://testrpc.metamask.io/' const migrations = require('./migrations') -- cgit v1.2.3