Skip to content

Commit

Permalink
feat: adding new chain
Browse files Browse the repository at this point in the history
  • Loading branch information
wellitongervickas committed Nov 28, 2023
1 parent cfd68a6 commit 403bf0b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 7 deletions.
27 changes: 26 additions & 1 deletion app/config/chains.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { avalancheFuji } from 'wagmi/chains'
import { avalancheFuji, optimismGoerli } from 'wagmi/chains'
import { merge } from 'lodash'
import { Chain } from './types'

Expand Down Expand Up @@ -26,3 +26,28 @@ export const avalancheFujiChain: Chain = merge(avalancheFuji, {
}
}
})

export const optimismGoerliChain: Chain = merge(optimismGoerli, {
blockExplorers: {
thegraph: {
name: 'crosschain-nft-ccip-v2-optimis',
url: process.env.NEXT_PUBLIC_NETWORK_420_SUBGRAPH!
}
},
rpcUrls: {
protocol: {
http: [process.env.NEXT_PUBLIC_NETWORK_420_HTTP_RPC!],
websocket: [process.env.NEXT_PUBLIC_NETWORK_420_WS_RPC!]
}
},
contracts: {
accessManagement: {
address: '0x0077124A6913476D37405E46fb41F1AA7ce255D7',
blockCreated: 0
},
hub: {
address: '0x747bC054Da9C824eC9f10D5DCEe0D8FA3BecDc38',
blockCreated: 0
}
}
})
4 changes: 2 additions & 2 deletions app/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { reduce } from 'lodash'
import { avalancheFujiChain } from './chains'
import { avalancheFujiChain, optimismGoerliChain } from './chains'
import { Chain } from './types'

export const allowedChains = [avalancheFujiChain]
export const allowedChains = [avalancheFujiChain, optimismGoerliChain]

export const allowedChainsConfig = reduce(
allowedChains,
Expand Down
16 changes: 12 additions & 4 deletions app/headless/thegraph/entities/app/hooks/useGetApps.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from '@apollo/client'
import { IHubAppAddeds } from '../types'
import { HUB_APP_ADDEDS_QUERY } from '../queries'
import { useEffect } from 'react'

export type UseGetAppsResponse = {
hubAppAddeds: IHubAppAddeds[]
Expand All @@ -11,11 +12,18 @@ type UseGetAppsProps = {
}

export function useGetApps({ chainId }: UseGetAppsProps) {
const { loading, data } = useQuery<UseGetAppsResponse>(HUB_APP_ADDEDS_QUERY, {
context: {
chainId
const { loading, data, refetch } = useQuery<UseGetAppsResponse>(
HUB_APP_ADDEDS_QUERY,
{
context: {
chainId
}
}
})
)

useEffect(() => {
refetch()
}, [chainId])

return {
apps: data?.hubAppAddeds || [],
Expand Down
10 changes: 10 additions & 0 deletions public/assets/images/chains/420.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 403bf0b

Please sign in to comment.