diff --git a/src/components/Dropdown/ChainType/index.tsx b/src/components/Dropdown/ChainType/index.tsx index 1e9047a7c..36a3a52f8 100644 --- a/src/components/Dropdown/ChainType/index.tsx +++ b/src/components/Dropdown/ChainType/index.tsx @@ -1,6 +1,6 @@ import { ChainTypePanel } from './styled' import SimpleButton from '../../SimpleButton' -import { IS_MAINNET, MAINNET_URL, TESTNET_URL } from '../../../constants/common' +import { ChainName, IS_MAINNET, MAINNET_URL, TESTNET_URL } from '../../../constants/common' export default ({ setShow, left, top }: { setShow: Function; left: number; top: number }) => { const hideDropdown = () => { @@ -10,11 +10,11 @@ export default ({ setShow, left, top }: { setShow: Function; left: number; top: return ( - mainnet + {`${ChainName.Mainnet} Mainnet`}
- testnet + {`${ChainName.Testnet} Testnet`} ) diff --git a/src/components/Header/BlockchainComp/index.tsx b/src/components/Header/BlockchainComp/index.tsx index 60d8c44cb..00503ce45 100644 --- a/src/components/Header/BlockchainComp/index.tsx +++ b/src/components/Header/BlockchainComp/index.tsx @@ -7,7 +7,7 @@ import GreenDropUpIcon from '../../../assets/green_drop_up.png' import { HeaderBlockchainPanel, MobileSubMenuPanel } from './styled' import SimpleButton from '../../SimpleButton' import ChainDropdown from '../../Dropdown/ChainType' -import { MAINNET_URL, ONE_DAY_MILLISECOND, TESTNET_URL } from '../../../constants/common' +import { ChainName, MAINNET_URL, ONE_DAY_MILLISECOND, TESTNET_URL } from '../../../constants/common' import { explorerService } from '../../../services/ExplorerService' import { cacheService } from '../../../services/CacheService' import { useChainName } from '../../../hooks/useCKBNode' @@ -108,10 +108,10 @@ const BlockchainMenu: FC<{ nodeVersion: string }> = ({ nodeVersion }) => { {showSubMenu && ( <> - mainnet + {`${ChainName.Mainnet} Mainnet`} - testnet + {`${ChainName.Testnet} Testnet`} )} diff --git a/src/constants/common.ts b/src/constants/common.ts index ccadbbcc5..7c5fdafaf 100644 --- a/src/constants/common.ts +++ b/src/constants/common.ts @@ -150,14 +150,7 @@ export type ChartColorConfig = typeof ChartColor export enum ChainName { Mainnet = 'mirana', - Testnet = 'pudge', -} - -export const CKB2023 = { - // https://github.com/nervosnetwork/ckb/pull/4665/files#diff-c8efd953833c9bb20a6c41b66cfb4823e87e072aa1a3bde2c9b5f62c0ea847d9R14 - TESTNET_EPOCH: 9690, - // https://github.com/nervosnetwork/rfcs/blob/3a6ae4fa5d59b6e33fa7bd563d336706d135c0d8/rfcs/0053-ckb-hardfork/0053-ckb-hardfork.md#naming-convention - CHAIN_NAME: 'MEEPO', + Testnet = 'meepo', } export enum LayoutLiteProfessional { diff --git a/src/hooks/useCKBNode.tsx b/src/hooks/useCKBNode.tsx index f68396a26..841e8ff43 100644 --- a/src/hooks/useCKBNode.tsx +++ b/src/hooks/useCKBNode.tsx @@ -2,8 +2,7 @@ import { useContext, createContext, useState, PropsWithChildren } from 'react' import { useTranslation } from 'react-i18next' import { isMainnet } from '../utils/chain' import { NodeService } from '../services/NodeService' -import { useStatistics } from '../services/ExplorerService' -import { ChainName, CKB2023, IS_MAINNET } from '../constants/common' +import { ChainName, IS_MAINNET } from '../constants/common' const NODE_CONNECT_MODE_KEY = 'node_connect_mode' const NODE_CONNECTED_ENDPOINT = 'node_connected_endpoint' @@ -136,11 +135,13 @@ export const CKBNodeProvider = ({ children, defaultEndpoint }: PropsWithChildren } export function useChainName() { - const statistics = useStatistics() if (IS_MAINNET) return `${ChainName.Mainnet} Mainnet` - if (!+statistics.epochInfo.epochNumber) return 'Testnet' + return `${ChainName.Testnet} Testnet` - const chainName = +statistics.epochInfo.epochNumber >= CKB2023.TESTNET_EPOCH ? CKB2023.CHAIN_NAME : ChainName.Testnet - return `${chainName} Testnet` + /* Enable the following logic when next hardfork is being activated */ + // if (!+statistics.epochInfo.epochNumber) return 'Testnet' + + // const chainName = +statistics.epochInfo.epochNumber >= CKB2023.TESTNET_EPOCH ? CKB2023.CHAIN_NAME : ChainName.Testnet + // return `${chainName} Testnet` }