mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
1661953e23
* Migration to remove legacy local storage keys from localStorage * Update app/scripts/migrations/050.js Co-authored-by: Mark Stacey <markjstacey@gmail.com> * Update app/scripts/migrations/050.js Co-authored-by: Mark Stacey <markjstacey@gmail.com> * Fix unit tests for migration 50 * Fixing stubbing and localstorage reference in migration 50 * Update test/helper.js Co-authored-by: Mark Stacey <markjstacey@gmail.com> Co-authored-by: Mark Stacey <markjstacey@gmail.com>
33 lines
786 B
JavaScript
33 lines
786 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
|
|
},
|
|
}
|