mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
32 lines
818 B
JavaScript
32 lines
818 B
JavaScript
const version = 4
|
|
|
|
import clone from 'clone'
|
|
|
|
export default {
|
|
version,
|
|
|
|
migrate: function (versionedData) {
|
|
const safeVersionedData = clone(versionedData)
|
|
safeVersionedData.meta.version = version
|
|
try {
|
|
if (safeVersionedData.data.config.provider.type !== 'rpc') {
|
|
return Promise.resolve(safeVersionedData)
|
|
}
|
|
switch (safeVersionedData.data.config.provider.rpcTarget) {
|
|
case 'https://testrpc.metamask.io/':
|
|
safeVersionedData.data.config.provider = {
|
|
type: 'testnet',
|
|
}
|
|
break
|
|
case 'https://rpc.metamask.io/':
|
|
safeVersionedData.data.config.provider = {
|
|
type: 'mainnet',
|
|
}
|
|
break
|
|
// No default
|
|
}
|
|
} catch (_) {}
|
|
return Promise.resolve(safeVersionedData)
|
|
},
|
|
}
|