Skip to content

Commit

Permalink
fix(APP-3882): Use correct native token symbol for asset transfer war…
Browse files Browse the repository at this point in the history
…ning (#403)
  • Loading branch information
thekidnamedkd authored Feb 11, 2025
1 parent e4336a9 commit 48d1a41
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed

- Bump `actions/setup-python` to 5.4.0
- Update minor and patch dependencies
- Update minor and patch NPM dependencies
- Improve code coverage on core and modules components

### Fixed

- Fix documentation pages on primitive variables
- Use correct token symbol in asset transfer warning for supported chains

## [1.0.65] - 2025-01-30

Expand Down
4 changes: 2 additions & 2 deletions src/modules/assets/copy/modulesCopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const modulesCopy = {
proposalActionsItem: {
dropdownLabel: 'More',
nativeSendAlert: 'Proceed with caution',
nativeSendDescription: (amount: string) =>
`This action attempts to send ${amount} ETH. This could cause the action to fail or result in a loss of funds.`,
nativeSendDescription: (amount: string, symbol: string) =>
`This action attempts to send ${amount} ${symbol}. This could cause the action to fail or result in a loss of funds.`,
notVerified: {
function: 'Unknown',
contract: 'Unverified contract',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ describe('<ProposalActionsItem /> component', () => {

it('renders a warning icon and alert when action value is not zero and action is not a native transfer', async () => {
const action = generateProposalAction({ value: '1000000000000000000', data: '0xabc' });
render(createTestComponent({ action }));
render(createTestComponent({ action, chainId: 137 }));
expect(screen.getByTestId(IconType.WARNING)).toBeInTheDocument();
await userEvent.click(screen.getByRole('button'));
expect(screen.getByText(modulesCopy.proposalActionsItem.nativeSendAlert)).toBeInTheDocument();
expect(screen.getByText(modulesCopy.proposalActionsItem.nativeSendDescription('1')));
expect(screen.getByText(modulesCopy.proposalActionsItem.nativeSendDescription('1', 'POL')));
});

it('updates active view on view-mode change', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import classNames from 'classnames';
import { useRef, useState } from 'react';
import { formatUnits } from 'viem';
import { useChains } from 'wagmi';
import { Accordion, AlertCard, Button, Dropdown, Icon, IconType, invariant, Link, LinkBase } from '../../../../../core';
import { ChainEntityType, useBlockExplorer } from '../../../../hooks';
import { addressUtils } from '../../../../utils';
Expand Down Expand Up @@ -30,6 +31,10 @@ export const ProposalActionsItem = <TAction extends IProposalAction = IProposalA
const { copy } = useGukModulesContext();
const { buildEntityUrl } = useBlockExplorer({ chainId });

const chains = useChains();
const chain = chains.find((chain) => chain.id === chainId);
const currencySymbol = chain?.nativeCurrency.symbol ?? 'ETH';

const contentRef = useRef<HTMLDivElement>(null);
const itemRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -115,7 +120,7 @@ export const ProposalActionsItem = <TAction extends IProposalAction = IProposalA
<AlertCard
variant="warning"
message={copy.proposalActionsItem.nativeSendAlert}
description={copy.proposalActionsItem.nativeSendDescription(formattedValue)}
description={copy.proposalActionsItem.nativeSendDescription(formattedValue, currencySymbol)}
/>
)}
{activeViewMode === 'BASIC' && (
Expand Down

0 comments on commit 48d1a41

Please sign in to comment.