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: Changing title for permit requests #28537

Merged
merged 53 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
03b89d8
UI changes to show decoding data for permits
jpuri Nov 5, 2024
75026e4
Merge branch 'develop' into decoding_ui_changes
jpuri Nov 7, 2024
7fed6fa
Display ERC20 and ERC721 token details returns by decoding api
jpuri Nov 7, 2024
cac71e1
Merge branch 'decoding_ui_changes' into decoded_token_display
jpuri Nov 7, 2024
8457fd3
Display native values returned from decoding api
jpuri Nov 8, 2024
569abbc
Display native values returned from decoding api
jpuri Nov 8, 2024
4810bdd
Display native values returned from decoding api
jpuri Nov 8, 2024
399086b
Display native values returned from decoding api
jpuri Nov 8, 2024
602fb20
Update signature controller and integrate decoding api
jpuri Nov 11, 2024
fc6ab5e
Update signature controller and integrate decoding api
jpuri Nov 11, 2024
228796c
Update LavaMoat policies
metamaskbot Nov 11, 2024
2943ebf
update
jpuri Nov 11, 2024
4b04930
Merge branch 'decoding_api_int' of github.com:MetaMask/metamask-exten…
jpuri Nov 11, 2024
25e9a00
UI changes to show decoding data for permits
jpuri Nov 5, 2024
fbfdfa3
Merge branch 'decoding_ui_changes' of github.com:MetaMask/metamask-ex…
jpuri Nov 11, 2024
cdbfe3b
Merge branch 'decoding_ui_changes' into decoded_token_display
jpuri Nov 11, 2024
45f64fe
update
jpuri Nov 11, 2024
dcc66cc
Merge branch 'decoded_token_display' of github.com:MetaMask/metamask-…
jpuri Nov 11, 2024
b4347bf
update
jpuri Nov 11, 2024
c9fed99
update
jpuri Nov 11, 2024
494fb15
Merge branch 'decoded_token_display' into native_value_display
jpuri Nov 11, 2024
8671d56
update
jpuri Nov 11, 2024
82f42b0
update
jpuri Nov 11, 2024
a24d06c
update
jpuri Nov 11, 2024
8de0e98
update
jpuri Nov 11, 2024
4100431
Adding tooltip to signature decoding state changes
jpuri Nov 13, 2024
a54859d
Adding tooltip to signature decoding state changes
jpuri Nov 13, 2024
4600859
Adding tooltip to signature decoding state changes
jpuri Nov 13, 2024
bb6d9de
update
jpuri Nov 13, 2024
f3b4938
merge
jpuri Nov 15, 2024
9ffc37f
Merge branch 'develop' into decoded_token_display
jpuri Nov 15, 2024
0a87bf1
update
jpuri Nov 16, 2024
49e1019
Merge branch 'decoded_token_display' into native_value_display
jpuri Nov 16, 2024
d4b7eb5
update
jpuri Nov 16, 2024
7cc5d0b
Merge branch 'native_value_display' of github.com:MetaMask/metamask-e…
jpuri Nov 16, 2024
ed4aba6
update
jpuri Nov 16, 2024
e437a1b
update
jpuri Nov 16, 2024
6e4de16
Merge branch 'native_value_display' into state_change_tooltips
jpuri Nov 16, 2024
571b540
Merge branch 'state_change_tooltips' of github.com:MetaMask/metamask-…
jpuri Nov 16, 2024
6debf04
update
jpuri Nov 16, 2024
e2eb817
Change description of enabling simulation message in settings
jpuri Nov 16, 2024
f90489d
Changing title for permit requests
jpuri Nov 16, 2024
5829b1a
update
jpuri Nov 19, 2024
200c422
Merge branch 'simulation_message_change' into permit_title_changes
jpuri Nov 19, 2024
24f7479
update
jpuri Nov 19, 2024
69b088a
Merge branch 'permit_title_changes' of github.com:MetaMask/metamask-e…
jpuri Nov 19, 2024
2d468d6
update
jpuri Nov 19, 2024
b5f0ef7
update
jpuri Nov 19, 2024
c6b58d1
merge
jpuri Nov 25, 2024
0bb74b9
merge
jpuri Nov 25, 2024
9ac696e
Merge branch 'simulation_message_change' of github.com:MetaMask/metam…
jpuri Nov 25, 2024
b303f0d
Merge branch 'develop' into permit_title_changes
jpuri Nov 25, 2024
7b79b13
Merge branch 'develop' into permit_title_changes
jpuri Nov 26, 2024
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
4 changes: 2 additions & 2 deletions test/e2e/tests/confirmations/signatures/nft-permit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ async function assertInfoValues(driver: Driver) {
text: '0x581c3...45947',
});

const title = driver.findElement({ text: 'Withdrawal request' });
const title = driver.findElement({ text: 'Signature request' });
const description = driver.findElement({
text: 'This site wants permission to withdraw your NFTs',
text: 'Review request details before you confirm.',
});
const primaryType = driver.findElement({ text: 'Permit' });
const spender = driver.findElement({
Expand Down
4 changes: 2 additions & 2 deletions test/integration/confirmations/signatures/permit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ describe('Permit Confirmation', () => {
});

await waitFor(() => {
expect(screen.getByText('Spending cap request')).toBeInTheDocument();
expect(screen.getByText('Signature request')).toBeInTheDocument();
expect(
screen.getByText('This site wants permission to spend your tokens.'),
screen.getByText('Review request details before you confirm.'),
).toBeInTheDocument();
});
});
Expand Down
35 changes: 0 additions & 35 deletions ui/pages/confirmations/components/confirm/title/title.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ import {
getMockPersonalSignConfirmStateForRequest,
getMockSetApprovalForAllConfirmState,
getMockTypedSignConfirmState,
getMockTypedSignConfirmStateForRequest,
} from '../../../../../../test/data/confirmations/helper';
import { unapprovedPersonalSignMsg } from '../../../../../../test/data/confirmations/personal_sign';
import {
permitNFTSignatureMsg,
permitSignatureMsg,
} from '../../../../../../test/data/confirmations/typed_sign';
import { renderWithConfirmContextProvider } from '../../../../../../test/lib/confirmations/render-helpers';
import { tEn } from '../../../../../../test/lib/i18n-helpers';
import {
Expand Down Expand Up @@ -59,36 +54,6 @@ describe('ConfirmTitle', () => {
).toBeInTheDocument();
});

it('should render the title and description for a permit signature', () => {
const mockStore = configureMockStore([])(
getMockTypedSignConfirmStateForRequest(permitSignatureMsg),
);
const { getByText } = renderWithConfirmContextProvider(
<ConfirmTitle />,
mockStore,
);

expect(getByText('Spending cap request')).toBeInTheDocument();
expect(
getByText('This site wants permission to spend your tokens.'),
).toBeInTheDocument();
});

it('should render the title and description for a NFT permit signature', () => {
const mockStore = configureMockStore([])(
getMockTypedSignConfirmStateForRequest(permitNFTSignatureMsg),
);
const { getByText } = renderWithConfirmContextProvider(
<ConfirmTitle />,
mockStore,
);

expect(getByText('Withdrawal request')).toBeInTheDocument();
expect(
getByText('This site wants permission to withdraw your NFTs'),
).toBeInTheDocument();
});

it('should render the title and description for typed signature', () => {
const mockStore = configureMockStore([])(getMockTypedSignConfirmState());
const { getByText } = renderWithConfirmContextProvider(
Expand Down
22 changes: 0 additions & 22 deletions ui/pages/confirmations/components/confirm/title/title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
} from '@metamask/transaction-controller';
import React, { memo, useMemo } from 'react';

import { TokenStandard } from '../../../../../../shared/constants/transaction';
import GeneralAlert from '../../../../../components/app/alert-system/general-alert/general-alert';
import { Box, Text } from '../../../../../components/component-library';
import {
Expand All @@ -14,7 +13,6 @@ import {
} from '../../../../../helpers/constants/design-system';
import useAlerts from '../../../../../hooks/useAlerts';
import { useI18nContext } from '../../../../../hooks/useI18nContext';
import { TypedSignSignaturePrimaryTypes } from '../../../constants';
import { useConfirmContext } from '../../../context/confirm';
import { Confirmation, SignatureRequestType } from '../../../types/confirm';
import { isSIWESignatureRequest } from '../../../utils';
Expand Down Expand Up @@ -61,8 +59,6 @@ const getTitle = (
customSpendingCap?: string,
isRevokeSetApprovalForAll?: boolean,
pending?: boolean,
primaryType?: keyof typeof TypedSignSignaturePrimaryTypes,
tokenStandard?: string,
) => {
if (pending) {
return '';
Expand All @@ -79,12 +75,6 @@ const getTitle = (
}
return t('confirmTitleSignature');
case TransactionType.signTypedData:
if (primaryType === TypedSignSignaturePrimaryTypes.PERMIT) {
if (tokenStandard === TokenStandard.ERC721) {
return t('setApprovalForAllRedesignedTitle');
}
return t('confirmTitlePermitTokens');
}
return t('confirmTitleSignature');
case TransactionType.tokenMethodApprove:
if (isNFT) {
Expand Down Expand Up @@ -113,8 +103,6 @@ const getDescription = (
customSpendingCap?: string,
isRevokeSetApprovalForAll?: boolean,
pending?: boolean,
primaryType?: keyof typeof TypedSignSignaturePrimaryTypes,
tokenStandard?: string,
) => {
if (pending) {
return '';
Expand All @@ -131,12 +119,6 @@ const getDescription = (
}
return t('confirmTitleDescSign');
case TransactionType.signTypedData:
if (primaryType === TypedSignSignaturePrimaryTypes.PERMIT) {
if (tokenStandard === TokenStandard.ERC721) {
return t('confirmTitleDescApproveTransaction');
}
return t('confirmTitleDescPermitSignature');
}
return t('confirmTitleDescSign');
case TransactionType.tokenMethodApprove:
if (isNFT) {
Expand Down Expand Up @@ -195,8 +177,6 @@ const ConfirmTitle: React.FC = memo(() => {
customSpendingCap,
isRevokeSetApprovalForAll,
spendingCapPending || revokePending,
primaryType,
tokenStandard,
),
[
currentConfirmation,
Expand All @@ -219,8 +199,6 @@ const ConfirmTitle: React.FC = memo(() => {
customSpendingCap,
isRevokeSetApprovalForAll,
spendingCapPending || revokePending,
primaryType,
tokenStandard,
),
[
currentConfirmation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,12 @@ exports[`Confirm should match snapshot for signature - typed sign - V4 - PermitB
<h2
class="mm-box mm-text mm-text--heading-lg mm-text--text-align-center mm-box--padding-top-4 mm-box--padding-bottom-4 mm-box--color-text-default"
>
Spending cap request
Signature request
</h2>
<p
class="mm-box mm-text mm-text--body-md mm-text--text-align-center mm-box--padding-bottom-4 mm-box--color-text-alternative"
>
This site wants permission to spend your tokens.
Review request details before you confirm.
</p>
<div
class="mm-box mm-box--margin-bottom-4 mm-box--padding-2 mm-box--background-color-background-default mm-box--rounded-md"
Expand Down Expand Up @@ -1111,12 +1111,12 @@ exports[`Confirm should match snapshot for signature - typed sign - V4 - PermitS
<h2
class="mm-box mm-text mm-text--heading-lg mm-text--text-align-center mm-box--padding-top-4 mm-box--padding-bottom-4 mm-box--color-text-default"
>
Spending cap request
Signature request
</h2>
<p
class="mm-box mm-text mm-text--body-md mm-text--text-align-center mm-box--padding-bottom-4 mm-box--color-text-alternative"
>
This site wants permission to spend your tokens.
Review request details before you confirm.
</p>
<div
class="mm-box mm-box--margin-bottom-4 mm-box--padding-2 mm-box--background-color-background-default mm-box--rounded-md"
Expand Down Expand Up @@ -2794,12 +2794,12 @@ exports[`Confirm should match snapshot for signature - typed sign - permit 1`] =
<h2
class="mm-box mm-text mm-text--heading-lg mm-text--text-align-center mm-box--padding-top-4 mm-box--padding-bottom-4 mm-box--color-text-default"
>
Spending cap request
Signature request
</h2>
<p
class="mm-box mm-text mm-text--body-md mm-text--text-align-center mm-box--padding-bottom-4 mm-box--color-text-alternative"
>
This site wants permission to spend your tokens.
Review request details before you confirm.
</p>
<div
class="mm-box mm-box--margin-bottom-4 mm-box--padding-2 mm-box--background-color-background-default mm-box--rounded-md"
Expand Down
Loading