1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/pages/permissions-connect/snaps/util.js

22 lines
630 B
JavaScript
Raw Normal View History

import { getPermissionDescription } from '../../../helpers/utils/permission';
export function getSnapInstallWarnings(permissions, targetSubjectMetadata, t) {
const weightOneWarnings = Object.entries(permissions).reduce(
(filteredWarnings, [permissionName, permissionValue]) => {
const permissionDescription = getPermissionDescription({
t,
permissionName,
permissionValue,
targetSubjectMetadata,
});
return filteredWarnings.concat(
permissionDescription.filter((description) => description.weight === 1),
);
},
[],
);
return weightOneWarnings;
}