Skip to content

Commit

Permalink
Adding ChainID Currency Symbol Map (#22292)
Browse files Browse the repository at this point in the history
## **Description**
We want a ChainID: Ticker Map for future validation on some of our more
commonly used networks. This PR adds that mapping constant, changes
Optimism's "OP" ticker to "ETH" and fixes a resulting unit test failure.

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Related issues**

Fixes: [#1708
](https://github.com/MetaMask/MetaMask-planning/issues/1708)
## **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 clearly explained what problem this PR is solving and how it
is solved.
- [X] I've linked related issues
- [X] I've included manual testing steps
- [X] I've included screenshots/recordings if applicable
- [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.
- [X] I’ve properly set the pull request status:
  - [X] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

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

---------

Co-authored-by: Dan J Miller <[email protected]>
  • Loading branch information
vthomas13 and danjm authored Dec 18, 2023
1 parent 1b77dc6 commit 727e859
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 55 deletions.
248 changes: 238 additions & 10 deletions shared/constants/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,61 @@ export const CHAIN_IDS = {
CRONOS: '0x19',
GNOSIS: '0x64',
ZKSYNC_ERA: '0x144',
TEST_ETH: '0x539',
} as const;

const CHAINLIST_CHAIN_IDS_MAP = {
...CHAIN_IDS,
SCROLL: '0x82750',
ZORA_MAINNET: '0x76adf1',
TAIKO_JOLNIR_L2_MAINNET: '0x28c5f',
POLYGON_ZKEVM: '0x44d',
FANTOM_OPERA: '0xfa',
CELO_MAINNET: '0xa4ec',
ARBITRUM_NOVA: '0xa4ba',
MANTLE: '0x1388',
CORE_BLOCKCHAIN_MAINNET: '0x45c',
MANTA_PACIFIC_MAINNET: '0xa9',
PULSECHAIN_MAINNET: '0x171',
FUSE_GOLD_MAINNET: '0x7a',
KAVA_EVM: '0x8ae',
DFK_CHAIN: '0xd2af',
HARMONY_MAINNET_SHARD_0: '0x63564c40',
PGN_PUBLIC_GOODS_NETWORK: '0x1a8',
LIGHTLINK_PHOENIX_MAINNET: '0x762',
NEAR_AURORA_MAINNET: '0x4e454152',
KROMA_MAINNET: '0xff',
NEBULA_MAINNET: '0x585eb4b1',
KLAYTN_MAINNET_CYPRESS: '0x2019',
ENDURANCE_SMART_CHAIN_MAINNET: '0x288',
CRONOS_MAINNET_BETA: '0x19',
FLARE_MAINNET: '0xe',
KCC_MAINNET: '0x141',
SHARDEUM_SPHINX_1X: '0x1f92',
ETHEREUM_CLASSIC_MAINNET: '0x3d',
HAQQ_NETWORK: '0x2be3',
SHARDEUM_LIBERTY_2X: '0x1f91',
BLACKFORT_EXCHANGE_NETWORK: '0x1387',
CONFLUX_ESPACE: '0x406',
FUSE_MAINNET: '0x7a',
CANTO: '0x1e14',
SHIB_MAINNET: '0x1b',
OKXCHAIN_MAINNET: '0x42',
ZKATANA: '0x133e40',
DEXALOT_SUBNET: '0x6984c',
ASTAR: '0x250',
EVMOS: '0x2329',
BAHAMUT_MAINNET: '0x142d',
SONGBIRD_CANARY_NETWORK: '0x13',
STEP_NETWORK: '0x4d2',
VELAS_EVM_MAINNET: '0x6a',
Q_MAINNET: '0x8a71',
TELOS_EVM_MAINNET: '0x28',
TENET: '0x617',
DOGECHAIN_MAINNET: '0x7d0',
OASYS_MAINNET: '0xf8',
HUOBI_ECO_CHAIN_MAINNET: '0x80',
ACALA_NETWORK: '0x313',
} as const;

/**
Expand Down Expand Up @@ -218,13 +273,72 @@ export const CURRENCY_SYMBOLS = {
USDC: 'USDC',
USDT: 'USDT',
WETH: 'WETH',
OPTIMISM: 'OP',
OPTIMISM: 'ETH',
CRONOS: 'CRO',
GLIMMER: 'GLMR',
MOONRIVER: 'MOVR',
ONE: 'ONE',
} as const;

const CHAINLIST_CURRENCY_SYMBOLS_MAP = {
...CURRENCY_SYMBOLS,
BASE: 'ETH',
LINEA_MAINNET: 'ETH',
OPBNB: 'BNB',
ZKSYNC_ERA: 'ETH',
SCROLL: 'ETH',
ZORA_MAINNET: 'ETH',
TAIKO_JOLNIR_L2_MAINNET: 'ETH',
POLYGON_ZKEVM: 'ETH',
FANTOM_OPERA: 'FTM',
CELO_MAINNET: 'CELO',
ARBITRUM_NOVA: 'ETH',
MANTLE: 'MNT',
CORE_BLOCKCHAIN_MAINNET: 'CORE',
MANTA_PACIFIC_MAINNET: 'ETH',
PULSECHAIN_MAINNET: 'PLS',
MOONBEAM: 'GLMR',
FUSE_GOLD_MAINNET: 'FUSE',
KAVA_EVM: 'KAVA',
DFK_CHAIN: 'JEWEL',
HARMONY_MAINNET_SHARD_0: 'ONE',
PGN_PUBLIC_GOODS_NETWORK: 'ETH',
LIGHTLINK_PHOENIX_MAINNET: 'ETH',
NEAR_AURORA_MAINNET: 'ETH',
KROMA_MAINNET: 'ETH',
NEBULA_MAINNET: 'sFUEL',
KLAYTN_MAINNET_CYPRESS: 'KLAY',
ENDURANCE_SMART_CHAIN_MAINNET: 'ACE',
CRONOS_MAINNET_BETA: 'CRO',
FLARE_MAINNET: 'FLR',
KCC_MAINNET: 'KCS',
SHARDEUM_SPHINX_1X: 'SHM',
ETHEREUM_CLASSIC_MAINNET: 'ETC',
HAQQ_NETWORK: 'ISLM',
SHARDEUM_LIBERTY_2X: 'SHM',
BLACKFORT_EXCHANGE_NETWORK: 'BXN',
CONFLUX_ESPACE: 'CFX',
FUSE_MAINNET: 'FUSE',
CANTO: 'CANTO',
SHIB_MAINNET: 'SHIB',
OKXCHAIN_MAINNET: 'OKT',
ZKATANA: 'ETH',
DEXALOT_SUBNET: 'ALOT',
ASTAR: 'ASTR',
EVMOS: 'EVMOS',
BAHAMUT_MAINNET: 'FTN',
SONGBIRD_CANARY_NETWORK: 'SGB',
STEP_NETWORK: 'FITFI',
VELAS_EVM_MAINNET: 'VLX',
Q_MAINNET: 'Q',
TELOS_EVM_MAINNET: 'TLOS',
TENET: 'TENET',
DOGECHAIN_MAINNET: 'DOGE',
OASYS_MAINNET: 'OAS',
HUOBI_ECO_CHAIN_MAINNET: 'HT',
ACALA_NETWORK: 'ACA',
} as const;

export const ETH_TOKEN_IMAGE_URL = './images/eth_logo.png';
export const LINEA_GOERLI_TOKEN_IMAGE_URL = './images/linea-logo-testnet.png';
export const LINEA_MAINNET_TOKEN_IMAGE_URL = './images/linea-logo-mainnet.png';
Expand Down Expand Up @@ -343,6 +457,120 @@ export const NETWORK_TO_NAME_MAP = {
[CHAIN_IDS.LOCALHOST]: LOCALHOST_DISPLAY_NAME,
} as const;

export const CHAIN_ID_TO_CURRENCY_SYMBOL_MAP = {
[CHAINLIST_CHAIN_IDS_MAP.AVALANCHE]: CHAINLIST_CURRENCY_SYMBOLS_MAP.AVALANCHE,
[CHAINLIST_CHAIN_IDS_MAP.BSC]: CHAINLIST_CURRENCY_SYMBOLS_MAP.BNB,
[CHAINLIST_CHAIN_IDS_MAP.BASE]: CHAINLIST_CURRENCY_SYMBOLS_MAP.BASE,
[CHAINLIST_CHAIN_IDS_MAP.ARBITRUM]: CHAINLIST_CURRENCY_SYMBOLS_MAP.ARBITRUM,
[CHAINLIST_CHAIN_IDS_MAP.LINEA_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.LINEA_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.MAINNET]: CHAINLIST_CURRENCY_SYMBOLS_MAP.ETH,
[CHAINLIST_CHAIN_IDS_MAP.OPBNB]: CHAINLIST_CURRENCY_SYMBOLS_MAP.OPBNB,
[CHAINLIST_CHAIN_IDS_MAP.OPTIMISM]: CHAINLIST_CURRENCY_SYMBOLS_MAP.OPTIMISM,
[CHAINLIST_CHAIN_IDS_MAP.POLYGON]: CHAINLIST_CURRENCY_SYMBOLS_MAP.MATIC,
[CHAINLIST_CHAIN_IDS_MAP.ZKSYNC_ERA]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.ZKSYNC_ERA,
[CHAINLIST_CHAIN_IDS_MAP.GOERLI]:
TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.GOERLI],
[CHAINLIST_CHAIN_IDS_MAP.SEPOLIA]:
TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.SEPOLIA],
[CHAINLIST_CHAIN_IDS_MAP.LINEA_GOERLI]:
TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_GOERLI],
[CHAINLIST_CHAIN_IDS_MAP.SCROLL]: CHAINLIST_CURRENCY_SYMBOLS_MAP.SCROLL,
[CHAINLIST_CHAIN_IDS_MAP.ZORA_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.ZORA_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.TAIKO_JOLNIR_L2_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.TAIKO_JOLNIR_L2_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.POLYGON_ZKEVM]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.POLYGON_ZKEVM,
[CHAINLIST_CHAIN_IDS_MAP.FANTOM_OPERA]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.FANTOM_OPERA,
[CHAINLIST_CHAIN_IDS_MAP.CELO_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.CELO_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.ARBITRUM_NOVA]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.ARBITRUM_NOVA,
[CHAINLIST_CHAIN_IDS_MAP.MANTLE]: CHAINLIST_CURRENCY_SYMBOLS_MAP.MANTLE,
[CHAINLIST_CHAIN_IDS_MAP.GNOSIS]: CHAINLIST_CURRENCY_SYMBOLS_MAP.GNOSIS,
[CHAINLIST_CHAIN_IDS_MAP.CORE_BLOCKCHAIN_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.CORE_BLOCKCHAIN_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.MANTA_PACIFIC_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.MANTA_PACIFIC_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.PULSECHAIN_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.PULSECHAIN_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.MOONBEAM]: CHAINLIST_CURRENCY_SYMBOLS_MAP.MOONBEAM,
[CHAINLIST_CHAIN_IDS_MAP.FUSE_GOLD_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.FUSE_GOLD_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.KAVA_EVM]: CHAINLIST_CURRENCY_SYMBOLS_MAP.KAVA_EVM,
[CHAINLIST_CHAIN_IDS_MAP.DFK_CHAIN]: CHAINLIST_CURRENCY_SYMBOLS_MAP.DFK_CHAIN,
[CHAINLIST_CHAIN_IDS_MAP.HARMONY_MAINNET_SHARD_0]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.HARMONY_MAINNET_SHARD_0,
[CHAINLIST_CHAIN_IDS_MAP.PGN_PUBLIC_GOODS_NETWORK]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.PGN_PUBLIC_GOODS_NETWORK,
[CHAINLIST_CHAIN_IDS_MAP.LIGHTLINK_PHOENIX_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.LIGHTLINK_PHOENIX_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.NEAR_AURORA_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.NEAR_AURORA_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.KROMA_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.KROMA_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.NEBULA_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.NEBULA_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.KLAYTN_MAINNET_CYPRESS]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.KLAYTN_MAINNET_CYPRESS,
[CHAINLIST_CHAIN_IDS_MAP.MOONRIVER]: CHAINLIST_CURRENCY_SYMBOLS_MAP.MOONRIVER,
[CHAINLIST_CHAIN_IDS_MAP.ENDURANCE_SMART_CHAIN_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.ENDURANCE_SMART_CHAIN_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.CRONOS_MAINNET_BETA]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.CRONOS_MAINNET_BETA,
[CHAINLIST_CHAIN_IDS_MAP.FLARE_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.FLARE_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.KCC_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.KCC_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.SHARDEUM_SPHINX_1X]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.SHARDEUM_SPHINX_1X,
[CHAINLIST_CHAIN_IDS_MAP.ETHEREUM_CLASSIC_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.ETHEREUM_CLASSIC_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.HAQQ_NETWORK]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.HAQQ_NETWORK,
[CHAINLIST_CHAIN_IDS_MAP.SHARDEUM_LIBERTY_2X]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.SHARDEUM_LIBERTY_2X,
[CHAINLIST_CHAIN_IDS_MAP.BLACKFORT_EXCHANGE_NETWORK]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.BLACKFORT_EXCHANGE_NETWORK,
[CHAINLIST_CHAIN_IDS_MAP.CONFLUX_ESPACE]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.CONFLUX_ESPACE,
[CHAINLIST_CHAIN_IDS_MAP.FUSE_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.FUSE_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.CANTO]: CHAINLIST_CURRENCY_SYMBOLS_MAP.CANTO,
[CHAINLIST_CHAIN_IDS_MAP.SHIB_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.SHIB_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.OKXCHAIN_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.OKXCHAIN_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.ZKATANA]: CHAINLIST_CURRENCY_SYMBOLS_MAP.ZKATANA,
[CHAINLIST_CHAIN_IDS_MAP.DEXALOT_SUBNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.DEXALOT_SUBNET,
[CHAINLIST_CHAIN_IDS_MAP.ASTAR]: CHAINLIST_CURRENCY_SYMBOLS_MAP.ASTAR,
[CHAINLIST_CHAIN_IDS_MAP.EVMOS]: CHAINLIST_CURRENCY_SYMBOLS_MAP.EVMOS,
[CHAINLIST_CHAIN_IDS_MAP.BAHAMUT_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.BAHAMUT_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.SONGBIRD_CANARY_NETWORK]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.SONGBIRD_CANARY_NETWORK,
[CHAINLIST_CHAIN_IDS_MAP.STEP_NETWORK]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.STEP_NETWORK,
[CHAINLIST_CHAIN_IDS_MAP.VELAS_EVM_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.VELAS_EVM_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.Q_MAINNET]: CHAINLIST_CURRENCY_SYMBOLS_MAP.Q_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.TELOS_EVM_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.TELOS_EVM_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.TENET]: CHAINLIST_CURRENCY_SYMBOLS_MAP.TENET,
[CHAINLIST_CHAIN_IDS_MAP.DOGECHAIN_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.DOGECHAIN_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.OASYS_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.OASYS_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.HUOBI_ECO_CHAIN_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.HUOBI_ECO_CHAIN_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.ACALA_NETWORK]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.ACALA_NETWORK,
} as const;

export const CHAIN_ID_TO_TYPE_MAP = {
[CHAIN_IDS.MAINNET]: NETWORK_TYPES.MAINNET,
[CHAIN_IDS.GOERLI]: NETWORK_TYPES.GOERLI,
Expand Down Expand Up @@ -385,15 +613,15 @@ export const CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP = {
[CHAIN_IDS.LINEA_MAINNET]: NETWORK_TYPES.LINEA_MAINNET,
} as const;

export const NATIVE_CURRENCY_TOKEN_IMAGE_MAP = {
[CURRENCY_SYMBOLS.ETH]: ETH_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.TEST_ETH]: TEST_ETH_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.BNB]: BNB_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.MATIC]: MATIC_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.AVALANCHE]: AVAX_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.OPTIMISM]: OPTIMISM_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.CELO]: CELO_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.GNOSIS]: GNOSIS_TOKEN_IMAGE_URL,
export const CHAIN_ID_TOKEN_IMAGE_MAP = {
[CHAIN_IDS.MAINNET]: ETH_TOKEN_IMAGE_URL,
[CHAIN_IDS.TEST_ETH]: TEST_ETH_TOKEN_IMAGE_URL,
[CHAIN_IDS.BSC]: BNB_TOKEN_IMAGE_URL,
[CHAIN_IDS.POLYGON]: MATIC_TOKEN_IMAGE_URL,
[CHAIN_IDS.AVALANCHE]: AVAX_TOKEN_IMAGE_URL,
[CHAIN_IDS.OPTIMISM]: OPTIMISM_TOKEN_IMAGE_URL,
[CHAIN_IDS.CELO]: CELO_TOKEN_IMAGE_URL,
[CHAIN_IDS.GNOSIS]: GNOSIS_TOKEN_IMAGE_URL,
} as const;

export const INFURA_BLOCKED_KEY = 'countryBlocked';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs 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-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
>
<img
alt="ETH logo"
class="mm-avatar-token__token-image"
src="./images/eth_logo.png"
/>
E
</div>
<div
class="mm-box mm-text mm-text--body-sm mm-text--text-align-end mm-box--color-text-alternative"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,7 @@ exports[`SendPage render renders correctly 1`] = `
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs 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-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
>
<img
alt="ETH logo"
class="mm-avatar-token__token-image"
src="./images/eth_logo.png"
/>
E
</div>
<div
class="mm-box mm-text mm-text--body-sm mm-text--text-align-end mm-box--color-text-alternative"
Expand Down Expand Up @@ -441,11 +437,7 @@ exports[`SendPage render renders correctly 1`] = `
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs 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-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
>
<img
alt="ETH logo"
class="mm-avatar-token__token-image"
src="./images/eth_logo.png"
/>
E
</div>
<div
class="mm-box mm-text mm-text--body-sm mm-text--text-align-end mm-box--color-text-alternative"
Expand Down Expand Up @@ -573,11 +565,7 @@ exports[`SendPage render renders correctly 1`] = `
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs 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-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
>
<img
alt="ETH logo"
class="mm-avatar-token__token-image"
src="./images/eth_logo.png"
/>
E
</div>
<div
class="mm-box mm-text mm-text--body-sm mm-text--text-align-end mm-box--color-text-alternative"
Expand Down Expand Up @@ -714,11 +702,7 @@ exports[`SendPage render renders correctly 1`] = `
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs 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-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
>
<img
alt="ETH logo"
class="mm-avatar-token__token-image"
src="./images/eth_logo.png"
/>
E
</div>
<div
class="mm-box mm-text mm-text--body-sm mm-text--text-align-end mm-box--color-text-alternative"
Expand Down Expand Up @@ -855,11 +839,7 @@ exports[`SendPage render renders correctly 1`] = `
<div
class="mm-box mm-text mm-avatar-base mm-avatar-base--size-xs mm-avatar-token mm-text--body-xs 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-alternative mm-box--rounded-full mm-box--border-color-border-default box--border-style-solid box--border-width-1"
>
<img
alt="ETH logo"
class="mm-avatar-token__token-image"
src="./images/eth_logo.png"
/>
E
</div>
<div
class="mm-box mm-text mm-text--body-sm mm-text--text-align-end mm-box--color-text-alternative"
Expand Down
9 changes: 4 additions & 5 deletions ui/hooks/useIsOriginalNativeTokenSymbol.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import fetchWithCache from '../../shared/lib/fetch-with-cache';
import { BUILT_IN_NETWORKS } from '../../shared/constants/network';
import { CHAIN_ID_TO_CURRENCY_SYMBOL_MAP } from '../../shared/constants/network';
import { DAY } from '../../shared/constants/time';
import { useSafeChainsListValidationSelector } from '../selectors';

Expand All @@ -18,10 +18,9 @@ export function useIsOriginalNativeTokenSymbol(chainId, ticker, type) {
return;
}

const matchedSymbolBuiltInNetwork =
BUILT_IN_NETWORKS[type]?.ticker ?? null;
if (matchedSymbolBuiltInNetwork) {
setIsOriginalNativeSymbol(matchedSymbolBuiltInNetwork === ticker);
const mappedCurrencySymbol = CHAIN_ID_TO_CURRENCY_SYMBOL_MAP[chainId];
if (mappedCurrencySymbol) {
setIsOriginalNativeSymbol(mappedCurrencySymbol === ticker);
return;
}

Expand Down
Loading

0 comments on commit 727e859

Please sign in to comment.