From e45265ac711b6ba837099fe300ca20f6955cd6d1 Mon Sep 17 00:00:00 2001 From: Art Date: Tue, 3 Jan 2023 23:54:54 +0100 Subject: [PATCH] chore: chain id to name (714) (#2503) --- .../src/app/components/web3-connector/web3-connector.tsx | 4 ++-- .../src/components/web3-connector/web3-connector.tsx | 4 ++-- libs/deposits/src/lib/deposit-form.tsx | 4 ++-- libs/web3/src/lib/constants.ts | 5 +++++ libs/web3/src/lib/web3-container.spec.tsx | 8 ++++---- libs/web3/src/lib/web3-container.tsx | 3 ++- libs/withdraws/src/lib/withdrawal-feedback.tsx | 4 ++-- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/apps/multisig-signer/src/app/components/web3-connector/web3-connector.tsx b/apps/multisig-signer/src/app/components/web3-connector/web3-connector.tsx index 7e71b0d54..d02e3ead1 100644 --- a/apps/multisig-signer/src/app/components/web3-connector/web3-connector.tsx +++ b/apps/multisig-signer/src/app/components/web3-connector/web3-connector.tsx @@ -1,5 +1,5 @@ import { useEnvironment } from '@vegaprotocol/environment'; -import { useEthereumConfig } from '@vegaprotocol/web3'; +import { getChainName, useEthereumConfig } from '@vegaprotocol/web3'; import { Button, Splash, AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { Web3ConnectDialog } from '@vegaprotocol/web3'; import { useWeb3React } from '@web3-react/core'; @@ -82,7 +82,7 @@ export const Web3Content = ({

- This app only works on chain ID: {appChainId} + This app only works on {getChainName(appChainId)}

diff --git a/apps/token/src/components/web3-connector/web3-connector.tsx b/apps/token/src/components/web3-connector/web3-connector.tsx index 8d1bd2321..9a8f60a99 100644 --- a/apps/token/src/components/web3-connector/web3-connector.tsx +++ b/apps/token/src/components/web3-connector/web3-connector.tsx @@ -1,5 +1,5 @@ import { Button, Splash } from '@vegaprotocol/ui-toolkit'; -import { Web3ConnectDialog } from '@vegaprotocol/web3'; +import { getChainName, Web3ConnectDialog } from '@vegaprotocol/web3'; import { useWeb3React } from '@web3-react/core'; import type { ReactElement } from 'react'; import { useCallback, useEffect } from 'react'; @@ -78,7 +78,7 @@ export const Web3Content = ({ children, appChainId }: Web3ContentProps) => {

- This app only works on chain ID: {appChainId} + This app only works on {getChainName(appChainId)}

diff --git a/libs/deposits/src/lib/deposit-form.tsx b/libs/deposits/src/lib/deposit-form.tsx index aee2a66b8..8ed50201b 100644 --- a/libs/deposits/src/lib/deposit-form.tsx +++ b/libs/deposits/src/lib/deposit-form.tsx @@ -29,7 +29,7 @@ import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { ETHEREUM_EAGER_CONNECT, useWeb3ConnectStore, - ChainIdMap, + getChainName, } from '@vegaprotocol/web3'; interface FormFields { @@ -323,7 +323,7 @@ const FormButton = ({ ); } else if (chainId !== desiredChainId) { console.log(chainId, desiredChainId); - const chainName = desiredChainId ? ChainIdMap[desiredChainId] : 'Unknown'; + const chainName = getChainName(desiredChainId); message = t(`This app only works on ${chainName}.`); button = (