From f60242e8e1b0b284670dbf51ed1d93124991ca53 Mon Sep 17 00:00:00 2001
From: digiwand <20778143+digiwand@users.noreply.github.com>
Date: Fri, 21 Feb 2025 01:10:21 +0100
Subject: [PATCH] fix: TypedSignDecoded revoke
---
.../TypedSignDecoded.test.tsx | 21 +++++++++++++++++++
.../TypedSignDecoded/TypedSignDecoded.tsx | 2 +-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.test.tsx b/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.test.tsx
index aeef90fe028..b0b88c70c52 100644
--- a/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.test.tsx
+++ b/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.test.tsx
@@ -26,6 +26,16 @@ const stateChangesApprove = [
},
];
+const stateChangesRevoke = [
+ {
+ assetType: 'ERC20',
+ changeType: DecodingDataChangeType.Revoke,
+ address: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
+ amount: '12345',
+ contractAddress: '0x6b175474e89094c44da98b954eedeac495271d0f',
+ },
+];
+
const stateChangesListingERC1155: DecodingDataStateChanges = [
{
assetType: 'NATIVE',
@@ -112,6 +122,17 @@ describe('DecodedSimulation', () => {
await waitFor(() => expect(getByText('12,345')).toBeDefined());
});
+ it('renders for ERC20 revoke', async () => {
+ const { getByText } = renderWithProvider(, {
+ state: mockState(stateChangesRevoke),
+ });
+
+ expect(await getByText('Estimated changes')).toBeDefined();
+ expect(await getByText('Revoke')).toBeDefined();
+
+ await waitFor(() => expect(getByText('12,345')).toBeDefined());
+ });
+
it('renders "Unlimited" for large values', async () => {
const { getByText } = renderWithProvider(, {
state: mockState([{
diff --git a/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.tsx b/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.tsx
index d51866173b2..42091bb07dc 100644
--- a/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.tsx
+++ b/app/components/Views/confirmations/components/Confirm/Info/TypedSignV3V4/Simulation/TypedSignDecoded/TypedSignDecoded.tsx
@@ -84,7 +84,7 @@ const getStateChangeLabelMap = (
? strings('confirm.simulation.label_change_type_nft_listing')
: strings('confirm.simulation.label_change_type_receive'),
[DecodingDataChangeType.Approve]: strings('confirm.simulation.label_change_type_permit'),
- [DecodingDataChangeType.Revoke]: strings('confirm.simulation.label_change_type_permit'),
+ [DecodingDataChangeType.Revoke]: strings('confirm.simulation.label_change_type_revoke'),
[DecodingDataChangeType.Bidding]: strings('confirm.simulation.label_change_type_bidding'),
[DecodingDataChangeType.Listing]: strings('confirm.simulation.label_change_type_listing'),
}[changeType]);