Skip to content

Commit

Permalink
fix: notification fix the value of the eth/usd amount (#25024)
Browse files Browse the repository at this point in the history
## **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**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **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 <prithpal.sooriya@gmail.com>
  • Loading branch information
matteoscurati and Prithpal-Sooriya authored Jun 6, 2024
1 parent 3f9d3cc commit b1eeaf7
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -167,12 +165,13 @@ export const components: NotificationComponent<ETHNotification> = {
}}
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}`}
/>
Expand Down

0 comments on commit b1eeaf7

Please sign in to comment.