From 21353baa1dcd97e1addfd925c8190bf97f8dcf2a Mon Sep 17 00:00:00 2001 From: Anton Shalimov Date: Wed, 9 Oct 2024 18:56:40 +0300 Subject: [PATCH] fix: add testnet chain names in 'wrong network' banner --- features/wsteth/shared/wallet/wallet.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/features/wsteth/shared/wallet/wallet.tsx b/features/wsteth/shared/wallet/wallet.tsx index 35e69f45..f710c4cd 100644 --- a/features/wsteth/shared/wallet/wallet.tsx +++ b/features/wsteth/shared/wallet/wallet.tsx @@ -5,6 +5,8 @@ import { useConnectorInfo } from 'reef-knot/core-react'; import { Divider, Text } from '@lidofinance/lido-ui'; import { useSDK } from '@lido-sdk/react'; +import { config } from 'config'; +import { CHAINS } from 'consts/chains'; import { FormatToken } from 'shared/formatters'; import { TokenToWallet } from 'shared/components'; import { useWstethBySteth, useStethByWsteth } from 'shared/hooks'; @@ -23,7 +25,7 @@ import { useStethBalance, useWstethBalance, } from 'shared/hooks/use-balance'; -import { OPTIMISM, ETHEREUM, useDappChain } from 'providers/dapp-chain'; +import { OPTIMISM, useDappChain } from 'providers/dapp-chain'; import { capitalizeFirstLetter } from 'utils/capitalize-string'; import { StyledCard } from './styles'; @@ -150,7 +152,11 @@ export const Wallet: WalletComponentType = memo((props) => { } if (isDappActive && !isMatchDappChainAndWalletChain(chainId)) { - const error = `Wrong network. Please switch to ${chainName === OPTIMISM ? capitalizeFirstLetter(OPTIMISM) : capitalizeFirstLetter(ETHEREUM)} in your wallet to wrap/unwrap.`; + const switchToOptimism = + config.supportedChains.indexOf(CHAINS.Optimism) > -1 + ? capitalizeFirstLetter(OPTIMISM) + : 'Optimism Sepolia'; + const error = `Wrong network. Please switch to ${chainName === OPTIMISM ? switchToOptimism : capitalizeFirstLetter(CHAINS[config.defaultChain])} in your wallet to wrap/unwrap.`; return ; }