From 403bf0ba09bbfeedf42dfa40e7f27711ee7a5505 Mon Sep 17 00:00:00 2001 From: welliton gervickas Date: Tue, 28 Nov 2023 09:34:09 -0300 Subject: [PATCH] feat: adding new chain --- app/config/chains.ts | 27 ++++++++++++++++++- app/config/config.ts | 4 +-- .../thegraph/entities/app/hooks/useGetApps.ts | 16 ++++++++--- public/assets/images/chains/420.svg | 10 +++++++ 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 public/assets/images/chains/420.svg diff --git a/app/config/chains.ts b/app/config/chains.ts index 334f344..b672296 100644 --- a/app/config/chains.ts +++ b/app/config/chains.ts @@ -1,4 +1,4 @@ -import { avalancheFuji } from 'wagmi/chains' +import { avalancheFuji, optimismGoerli } from 'wagmi/chains' import { merge } from 'lodash' import { Chain } from './types' @@ -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 + } + } +}) diff --git a/app/config/config.ts b/app/config/config.ts index d40dd28..935fd2b 100644 --- a/app/config/config.ts +++ b/app/config/config.ts @@ -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, diff --git a/app/headless/thegraph/entities/app/hooks/useGetApps.ts b/app/headless/thegraph/entities/app/hooks/useGetApps.ts index 8bc1f1a..72bd324 100644 --- a/app/headless/thegraph/entities/app/hooks/useGetApps.ts +++ b/app/headless/thegraph/entities/app/hooks/useGetApps.ts @@ -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[] @@ -11,11 +12,18 @@ type UseGetAppsProps = { } export function useGetApps({ chainId }: UseGetAppsProps) { - const { loading, data } = useQuery(HUB_APP_ADDEDS_QUERY, { - context: { - chainId + const { loading, data, refetch } = useQuery( + HUB_APP_ADDEDS_QUERY, + { + context: { + chainId + } } - }) + ) + + useEffect(() => { + refetch() + }, [chainId]) return { apps: data?.hubAppAddeds || [], diff --git a/public/assets/images/chains/420.svg b/public/assets/images/chains/420.svg new file mode 100644 index 0000000..c3b8707 --- /dev/null +++ b/public/assets/images/chains/420.svg @@ -0,0 +1,10 @@ + + + \ No newline at end of file