1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

[FLASK] Fix usages of getSnapName (#19546)

This commit is contained in:
Frederik Bolding 2023-06-09 16:37:38 +02:00 committed by GitHub
parent ff36e32fb0
commit 3e1fb2a4be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 8 deletions

View File

@ -91,7 +91,7 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({
fontWeight={FontWeight.Medium}
as="span"
>
{getSnapName(targetSubjectMetadata?.origin)}
{getSnapName(targetSubjectMetadata?.origin, targetSubjectMetadata)}
</Text>,
<Text as="span" key="2" fontWeight={FontWeight.Medium}>
{getSnapDerivationPathName(path, curve) ??
@ -160,7 +160,7 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({
fontWeight={FontWeight.Medium}
as="span"
>
{getSnapName(targetSubjectMetadata?.origin)}
{getSnapName(targetSubjectMetadata?.origin, targetSubjectMetadata)}
</Text>,
<Text as="span" key="2" fontWeight={FontWeight.Medium}>
{getSnapDerivationPathName(path, curve) ??
@ -241,7 +241,7 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({
fontWeight={FontWeight.Medium}
as="span"
>
{getSnapName(targetSubjectMetadata?.origin)}
{getSnapName(targetSubjectMetadata?.origin, targetSubjectMetadata)}
</Text>,
<Text as="span" key="2" fontWeight={FontWeight.Medium}>
{coinTypeToProtocolName(coinType) ||
@ -261,7 +261,11 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({
leftIcon: IconName.AddSquare,
weight: 3,
}),
[RestrictedMethods.wallet_snap]: ({ t, permissionValue }) => {
[RestrictedMethods.wallet_snap]: ({
t,
permissionValue,
targetSubjectMetadata,
}) => {
const snaps = permissionValue.caveats[0].value;
const baseDescription = {
leftIcon: getLeftIcon(IconName.Flash),
@ -269,7 +273,7 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({
};
return Object.keys(snaps).map((snapId) => {
const friendlyName = getSnapName(snapId);
const friendlyName = getSnapName(snapId, targetSubjectMetadata);
if (friendlyName) {
return {
...baseDescription,

View File

@ -69,7 +69,10 @@ export default function SnapInstall({
const shouldShowWarning = warnings.length > 0;
const snapName = getSnapName(targetSubjectMetadata.origin);
const snapName = getSnapName(
targetSubjectMetadata.origin,
targetSubjectMetadata,
);
const handleSubmit = () => {
if (!hasError && shouldShowWarning) {

View File

@ -44,7 +44,10 @@ export default function SnapResult({
const hasError = !requestState.loading && requestState.error;
const isLoading = requestState.loading;
const snapName = getSnapName(targetSubjectMetadata.origin);
const snapName = getSnapName(
targetSubjectMetadata.origin,
targetSubjectMetadata,
);
function getSuccessScreen(requestType, snapNameToRender) {
let successScreenTitle;

View File

@ -73,7 +73,10 @@ export default function SnapUpdate({
const shouldShowWarning = warnings.length > 0;
const snapName = getSnapName(targetSubjectMetadata.origin);
const snapName = getSnapName(
targetSubjectMetadata.origin,
targetSubjectMetadata,
);
const handleSubmit = () => {
if (!hasError && shouldShowWarning) {