diff options
author | Dan Finlay <flyswatter@users.noreply.github.com> | 2017-05-17 00:09:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-17 00:09:28 +0800 |
commit | d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070 (patch) | |
tree | 7329e8fde67876efe8bcfbc41e525e8766ff28e0 /app/scripts | |
parent | 9560de80a0576cfd775f247c51ebac6a709f4864 (diff) | |
parent | 28aba6e9dea52b66534d6ecb9713a7d20947c57c (diff) | |
download | tangerine-wallet-browser-d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070.tar tangerine-wallet-browser-d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070.tar.gz tangerine-wallet-browser-d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070.tar.bz2 tangerine-wallet-browser-d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070.tar.lz tangerine-wallet-browser-d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070.tar.xz tangerine-wallet-browser-d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070.tar.zst tangerine-wallet-browser-d165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070.zip |
Merge pull request #1436 from MetaMask/mig13
migration 13 - change provider from testnet to ropsten
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/migrations/013.js | 34 | ||||
-rw-r--r-- | app/scripts/migrations/index.js | 1 |
2 files changed, 35 insertions, 0 deletions
diff --git a/app/scripts/migrations/013.js b/app/scripts/migrations/013.js new file mode 100644 index 000000000..8f11e510e --- /dev/null +++ b/app/scripts/migrations/013.js @@ -0,0 +1,34 @@ +const version = 13 + +/* + +This migration modifies the network config from ambiguous 'testnet' to explicit 'ropsten' + +*/ + +const clone = require('clone') + +module.exports = { + version, + + migrate: function (originalVersionedData) { + const versionedData = clone(originalVersionedData) + versionedData.meta.version = version + try { + const state = versionedData.data + const newState = transformState(state) + versionedData.data = newState + } catch (err) { + console.warn(`MetaMask Migration #${version}` + err.stack) + } + return Promise.resolve(versionedData) + }, +} + +function transformState (state) { + const newState = state + if (newState.config.provider.type === 'testnet') { + newState.config.provider.type = 'ropsten' + } + return newState +} diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index 019b4d13d..3a95cf88e 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -23,4 +23,5 @@ module.exports = [ require('./010'), require('./011'), require('./012'), + require('./013'), ] |