aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations/004.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-02-16 08:09:16 +0800
committerDan Finlay <dan@danfinlay.com>2017-02-16 08:09:16 +0800
commit6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf (patch)
tree47906b974dee789ffd544b4c85da67e6f2323016 /app/scripts/migrations/004.js
parent245e779f37763ce0633119c257877706d0bf3554 (diff)
parent943bcec0d702b2c70b323000ed25d3c425e2a44f (diff)
downloadtangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar
tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar.gz
tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar.bz2
tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar.lz
tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar.xz
tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar.zst
tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.zip
Merge branch 'kumavis-patch-1' of github.com:MetaMask/metamask-plugin into kumavis-patch-1
Diffstat (limited to 'app/scripts/migrations/004.js')
-rw-r--r--app/scripts/migrations/004.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js
index 1329a1eed..405d932f8 100644
--- a/app/scripts/migrations/004.js
+++ b/app/scripts/migrations/004.js
@@ -1,22 +1,28 @@
+const version = 4
+
+const clone = require('clone')
+
module.exports = {
- version: 4,
+ version,
- migrate: function (data) {
+ migrate: function (versionedData) {
+ let safeVersionedData = clone(versionedData)
+ safeVersionedData.meta.version = version
try {
- if (data.config.provider.type !== 'rpc') return data
- switch (data.config.provider.rpcTarget) {
+ if (safeVersionedData.data.config.provider.type !== 'rpc') return Promise.resolve(safeVersionedData)
+ switch (safeVersionedData.data.config.provider.rpcTarget) {
case 'https://testrpc.metamask.io/':
- data.config.provider = {
+ safeVersionedData.data.config.provider = {
type: 'testnet',
}
break
case 'https://rpc.metamask.io/':
- data.config.provider = {
+ safeVersionedData.data.config.provider = {
type: 'mainnet',
}
break
}
} catch (_) {}
- return data
+ return Promise.resolve(safeVersionedData)
},
}