From a3c9b81975dc602b9c1171447bae006cfe06e74e Mon Sep 17 00:00:00 2001 From: storywithoutend Date: Fri, 8 Nov 2024 17:45:01 +0800 Subject: [PATCH] add chain info --- src/constants/chains.ts | 42 +++++++++++++++++++ src/hooks/ensjs/subgraph/useSubgraphClient.ts | 1 + .../gasEstimation/useEstimateRegistration.ts | 2 + src/pages/index.tsx | 3 ++ src/utils/query/wagmi.ts | 11 ++++- 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/constants/chains.ts b/src/constants/chains.ts index 3be53d40e..64beb58e2 100644 --- a/src/constants/chains.ts +++ b/src/constants/chains.ts @@ -1,3 +1,4 @@ +import type { Chain } from 'viem' import { holesky } from 'viem/chains' import { goerli, localhost, mainnet, sepolia } from 'wagmi/chains' @@ -29,12 +30,52 @@ export const goerliWithEns = addEnsContracts(goerli) export const sepoliaWithEns = addEnsContracts(sepolia) export const holeskyWithEns = addEnsContracts(holesky) +console.log('sepoliawithens', sepoliaWithEns) + +export const odysseyWithEns = { + id: 911_867, + name: 'Odyssey', + nativeCurrency: { + decimals: 18, + name: 'Conduit', + symbol: 'CON', + }, + rpcUrls: { + public: { http: ['https://odyssey.ithaca.xyz'] }, + default: { http: ['https://odyssey.ithaca.xyz'] }, + }, + blockExplorers: { + odysseyExplorer: { name: 'Odyssey Explorer', url: 'https://odyssey-explorer.ithaca.xyz' }, + default: { name: 'Odyssey Explorer', url: 'https://odyssey-explorer.ithaca.xyz' }, + }, + contracts: { + ensBaseRegistrarImplementation: { address: '0x017845E4518dB01EFCAFd7Acb192aF924B432d66' }, + ensBulkRenewal: { address: '0x432C01F19D7517Ac2d4328d75e6c16B2704DE011' }, + ensDnsRegistrar: { address: '0xfdF30e5E06d728704A42bac6E0326538E659a67B' }, + ensDnssecImpl: { address: '0xDD8f96E422681e7ea04b46b0151A5b9043348fF1' }, + ensEthRegistrarController: { address: '0x2D6e4FDbC2CF9422CEa8fA79c4b6AC517D32cd18' }, + ensNameWrapper: { address: '0x300238a6aFeE3a6e6DCD278c244b5064AC4Fc729' }, + ensPublicResolver: { address: '0x9F3C37A6cDd5ECA7b27140856753EDBF387c06bB' }, + ensRegistry: { address: '0x0e8DA38565915B7e74e2d78F80ba1BF815F34116' }, + ensReverseRegistrar: { address: '0x3d6BBfDCe5C484D9177F3a7d30e3bfe7Add5051E' }, + ensUniversalResolver: { address: '0xE00739Fc93e27aBf44343fD5FAA151c67C0A0Aa3' }, + multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 751532 }, + }, + subgraphs: { + ens: { + url: 'https://api.thegraph.com/subgraphs/name/ensdomains/ens', + }, + }, + testnet: true, +} as const satisfies Chain + export const chainsWithEns = [ mainnetWithEns, goerliWithEns, sepoliaWithEns, holeskyWithEns, localhostWithEns, + odysseyWithEns, ] as const export const getSupportedChainById = (chainId: number | undefined) => @@ -46,3 +87,4 @@ export type SupportedChain = | typeof sepoliaWithEns | typeof holeskyWithEns | typeof localhostWithEns + | typeof odysseyWithEns diff --git a/src/hooks/ensjs/subgraph/useSubgraphClient.ts b/src/hooks/ensjs/subgraph/useSubgraphClient.ts index 6d5ee2287..8802bf40e 100644 --- a/src/hooks/ensjs/subgraph/useSubgraphClient.ts +++ b/src/hooks/ensjs/subgraph/useSubgraphClient.ts @@ -5,6 +5,7 @@ import { createSubgraphClient } from '@ensdomains/ensjs/subgraph' export const useSubgraphClient = () => { const client = useClient() + console.log('client', client) // eslint-disable-next-line react-hooks/exhaustive-deps return useMemo(() => createSubgraphClient({ client }), [client.chain.id]) } diff --git a/src/hooks/gasEstimation/useEstimateRegistration.ts b/src/hooks/gasEstimation/useEstimateRegistration.ts index 3d969e678..6a287e7b9 100644 --- a/src/hooks/gasEstimation/useEstimateRegistration.ts +++ b/src/hooks/gasEstimation/useEstimateRegistration.ts @@ -84,6 +84,8 @@ export const useEstimateFullRegistration = ({ enabled: !!ethRegistrarControllerAddress && !!price, }) + console.log('data', data, isLoading) + const premiumFee = price?.premium const hasPremium = !!premiumFee && premiumFee > 0n const yearlyFee = price?.base diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 77fccae3c..51befe7a5 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,6 +1,7 @@ import Head from 'next/head' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' +import { useChainId } from 'wagmi' import { mq, Typography } from '@ensdomains/thorin' @@ -93,6 +94,8 @@ export default function Page() { const { dialogProps } = useVerificationOAuthHandler() + const chain = useChainId() + console.log(chain) return ( <> diff --git a/src/utils/query/wagmi.ts b/src/utils/query/wagmi.ts index 4799fefbc..8eaad9f1f 100644 --- a/src/utils/query/wagmi.ts +++ b/src/utils/query/wagmi.ts @@ -1,4 +1,10 @@ -import { createClient, type FallbackTransport, type HttpTransport, type Transport } from 'viem' +import { + Chain, + createClient, + type FallbackTransport, + type HttpTransport, + type Transport, +} from 'viem' import { createConfig, createStorage, fallback, http } from 'wagmi' import { goerli, holesky, localhost, mainnet, sepolia } from 'wagmi/chains' @@ -9,6 +15,7 @@ import { holeskyWithEns, localhostWithEns, mainnetWithEns, + odysseyWithEns, sepoliaWithEns, } from '@app/constants/chains' @@ -86,6 +93,7 @@ const chains = [ goerliWithEns, sepoliaWithEns, holeskyWithEns, + odysseyWithEns, ] as const const transports = { @@ -101,6 +109,7 @@ const transports = { [sepolia.id]: initialiseTransports('sepolia', [infuraUrl, cloudflareUrl, tenderlyUrl]), [goerli.id]: initialiseTransports('goerli', [infuraUrl, cloudflareUrl, tenderlyUrl]), [holesky.id]: initialiseTransports('holesky', [tenderlyUrl]), + [odysseyWithEns.id]: http(odysseyWithEns.rpcUrls.default.http[0]), } as const const wagmiConfig_ = createConfig({