Skip to content

Commit

Permalink
fix: Wrong icon for ETH on L2s being displayed on transfer confirmati…
Browse files Browse the repository at this point in the history
…ons (#29353)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

We were inadvertently referencing the network icon map instead of the
native token map.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29353?quickstart=1)

## **Related issues**

Fixes: #29351

## **Manual testing steps**

1. Go to this page...
2.
3.

## **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**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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.
  • Loading branch information
pedronfigueiredo authored Dec 19, 2024
1 parent 13a1fcf commit 22490c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`NativeTransferInfo renders correctly 1`] = `
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xl mm-avatar-token mm-text--body-lg-medium mm-text--text-transform-uppercase mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-text-default mm-box--background-color-background-default mm-box--rounded-full"
>
G
E
</div>
<h2
class="mm-box mm-text mm-text--heading-lg mm-box--margin-top-3 mm-box--color-inherit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { BigNumber } from 'bignumber.js';
import React from 'react';
import { useSelector } from 'react-redux';
import {
CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP,
CHAIN_ID_TOKEN_IMAGE_MAP,
TEST_CHAINS,
} from '../../../../../../../../shared/constants/network';
import { calcTokenAmount } from '../../../../../../../../shared/lib/transactions-controller-utils';
import { getNetworkConfigurationsByChainId } from '../../../../../../../../shared/modules/selectors/networks';
import {
AvatarToken,
AvatarTokenSize,
Expand Down Expand Up @@ -62,6 +63,13 @@ const NativeSendHeading = () => {
const multichainNetwork = useSelector(getMultichainNetwork);
const ticker = multichainNetwork?.network?.ticker;

const networkConfigurationsByChainId = useSelector(
getNetworkConfigurationsByChainId,
);

const network = networkConfigurationsByChainId?.[transactionMeta.chainId];
const { nativeCurrency } = network;

const locale = useSelector(getIntlLocale);
const roundedTransferValue = formatAmount(locale, nativeAssetTransferValue);

Expand All @@ -76,12 +84,11 @@ const NativeSendHeading = () => {
const NetworkImage = (
<AvatarToken
src={
multichainNetwork?.network?.rpcPrefs?.imageUrl ||
CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP[
transactionMeta.chainId as keyof typeof CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP
CHAIN_ID_TOKEN_IMAGE_MAP[
transactionMeta.chainId as keyof typeof CHAIN_ID_TOKEN_IMAGE_MAP
]
}
name={multichainNetwork?.nickname}
name={nativeCurrency}
size={AvatarTokenSize.Xl}
backgroundColor={BackgroundColor.backgroundDefault}
/>
Expand Down

0 comments on commit 22490c3

Please sign in to comment.