From e86232d3a7ca5847d5ad7839ecc7c81ef25499ae Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Thu, 11 Apr 2024 08:57:19 -0400 Subject: [PATCH] Group together subgraph properties in NetworkConfig --- src/components/pages/DaoHierarchy/useFetchNodes.tsx | 8 ++++---- src/hooks/DAO/loaders/useFractalGovernance.ts | 8 ++++---- src/hooks/DAO/loaders/useFractalNode.ts | 8 ++++---- src/hooks/DAO/loaders/useLoadDAONode.ts | 8 ++++---- src/providers/NetworkConfig/networks/base.ts | 8 +++++--- src/providers/NetworkConfig/networks/baseSepolia.ts | 8 +++++--- src/providers/NetworkConfig/networks/mainnet.ts | 8 +++++--- src/providers/NetworkConfig/networks/polygon.ts | 8 +++++--- src/providers/NetworkConfig/networks/sepolia.ts | 8 +++++--- src/types/network.ts | 8 +++++--- 10 files changed, 46 insertions(+), 34 deletions(-) diff --git a/src/components/pages/DaoHierarchy/useFetchNodes.tsx b/src/components/pages/DaoHierarchy/useFetchNodes.tsx index 21efb338c6..6d927a6be5 100644 --- a/src/components/pages/DaoHierarchy/useFetchNodes.tsx +++ b/src/components/pages/DaoHierarchy/useFetchNodes.tsx @@ -22,14 +22,14 @@ export function useFetchNodes(address?: string) { const safeAPI = useSafeAPI(); const { requestWithRetries } = useAsyncRetry(); - const { subgraphSpace, subgraphSlug, subgraphVersion } = useNetworkConfig(); + const { subgraph } = useNetworkConfig(); const { data, error } = useQuery(DAOQueryDocument, { variables: { daoAddress: address }, skip: address === safe?.address || !address, // If address === safe.address - we already have hierarchy obtained in the context context: { - subgraphSpace, - subgraphSlug, - subgraphVersion, + subgraphSpace: subgraph.space, + subgraphSlug: subgraph.slug, + subgraphVersion: subgraph.version, }, }); diff --git a/src/hooks/DAO/loaders/useFractalGovernance.ts b/src/hooks/DAO/loaders/useFractalGovernance.ts index 324ee149c9..76478d8099 100644 --- a/src/hooks/DAO/loaders/useFractalGovernance.ts +++ b/src/hooks/DAO/loaders/useFractalGovernance.ts @@ -35,7 +35,7 @@ export const useFractalGovernance = () => { const ONE_MINUTE = 60 * 1000; - const { subgraphSpace, subgraphSlug, subgraphVersion } = useNetworkConfig(); + const { subgraph } = useNetworkConfig(); useQuery(DAOQueryDocument, { variables: { daoAddress }, @@ -67,9 +67,9 @@ export const useFractalGovernance = () => { } }, context: { - subgraphSpace, - subgraphSlug, - subgraphVersion, + subgraphSpace: subgraph.space, + subgraphSlug: subgraph.slug, + subgraphVersion: subgraph.version, }, pollInterval: ONE_MINUTE, skip: !daoAddress || !type, diff --git a/src/hooks/DAO/loaders/useFractalNode.ts b/src/hooks/DAO/loaders/useFractalNode.ts index ddc087ee34..6d006ddf1c 100644 --- a/src/hooks/DAO/loaders/useFractalNode.ts +++ b/src/hooks/DAO/loaders/useFractalNode.ts @@ -57,7 +57,7 @@ export const useFractalNode = ( return; }, []); - const { subgraphSpace, subgraphSlug, subgraphVersion } = useNetworkConfig(); + const { subgraph } = useNetworkConfig(); useQuery(DAOQueryDocument, { variables: { daoAddress }, @@ -79,9 +79,9 @@ export const useFractalNode = ( } }, context: { - subgraphSpace, - subgraphSlug, - subgraphVersion, + subgraphSpace: subgraph.space, + subgraphSlug: subgraph.slug, + subgraphVersion: subgraph.version, }, pollInterval: ONE_MINUTE, }); diff --git a/src/hooks/DAO/loaders/useLoadDAONode.ts b/src/hooks/DAO/loaders/useLoadDAONode.ts index 46defc5818..ba5c53d35d 100644 --- a/src/hooks/DAO/loaders/useLoadDAONode.ts +++ b/src/hooks/DAO/loaders/useLoadDAONode.ts @@ -14,12 +14,12 @@ export const useLoadDAONode = () => { const safeAPI = useSafeAPI(); const { getDaoName } = useLazyDAOName(); const lookupModules = useFractalModules(); - const { subgraphSpace, subgraphSlug, subgraphVersion } = useNetworkConfig(); + const { subgraph } = useNetworkConfig(); const [getDAOInfo] = useLazyQuery(DAOQueryDocument, { context: { - subgraphSpace, - subgraphSlug, - subgraphVersion, + subgraphSpace: subgraph.space, + subgraphSlug: subgraph.slug, + subgraphVersion: subgraph.version, }, }); diff --git a/src/providers/NetworkConfig/networks/base.ts b/src/providers/NetworkConfig/networks/base.ts index 09bb35bb33..0edeb27bba 100644 --- a/src/providers/NetworkConfig/networks/base.ts +++ b/src/providers/NetworkConfig/networks/base.ts @@ -36,9 +36,11 @@ export const baseConfig: NetworkConfig = { nativeTokenSymbol: base.nativeCurrency.symbol, nativeTokenIcon: '/images/coin-icon-eth.svg', wagmiChain: base, - subgraphSpace: 71032, - subgraphSlug: 'fractal-base', - subgraphVersion: 'v0.0.1', + subgraph: { + space: 71032, + slug: 'fractal-base', + version: 'v0.0.1', + }, contracts: { fractalAzoriusMasterCopy: Azorius.address, fractalModuleMasterCopy: FractalModule.address, diff --git a/src/providers/NetworkConfig/networks/baseSepolia.ts b/src/providers/NetworkConfig/networks/baseSepolia.ts index 2f8baf0be2..6263538c3b 100644 --- a/src/providers/NetworkConfig/networks/baseSepolia.ts +++ b/src/providers/NetworkConfig/networks/baseSepolia.ts @@ -36,9 +36,11 @@ export const baseSepoliaConfig: NetworkConfig = { nativeTokenSymbol: baseSepolia.nativeCurrency.symbol, nativeTokenIcon: '/images/coin-icon-eth.svg', wagmiChain: baseSepolia, - subgraphSpace: 71032, - subgraphSlug: 'fractal-base-sepolia', - subgraphVersion: 'v0.0.1', + subgraph: { + space: 71032, + slug: 'fractal-base-sepolia', + version: 'v0.0.1', + }, contracts: { fractalAzoriusMasterCopy: Azorius.address, fractalModuleMasterCopy: FractalModule.address, diff --git a/src/providers/NetworkConfig/networks/mainnet.ts b/src/providers/NetworkConfig/networks/mainnet.ts index b93ab8c699..1c1ee5cd5c 100644 --- a/src/providers/NetworkConfig/networks/mainnet.ts +++ b/src/providers/NetworkConfig/networks/mainnet.ts @@ -36,9 +36,11 @@ export const mainnetConfig: NetworkConfig = { nativeTokenSymbol: mainnet.nativeCurrency.symbol, nativeTokenIcon: '/images/coin-icon-eth.svg', wagmiChain: mainnet, - subgraphSpace: 71032, - subgraphSlug: 'fractal-mainnet', - subgraphVersion: 'v0.0.1', + subgraph: { + space: 71032, + slug: 'fractal-mainnet', + version: 'v0.0.1', + }, contracts: { fractalAzoriusMasterCopy: Azorius.address, fractalModuleMasterCopy: FractalModule.address, diff --git a/src/providers/NetworkConfig/networks/polygon.ts b/src/providers/NetworkConfig/networks/polygon.ts index f15f889feb..20e033cf0b 100644 --- a/src/providers/NetworkConfig/networks/polygon.ts +++ b/src/providers/NetworkConfig/networks/polygon.ts @@ -36,9 +36,11 @@ export const polygonConfig: NetworkConfig = { nativeTokenSymbol: polygon.nativeCurrency.symbol, nativeTokenIcon: '/images/coin-icon-eth.svg', wagmiChain: polygon, - subgraphSpace: 71032, - subgraphSlug: 'fractal-base-polygon', - subgraphVersion: 'v0.0.1', + subgraph: { + space: 71032, + slug: 'fractal-base-polygon', + version: 'v0.0.1', + }, contracts: { fractalAzoriusMasterCopy: Azorius.address, fractalModuleMasterCopy: FractalModule.address, diff --git a/src/providers/NetworkConfig/networks/sepolia.ts b/src/providers/NetworkConfig/networks/sepolia.ts index 0afdae3d8b..a6b73a3ffa 100644 --- a/src/providers/NetworkConfig/networks/sepolia.ts +++ b/src/providers/NetworkConfig/networks/sepolia.ts @@ -36,9 +36,11 @@ export const sepoliaConfig: NetworkConfig = { nativeTokenSymbol: sepolia.nativeCurrency.symbol, nativeTokenIcon: '/images/coin-icon-eth.svg', wagmiChain: sepolia, - subgraphSpace: 71032, - subgraphSlug: 'fractal-sepolia', - subgraphVersion: 'v0.0.1', + subgraph: { + space: 71032, + slug: 'fractal-sepolia', + version: 'v0.0.1', + }, contracts: { fractalAzoriusMasterCopy: Azorius.address, fractalModuleMasterCopy: FractalModule.address, diff --git a/src/types/network.ts b/src/types/network.ts index 4d42c14d1d..1cbea60908 100644 --- a/src/types/network.ts +++ b/src/types/network.ts @@ -17,9 +17,11 @@ export type NetworkConfig = { nativeTokenSymbol: string; nativeTokenIcon: string; wagmiChain: Chain; - subgraphSpace: number; - subgraphSlug: string; - subgraphVersion: string; + subgraph: { + space: number; + slug: string; + version: string; + }; contracts: { safe: string; safeFactory: string;