A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/app/scripts/migrations/060.js

35 lines
904 B

import { cloneDeep, isPlainObject } from 'lodash';
const version = 60;
const SUPPORT_NOTIFICATION_KEY = 2;
const SUPPORT_NOTIFICATION_DATE = '2020-08-31';
/**
* Removes the support survey notification
*/
export default {
version,
async migrate(originalVersionedData) {
const versionedData = cloneDeep(originalVersionedData);
versionedData.meta.version = version;
const state = versionedData.data;
const newState = transformState(state);
versionedData.data = newState;
return versionedData;
},
};
function transformState(state) {
const notifications = state?.NotificationController?.notifications;
if (isPlainObject(notifications)) {
if (
notifications[SUPPORT_NOTIFICATION_KEY]?.date ===
SUPPORT_NOTIFICATION_DATE
) {
delete state.NotificationController.notifications[
SUPPORT_NOTIFICATION_KEY
];
}
}
return state;
}