Skip to content

Commit

Permalink
Merge pull request #503 from lidofinance/fix/wrong-network-banner
Browse files Browse the repository at this point in the history
fix: add testnet chain names in 'wrong network' banner
  • Loading branch information
jake4take authored Oct 9, 2024
2 parents df3a9c7 + 21353ba commit b6233ca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions features/wsteth/shared/wallet/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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 <Fallback error={error} {...props} />;
}

Expand Down

0 comments on commit b6233ca

Please sign in to comment.