1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 02:58:09 +01:00
metamask-extension/app/scripts/migrations/004.js

26 lines
676 B
JavaScript
Raw Normal View History

const version = 4
2016-05-11 22:10:54 +02:00
module.exports = {
version,
2016-05-11 22:10:54 +02:00
migrate: function (versionedData) {
versionedData.meta.version = version
2016-05-11 22:10:54 +02:00
try {
if (versionedData.data.config.provider.type !== 'rpc') return Promise.resolve(versionedData)
switch (versionedData.data.config.provider.rpcTarget) {
2016-05-11 22:10:54 +02:00
case 'https://testrpc.metamask.io/':
versionedData.data.config.provider = {
2016-06-21 22:18:32 +02:00
type: 'testnet',
}
2016-05-11 22:10:54 +02:00
break
case 'https://rpc.metamask.io/':
versionedData.data.config.provider = {
2016-06-21 22:18:32 +02:00
type: 'mainnet',
}
2016-05-11 22:10:54 +02:00
break
}
} catch (_) {}
return Promise.resolve(versionedData)
2016-06-21 22:18:32 +02:00
},
2016-05-11 22:10:54 +02:00
}