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

fix: remove reliance on transaction decode in confirmations #29341

Merged
merged 11 commits into from
Dec 20, 2024
2 changes: 1 addition & 1 deletion app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion test/data/confirmations/set-approval-for-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import {
genUnapprovedContractInteractionConfirmation,
} from './contract-interaction';

export const INCREASE_ALLOWANCE_TRANSACTION_DATA =
'0x395093510000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000123';

export const genUnapprovedSetApprovalForAllConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
Expand All @@ -16,7 +19,7 @@ export const genUnapprovedSetApprovalForAllConfirmation = ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
data: '0xa22cb4650000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
Expand Down
4 changes: 3 additions & 1 deletion test/data/confirmations/token-approve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ import {
export const genUnapprovedApproveConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
amountHex = '0000000000000000000000000000000000000000000000000000000000000001',
}: {
address?: Hex;
chainId?: string;
amountHex?: string;
} = {}) => ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
data: `0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b${amountHex}`,
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
Expand Down
7 changes: 6 additions & 1 deletion test/data/confirmations/token-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ import {
genUnapprovedContractInteractionConfirmation,
} from './contract-interaction';

export const TRANSFER_FROM_TRANSACTION_DATA =
'0x23b872dd0000000000000000000000002e0D7E8c45221FcA00d74a3609A0f7097035d09B0000000000000000000000002e0D7E8c45221FcA00d74a3609A0f7097035d09C0000000000000000000000000000000000000000000000000000000000000123';

export const genUnapprovedTokenTransferConfirmation = ({
address = CONTRACT_INTERACTION_SENDER_ADDRESS,
chainId = CHAIN_ID,
isWalletInitiatedConfirmation = false,
amountHex = '0000000000000000000000000000000000000000000000000000000000000001',
}: {
address?: Hex;
chainId?: string;
isWalletInitiatedConfirmation?: boolean;
amountHex?: string;
} = {}) => ({
...genUnapprovedContractInteractionConfirmation({ chainId }),
txParams: {
from: address,
data: '0x095ea7b30000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b0000000000000000000000000000000000000000000000000000000000000001',
data: `0xa9059cbb0000000000000000000000002e0d7e8c45221fca00d74a3609a0f7097035d09b${amountHex}`,
gas: '0x16a92',
to: '0x076146c765189d51be3160a2140cf80bfc73ad68',
value: '0x0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('ERC20 increaseAllowance Confirmation', () => {
'simulation-token-value',
);
expect(simulationSection).toContainElement(spendingCapValue);
expect(spendingCapValue).toHaveTextContent('1');
expect(spendingCapValue).toHaveTextContent('3');
expect(simulationSection).toHaveTextContent('0x07614...3ad68');
});

Expand All @@ -240,7 +240,7 @@ describe('ERC20 increaseAllowance Confirmation', () => {

expect(approveDetails).toContainElement(approveDetailsSpender);
expect(approveDetailsSpender).toHaveTextContent(tEn('spender') as string);
expect(approveDetailsSpender).toHaveTextContent('0x2e0D7...5d09B');
expect(approveDetailsSpender).toHaveTextContent('0x9bc5b...AfEF4');
const spenderTooltip = await screen.findByTestId(
'confirmation__approve-spender-tooltip',
);
Expand Down Expand Up @@ -301,7 +301,7 @@ describe('ERC20 increaseAllowance Confirmation', () => {
);
expect(spendingCapSection).toContainElement(spendingCapGroup);
expect(spendingCapGroup).toHaveTextContent(tEn('spendingCap') as string);
expect(spendingCapGroup).toHaveTextContent('1');
expect(spendingCapGroup).toHaveTextContent('3');

const spendingCapGroupTooltip = await screen.findByTestId(
'confirmation__approve-spending-cap-group-tooltip',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe('ERC721 setApprovalForAll Confirmation', () => {
expect(approveDetailsSpender).toHaveTextContent(
tEn('permissionFor') as string,
);
expect(approveDetailsSpender).toHaveTextContent('0x2e0D7...5d09B');
expect(approveDetailsSpender).toHaveTextContent('0x9bc5b...AfEF4');
const spenderTooltip = await screen.findByTestId(
'confirmation__approve-spender-tooltip',
);
Expand Down
Loading
Loading