Skip to content

Commit

Permalink
Group together subgraph properties in NetworkConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Apr 11, 2024
1 parent 4d95501 commit e86232d
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 34 deletions.
8 changes: 4 additions & 4 deletions src/components/pages/DaoHierarchy/useFetchNodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});

Expand Down
8 changes: 4 additions & 4 deletions src/hooks/DAO/loaders/useFractalGovernance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useFractalGovernance = () => {

const ONE_MINUTE = 60 * 1000;

const { subgraphSpace, subgraphSlug, subgraphVersion } = useNetworkConfig();
const { subgraph } = useNetworkConfig();

useQuery(DAOQueryDocument, {
variables: { daoAddress },
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/DAO/loaders/useFractalNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const useFractalNode = (
return;
}, []);

const { subgraphSpace, subgraphSlug, subgraphVersion } = useNetworkConfig();
const { subgraph } = useNetworkConfig();

useQuery(DAOQueryDocument, {
variables: { daoAddress },
Expand All @@ -79,9 +79,9 @@ export const useFractalNode = (
}
},
context: {
subgraphSpace,
subgraphSlug,
subgraphVersion,
subgraphSpace: subgraph.space,
subgraphSlug: subgraph.slug,
subgraphVersion: subgraph.version,
},
pollInterval: ONE_MINUTE,
});
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/DAO/loaders/useLoadDAONode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});

Expand Down
8 changes: 5 additions & 3 deletions src/providers/NetworkConfig/networks/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/providers/NetworkConfig/networks/baseSepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/providers/NetworkConfig/networks/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/providers/NetworkConfig/networks/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/providers/NetworkConfig/networks/sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/types/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e86232d

Please sign in to comment.