Skip to content

Commit

Permalink
add chain info
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Nov 8, 2024
1 parent 36e6041 commit a3c9b81
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/constants/chains.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Chain } from 'viem'
import { holesky } from 'viem/chains'
import { goerli, localhost, mainnet, sepolia } from 'wagmi/chains'

Expand Down Expand Up @@ -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) =>
Expand All @@ -46,3 +87,4 @@ export type SupportedChain =
| typeof sepoliaWithEns
| typeof holeskyWithEns
| typeof localhostWithEns
| typeof odysseyWithEns
1 change: 1 addition & 0 deletions src/hooks/ensjs/subgraph/useSubgraphClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
2 changes: 2 additions & 0 deletions src/hooks/gasEstimation/useEstimateRegistration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -93,6 +94,8 @@ export default function Page() {

const { dialogProps } = useVerificationOAuthHandler()

const chain = useChainId()
console.log(chain)
return (
<>
<Head>
Expand Down
11 changes: 10 additions & 1 deletion src/utils/query/wagmi.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -9,6 +15,7 @@ import {
holeskyWithEns,
localhostWithEns,
mainnetWithEns,
odysseyWithEns,
sepoliaWithEns,
} from '@app/constants/chains'

Expand Down Expand Up @@ -86,6 +93,7 @@ const chains = [
goerliWithEns,
sepoliaWithEns,
holeskyWithEns,
odysseyWithEns,
] as const

const transports = {
Expand All @@ -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({
Expand Down

0 comments on commit a3c9b81

Please sign in to comment.