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 decimals in Widget amount value #3303

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions wormhole-connect/src/views/v2/TxHistory/Item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const TxHistoryItem = (props: Props) => {
txHash,
amount,
amountUsd,
recipient,
fromChain,
fromToken,
toChain,
Expand All @@ -64,8 +63,7 @@ const TxHistoryItem = (props: Props) => {
),
[],
);
const { getTokenPrice, isFetchingTokenPrices, lastTokenPriceUpdate } =
useTokens();
const { getTokenPrice, lastTokenPriceUpdate } = useTokens();

// Render details for the sent amount
const sentAmount = useMemo(() => {
Expand Down Expand Up @@ -133,15 +131,17 @@ const TxHistoryItem = (props: Props) => {
</Stack>
</Stack>
);
// ESLint complains that lastTokenPriceUpdate is unused/unnecessary here,
// but we want to recompute the price after we update conversion rates.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
isFetchingTokenPrices,
lastTokenPriceUpdate,
receiveAmount,
toChain,
toToken,
recipient,
receiveAmount,
getTokenPrice,
separator,
theme.palette.text.secondary,
toChain,
]);

// Vertical line that connects sender and receiver token icons
Expand Down
2 changes: 1 addition & 1 deletion wormhole-connect/src/views/v2/TxHistory/Widget/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const WidgetItem = (props: Props) => {
</Typography>
<Stack direction="row" alignItems="center">
<Typography fontSize={14} marginRight="8px">
{`${sdkAmount.display(sdkAmount.truncate(amount, 4))} ${
{`${sdkAmount.display(sdkAmount.truncate(amount, 6))} ${
token.symbol
}`}
</Typography>
Expand Down
Loading