mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Merge pull request #104 from MetaMask/TargetEtherscanAtOurRpc
Re-target production RPC endpoint
This commit is contained in:
commit
e0ee4365cb
@ -48,7 +48,6 @@ var providerOpts = {
|
||||
},
|
||||
approveTransaction: addUnconfirmedTx,
|
||||
signTransaction: idStore.signTransaction.bind(idStore),
|
||||
etherscan: providerConfig.type === 'etherscan',
|
||||
}
|
||||
var provider = MetaMaskProvider(providerOpts)
|
||||
|
||||
|
@ -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'] || '[]')
|
||||
|
@ -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://testrpc.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,
|
||||
|
8
app/scripts/lib/migrations.js
Normal file
8
app/scripts/lib/migrations.js
Normal file
@ -0,0 +1,8 @@
|
||||
var path = require('path')
|
||||
var fs = require('fs')
|
||||
|
||||
var migration2 = require('../migrations/002')
|
||||
|
||||
module.exports = [
|
||||
migration2,
|
||||
]
|
13
app/scripts/migrations/002.js
Normal file
13
app/scripts/migrations/002.js
Normal file
@ -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
|
||||
}
|
||||
}
|
1
test/lib/migrations/001.json
Normal file
1
test/lib/migrations/001.json
Normal file
@ -0,0 +1 @@
|
||||
{"version":0,"data":{"wallet":"{\"encSeed\":{\"encStr\":\"rT1C1jjkFRfmrwefscFcwZohl4f+HfIFlBZ9AM4ZD8atJmfKDIQCVK11NYDKYv8ZMIY03f3t8MuoZvfzBL8IJsWnZUhpzVTNNiARQJD2WpGA19eNBzgZm4vd0GwkIUruUDeJXu0iv2j9wU8hOQUqPbOePPy2Am5ro97iuvMAroRTnEKD60qFVg==\",\"nonce\":\"YUY2mwNq2v3FV0Fi94QnSiKFOLYfDR95\"},\"ksData\":{\"m/44'/60'/0'/0\":{\"info\":{\"curve\":\"secp256k1\",\"purpose\":\"sign\"},\"encHdPathPriv\":{\"encStr\":\"Iyi7ft4JQ9UtwrSXRT6ZIHPtZqJhe99rh0uWhNc6QLan6GanY2ZQeU0tt76CBealEWJyrJReSxGQdqDmSDYjpjH3m4JO5l0DfPLPseCqzXV/W+dzM0ubJ8lztLwpwi0L+vULNMqCx4dQtoNbNBq1QZUnjtpm6O8mWpScspboww==\",\"nonce\":\"Z7RqtjNjC6FrLUj5wVW1+HkjOW6Hib6K\"},\"hdIndex\":3,\"encPrivKeys\":{\"edb81c10122f34040cc4bef719a272fbbb1cf897\":{\"key\":\"8ab81tKBd4+CLAbzvS7SBFRTd6VWXBs86uBE43lgcmBu2U7UB22xdH64Q2hUf9eB\",\"nonce\":\"aGUEqI033FY39zKjWmZSI6PQrCLvkiRP\"},\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\":{\"key\":\"+i3wmf4b+B898QtlOBfL0Ixirjg59/LLPX61vQ2L0xRPjXzNog0O4Wn15RemM5mY\",\"nonce\":\"imKrlkuoC5uuFkzJBbuDBluGCPJXNTKm\"},\"2340695474656e3124b8eba1172fbfb00eeac8f8\":{\"key\":\"pi+H9D8LYKsdCQKrfaJtsGFjE+X9s74xN675tsoIKrbPXhtpxMLOIQVtSqYveF62\",\"nonce\":\"49g80wDTovHwbguVVYf2FsYbp7Db5OAR\"}},\"addresses\":[\"edb81c10122f34040cc4bef719a272fbbb1cf897\",\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\",\"2340695474656e3124b8eba1172fbfb00eeac8f8\"]}},\"version\":2}","config":{"provider":{"type":"etherscan"}}},"meta":{"version":0}}
|
14
test/unit/migrations-test.js
Normal file
14
test/unit/migrations-test.js
Normal file
@ -0,0 +1,14 @@
|
||||
var test = require('tape')
|
||||
var path = require('path')
|
||||
|
||||
var wallet1 = require(path.join('..', 'lib', 'migrations', '001.json'))
|
||||
var migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002'))
|
||||
|
||||
test('wallet1 is migrated successfully', function(t) {
|
||||
|
||||
var result = migration2.migrate(wallet1.data)
|
||||
t.equal(result.config.provider.type, 'rpc', 'provider should be rpc')
|
||||
t.equal(result.config.provider.rpcTarget, 'https://rpc.metamask.io/', 'provider should be our rpc')
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user