mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Deprecate rawtestrpc.metamask.io
This migration will move users who have their clients configured to point at `rawtestrpc.metamask.io` to point at our new test-net RPC, `testrpc.metamask.io`.
This commit is contained in:
parent
db85827b2b
commit
875a0731dd
@ -1,11 +1,13 @@
|
||||
var oldTestRpc = 'https://rawtestrpc.metamask.io/'
|
||||
var newTestRpc = 'https://testrpc.metamask.io/'
|
||||
|
||||
module.exports = {
|
||||
version: 2,
|
||||
version: 3,
|
||||
|
||||
migrate: function(data) {
|
||||
try {
|
||||
if (data.config.provider.type === 'etherscan') {
|
||||
data.config.provider.type = 'rpc'
|
||||
data.config.provider.rpcTarget = 'https://rpc.metamask.io/'
|
||||
if (data.config.provider.rpcTarget === oldTestRpc) {
|
||||
data.config.provider.rpcTarget = newTestRpc
|
||||
}
|
||||
} catch (e) {}
|
||||
return data
|
||||
|
13
app/scripts/migrations/003.js
Normal file
13
app/scripts/migrations/003.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
|
||||
}
|
||||
}
|
@ -3,13 +3,21 @@ var path = require('path')
|
||||
|
||||
var wallet1 = require(path.join('..', 'lib', 'migrations', '001.json'))
|
||||
var migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002'))
|
||||
var migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003'))
|
||||
|
||||
describe('wallet1 is migrated successfully', function() {
|
||||
|
||||
it('should convert etherscan provider', function(done) {
|
||||
var result = migration2.migrate(wallet1.data)
|
||||
assert.equal(result.config.provider.type, 'rpc', 'provider should be rpc')
|
||||
assert.equal(result.config.provider.rpcTarget, 'https://rpc.metamask.io/', 'provider should be our rpc')
|
||||
|
||||
var firstResult = migration2.migrate(wallet1.data)
|
||||
assert.equal(firstResult.config.provider.type, 'rpc', 'provider should be rpc')
|
||||
assert.equal(firstResult.config.provider.rpcTarget, 'https://rpc.metamask.io/', 'provider should be our rpc')
|
||||
|
||||
var oldTestRpc = 'https://rawtestrpc.metamask.io/'
|
||||
firstResult.config.provider.rpcTarget = oldTestRpc
|
||||
var secondResult = migration3.migrate(firstResult)
|
||||
assert.equal(firstResult.config.provider.rpcTarget, 'https://testrpc.metamask.io/', 'provider should be our rpc')
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user