diff options
Diffstat (limited to 'app/scripts/migrations/004.js')
-rw-r--r-- | app/scripts/migrations/004.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js index 0f9850208..405d932f8 100644 --- a/app/scripts/migrations/004.js +++ b/app/scripts/migrations/004.js @@ -1,25 +1,28 @@ const version = 4 +const clone = require('clone') + module.exports = { - version, + version, migrate: function (versionedData) { - versionedData.meta.version = version + let safeVersionedData = clone(versionedData) + safeVersionedData.meta.version = version try { - if (versionedData.data.config.provider.type !== 'rpc') return Promise.resolve(versionedData) - switch (versionedData.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/': - versionedData.data.config.provider = { + safeVersionedData.data.config.provider = { type: 'testnet', } break case 'https://rpc.metamask.io/': - versionedData.data.config.provider = { + safeVersionedData.data.config.provider = { type: 'mainnet', } break } } catch (_) {} - return Promise.resolve(versionedData) + return Promise.resolve(safeVersionedData) }, } |