mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
88f54e29fb
See [`no-empty`](https://eslint.org/docs/rules/no-empty) for more information. This change enables `no-empty` and fixes the issues raised by the rule.
34 lines
851 B
JavaScript
34 lines
851 B
JavaScript
const version = 4
|
|
|
|
import { cloneDeep } from 'lodash'
|
|
|
|
export default {
|
|
version,
|
|
|
|
migrate: function (versionedData) {
|
|
const safeVersionedData = cloneDeep(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 (_) {
|
|
// empty
|
|
}
|
|
return Promise.resolve(safeVersionedData)
|
|
},
|
|
}
|