1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/app/scripts/migrations/050.js
Erik Marks 76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00

33 lines
794 B
JavaScript

import { cloneDeep } from 'lodash';
const version = 50;
const LEGACY_LOCAL_STORAGE_KEYS = [
'METASWAP_GAS_PRICE_ESTIMATES_LAST_RETRIEVED',
'METASWAP_GAS_PRICE_ESTIMATES',
'cachedFetch',
'BASIC_PRICE_ESTIMATES_LAST_RETRIEVED',
'BASIC_PRICE_ESTIMATES',
'BASIC_GAS_AND_TIME_API_ESTIMATES',
'BASIC_GAS_AND_TIME_API_ESTIMATES_LAST_RETRIEVED',
'GAS_API_ESTIMATES_LAST_RETRIEVED',
'GAS_API_ESTIMATES',
];
/**
* Migrate metaMetrics state to the new MetaMetrics controller
*/
export default {
version,
async migrate(originalVersionedData) {
const versionedData = cloneDeep(originalVersionedData);
versionedData.meta.version = version;
LEGACY_LOCAL_STORAGE_KEYS.forEach((key) =>
window.localStorage.removeItem(key),
);
return versionedData;
},
};