From b1eeaf7534aff50a73437bbe4b64d7b4b2af7e1e Mon Sep 17 00:00:00 2001 From: Matteo Scurati Date: Thu, 6 Jun 2024 11:14:35 +0200 Subject: [PATCH] fix: notification fix the value of the eth/usd amount (#25024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This PR fixes a bug in the calculation of the amount of some values ​​for a specific type of notifications. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25024?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Prithpal Sooriya --- .../eth-sent-received/eth-sent-received.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ui/pages/notifications/notification-components/eth-sent-received/eth-sent-received.tsx b/ui/pages/notifications/notification-components/eth-sent-received/eth-sent-received.tsx index e01a54d16b3b..77df4592babb 100644 --- a/ui/pages/notifications/notification-components/eth-sent-received/eth-sent-received.tsx +++ b/ui/pages/notifications/notification-components/eth-sent-received/eth-sent-received.tsx @@ -9,9 +9,7 @@ import { decimalToHex } from '../../../../../shared/modules/conversion.utils'; import { shortenAddress } from '../../../../helpers/utils/util'; import { createTextItems, - getAmount, formatAmount, - getUsdAmount, formatIsoDateString, getNetworkDetailsByChainId, } from '../../../../helpers/utils/notification.util'; @@ -167,12 +165,13 @@ export const components: NotificationComponent = { }} label={t('asset') || ''} detail={nativeCurrencySymbol} - fiatValue={`$${getUsdAmount( - notification.data.amount.eth, - '18', - notification.data.amount.usd, + fiatValue={`$${formatAmount( + parseFloat(notification.data.amount.usd), + { + shouldEllipse: true, + }, )}`} - value={`${getAmount(notification.data.amount.eth, '18', { + value={`${formatAmount(parseFloat(notification.data.amount.eth), { shouldEllipse: true, })} ${nativeCurrencySymbol}`} />