diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-05-24 08:57:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-24 08:57:58 +0800 |
commit | e8288ad4bfaa5b65b23f0a03d0c036457a24893f (patch) | |
tree | b1ed4d382b3008fe3271b0c10a8f6dab41b6ee9f /app/scripts/migrations/014.js | |
parent | 9c316664de2eb82bdd10ab9cd6fa0a33f5185e20 (diff) | |
parent | 97ea7454b353acb8f87dac087eeae61f945325d7 (diff) | |
download | tangerine-wallet-browser-e8288ad4bfaa5b65b23f0a03d0c036457a24893f.tar tangerine-wallet-browser-e8288ad4bfaa5b65b23f0a03d0c036457a24893f.tar.gz tangerine-wallet-browser-e8288ad4bfaa5b65b23f0a03d0c036457a24893f.tar.bz2 tangerine-wallet-browser-e8288ad4bfaa5b65b23f0a03d0c036457a24893f.tar.lz tangerine-wallet-browser-e8288ad4bfaa5b65b23f0a03d0c036457a24893f.tar.xz tangerine-wallet-browser-e8288ad4bfaa5b65b23f0a03d0c036457a24893f.tar.zst tangerine-wallet-browser-e8288ad4bfaa5b65b23f0a03d0c036457a24893f.zip |
Merge pull request #1455 from MetaMask/networkController
Create a network controller to manage switching networks an updating t…
Diffstat (limited to 'app/scripts/migrations/014.js')
-rw-r--r-- | app/scripts/migrations/014.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/scripts/migrations/014.js b/app/scripts/migrations/014.js new file mode 100644 index 000000000..0fe92125b --- /dev/null +++ b/app/scripts/migrations/014.js @@ -0,0 +1,34 @@ +const version = 14 + +/* + +This migration removes provider from config and moves it too NetworkController. + +*/ + +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 + newState.NetworkController = {} + newState.NetworkController.provider = newState.config.provider + delete newState.config.provider + return newState +} |