diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index f7efae1ee..d71994b69 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -2668,6 +2668,10 @@ "permissionRevoked": { "message": "Revoked in this update" }, + "permission_accessNamedSnap": { + "message": "Connect to $1.", + "description": "The description for the `wallet_snap_*` permission. $1 is the human-readable name of the Snap." + }, "permission_accessNetwork": { "message": "Access the internet.", "description": "The description of the `endowment:network-access` permission." diff --git a/shared/constants/snaps.ts b/shared/constants/snaps.ts new file mode 100644 index 000000000..2c0e21a88 --- /dev/null +++ b/shared/constants/snaps.ts @@ -0,0 +1,43 @@ +///: BEGIN:ONLY_INCLUDE_IN(flask) +type SnapsMetadata = { + [snapId: string]: { + name: string; + }; +}; + +// If a Snap ID is present in this object, its metadata is used before the info +// of the snap is fetched. Ideally this information would be fetched from the +// snap registry, but this is a temporary solution. +export const SNAPS_METADATA: SnapsMetadata = { + 'npm:@metamask/test-snap-error': { + name: 'Error Test Snap', + }, + 'npm:@metamask/test-snap-confirm': { + name: 'Confirm Test Snap', + }, + 'npm:@metamask/test-snap-dialog': { + name: 'Dialog Test Snap', + }, + 'npm:@metamask/test-snap-bip44': { + name: 'BIP-44 Test Snap', + }, + 'npm:@metamask/test-snap-managestate': { + name: 'Manage State Test Snap', + }, + 'npm:@metamask/test-snap-notification': { + name: 'Notification Test Snap', + }, + 'npm:@metamask/test-snap-bip32': { + name: 'BIP-32 Test Snap', + }, + 'npm:@metamask/test-snap-insights': { + name: 'Insights Test Snap', + }, + 'npm:@metamask/test-snap-rpc': { + name: 'RPC Test Snap', + }, + 'npm:@metamask/test-snap-cronjob': { + name: 'Cronjob Test Snap', + }, +}; +///: END:ONLY_INCLUDE_IN diff --git a/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js b/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js index 4499def2c..6a845f314 100644 --- a/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js +++ b/ui/components/app/flask/snaps-authorship-pill/snaps-authorship-pill.js @@ -11,11 +11,12 @@ import { TextColor, } from '../../../../helpers/constants/design-system'; import { useI18nContext } from '../../../../hooks/useI18nContext'; +import { SNAPS_METADATA } from '../../../../../shared/constants/snaps'; const snapIdPrefixes = ['npm:', 'local:']; const SnapsAuthorshipPill = ({ snapId, version, className }) => { - // @todo Use getSnapPrefix from snaps-skunkworks when possible + // @todo Use getSnapPrefix from snaps-monorepo when possible // We're using optional chaining with snapId, because with the current implementation // of snap update in the snap controller, we do not have reference to snapId when an // update request is rejected because the reference comes from the request itself and not subject metadata @@ -30,6 +31,9 @@ const SnapsAuthorshipPill = ({ snapId, version, className }) => { : packageName; const icon = isNPM ? 'fab fa-npm fa-lg' : 'fas fa-code'; const t = useI18nContext(); + + const friendlyName = SNAPS_METADATA[snapId]?.name ?? packageName; + return ( { variant={TypographyVariant.H7} as="span" color={TextColor.textAlternative} - title={packageName} + title={friendlyName} > - {packageName} + {friendlyName} diff --git a/ui/components/app/modals/metametrics-opt-in-modal/__snapshots__/metametrics-opt-in-modal.test.js.snap b/ui/components/app/modals/metametrics-opt-in-modal/__snapshots__/metametrics-opt-in-modal.test.js.snap index fa8d0b9d9..199f7c2b7 100644 --- a/ui/components/app/modals/metametrics-opt-in-modal/__snapshots__/metametrics-opt-in-modal.test.js.snap +++ b/ui/components/app/modals/metametrics-opt-in-modal/__snapshots__/metametrics-opt-in-modal.test.js.snap @@ -310,7 +310,7 @@ exports[`MetaMetrics Opt In should match snapshot 1`] = ` >