aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations/004.js
diff options
context:
space:
mode:
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)
},
}