Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(snaps): Removed Snaps name-lookup permission code fences #26392

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions shared/constants/snaps/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export const EndowmentPermissions = Object.freeze({
'endowment:lifecycle-hooks': 'endowment:lifecycle-hooks',
'endowment:page-home': 'endowment:page-home',
'endowment:signature-insight': 'endowment:signature-insight',
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
'endowment:name-lookup': 'endowment:name-lookup',
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
'endowment:keyring': 'endowment:keyring',
///: END:ONLY_INCLUDE_IF
Expand All @@ -22,11 +20,6 @@ export const ExcludedSnapPermissions = Object.freeze({
'eth_accounts is disabled. For more information please see https://github.com/MetaMask/snaps/issues/990.',
});

export const ExcludedSnapEndowments = Object.freeze({
///: BEGIN:ONLY_INCLUDE_IF(build-main)
'endowment:name-lookup':
'This endowment is experimental and therefore not available.',
///: END:ONLY_INCLUDE_IF
});
export const ExcludedSnapEndowments = Object.freeze({});

export const DynamicSnapPermissions = Object.freeze(['eth_accounts']);
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
import React, {
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
useContext,
///: END:ONLY_INCLUDE_IF
useRef,
useEffect,
useState,
} from 'react';
import React, { useContext, useRef, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
import { I18nContext } from '../../../../../contexts/i18n';
///: END:ONLY_INCLUDE_IF
import Confusable from '../../../../ui/confusable';
import {
AvatarAccount,
Box,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
AvatarIcon,
AvatarIconSize,
BadgeWrapper,
IconName,
///: END:ONLY_INCLUDE_IF
Text,
} from '../../../../component-library';
import {
AlignItems,
Display,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
BackgroundColor,
BorderColor,
IconColor,
///: END:ONLY_INCLUDE_IF
TextColor,
TextVariant,
} from '../../../../../helpers/constants/design-system';
Expand All @@ -49,15 +36,11 @@ export const DomainInputResolutionCell = ({
domainType,
address,
domainName,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
resolvingSnap = '',
///: END:ONLY_INCLUDE_IF
onClick,
protocol,
}: DomainInputResolutionCellArgs) => {
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
const t: (key: string, params: unknown[]) => string = useContext(I18nContext);
///: END:ONLY_INCLUDE_IF
const titleRef = useRef<null | HTMLDivElement>(null);
const breakpointRef = useRef<null | number>(null);
const [isTitleOverflowing, setIsTitleOverflowing] = useState(false);
Expand Down Expand Up @@ -106,7 +89,6 @@ export const DomainInputResolutionCell = ({
</Tooltip>
);

///: BEGIN:ONLY_INCLUDE_IF(build-flask)
if (domainType === 'Other') {
// Snap provided resolution.
return (
Expand Down Expand Up @@ -180,7 +162,6 @@ export const DomainInputResolutionCell = ({
</Box>
);
}
///: END:ONLY_INCLUDE_IF
const getTitle = () => {
if (domainName && isTitleOverflowing) {
return <OverflowingTitle />;
Expand Down Expand Up @@ -242,9 +223,7 @@ DomainInputResolutionCell.propTypes = {
domainType: PropTypes.string.isRequired,
address: PropTypes.string.isRequired,
domainName: PropTypes.string.isRequired,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
resolvingSnap: PropTypes.string.isRequired,
///: END:ONLY_INCLUDE_IF
onClick: PropTypes.func,
protocol: PropTypes.string,
};
2 changes: 0 additions & 2 deletions ui/helpers/utils/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,12 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({
weight: 3,
}),
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
[EndowmentPermissions['endowment:name-lookup']]: ({ t }) => ({
label: t('permission_nameLookup'),
description: t('permission_nameLookupDescription'),
leftIcon: IconName.Search,
weight: 4,
}),
///: END:ONLY_INCLUDE_IF
[EndowmentPermissions['endowment:signature-insight']]: ({
t,
permissionValue,
Expand Down
Loading