diff --git a/apps/subgraph/README.md b/apps/subgraph/README.md index 72e117a7..f88fc352 100644 --- a/apps/subgraph/README.md +++ b/apps/subgraph/README.md @@ -81,11 +81,11 @@ You can now query the subgraph in the Goldsky GraphQL playground to test your ch The subgraph is currently deployed to the following networks: -- [Ethereum](https://api.goldsky.com/api/public//subgraphs/nouns-builder-ethereum/latest/gn) -- [Base](https://api.goldsky.com/api/public//subgraphs/nouns-builder-base/latest/gn) -- [Optimism](https://api.goldsky.com/api/public//subgraphs/nouns-builder-optimism/latest/gn) -- TODO: [Zora](https://api.goldsky.com/api/public//subgraphs/nouns-builder-zora/latest/gn) -- TODO?: [Ethereum Sepolia](https://api.goldsky.com/api/public//subgraphs/nouns-builder-ethereum-sepolia/latest/gn) +- [Ethereum](https://api.goldsky.com/api/public//subgraphs/nouns-builder-ethereum-mainnet/latest/gn) +- [Base](https://api.goldsky.com/api/public//subgraphs/nouns-builder-base-mainnet/latest/gn) +- [Optimism](https://api.goldsky.com/api/public//subgraphs/nouns-builder-optimism-mainnet/latest/gn) +- [Zora](https://api.goldsky.com/api/public//subgraphs/nouns-builder-zora-mainnet/latest/gn) +- [Ethereum Sepolia](https://api.goldsky.com/api/public//subgraphs/nouns-builder-ethereum-sepolia/latest/gn) - TODO?: [Optimism Sepolia](https://api.goldsky.com/api/public//subgraphs/nouns-builder-optimism-sepolia/latest/gn) - TODO?: [Zora Sepolia](https://api.goldsky.com/api/public//subgraphs/nouns-builder-zora-sepolia/latest/gn) - TODO?: [Base Sepolia](https://api.goldsky.com/api/public//subgraphs/nouns-builder-base-sepolia/latest/gn) diff --git a/apps/subgraph/config/ethereum-sepolia.json b/apps/subgraph/config/sepolia.json similarity index 80% rename from apps/subgraph/config/ethereum-sepolia.json rename to apps/subgraph/config/sepolia.json index b954f062..9ddf6e0e 100644 --- a/apps/subgraph/config/ethereum-sepolia.json +++ b/apps/subgraph/config/sepolia.json @@ -1,5 +1,5 @@ { - "network": "ethereum-sepolia", + "network": "sepolia", "manager": { "address": "0x0ca90a96ac58f19b1f69f67103245c9263bc4bfc", "startBlock": 5074430 diff --git a/apps/subgraph/package.json b/apps/subgraph/package.json index 1645c62f..9537b3a8 100644 --- a/apps/subgraph/package.json +++ b/apps/subgraph/package.json @@ -5,7 +5,7 @@ "clean": "rm -rf ./generated ./build subgraph.yaml", "build:subgraph": "graph build", "codegen": "graph codegen", - "prepare:ethereum-sepolia": "mustache config/ethereum-sepolia.json subgraph.yaml.mustache > subgraph.yaml", + "prepare:ethereum-sepolia": "mustache config/sepolia.json subgraph.yaml.mustache > subgraph.yaml", "prepare:ethereum": "mustache config/ethereum.json subgraph.yaml.mustache > subgraph.yaml", "prepare:base": "mustache config/base.json subgraph.yaml.mustache > subgraph.yaml", "prepare:base-sepolia": "mustache config/base-sepolia.json subgraph.yaml.mustache > subgraph.yaml", diff --git a/apps/web/src/constants/addresses.ts b/apps/web/src/constants/addresses.ts index d9a9418c..27112051 100644 --- a/apps/web/src/constants/addresses.ts +++ b/apps/web/src/constants/addresses.ts @@ -71,8 +71,7 @@ export const L2_MIGRATION_DEPLOYER = { [CHAIN_ID.ETHEREUM]: '0x0000000000000000000000000000000000000000' as AddressType, [CHAIN_ID.OPTIMISM]: '0x7D8Ea0D056f5B8443cdD8495D4e90FFCf0a8A354' as AddressType, [CHAIN_ID.SEPOLIA]: '0x0000000000000000000000000000000000000000' as AddressType, - [CHAIN_ID.OPTIMISM_SEPOLIA]: - '0xF3a4ca161a88e26115d1C1DBcB8C4874E1786F42' as AddressType, + [CHAIN_ID.OPTIMISM_SEPOLIA]: '0xF3a4ca161a88e26115d1C1DBcB8C4874E1786F42' as AddressType, [CHAIN_ID.BASE]: '0x8ef7b563Ff9F4A1f2d294845000cDf782d9afd7c' as AddressType, [CHAIN_ID.BASE_SEPOLIA]: '0x1e57Cad7C22042BD765011d0F2eb36606Fe12C3F' as AddressType, [CHAIN_ID.ZORA]: '0x7D8Ea0D056f5B8443cdD8495D4e90FFCf0a8A354' as AddressType, diff --git a/apps/web/src/constants/subgraph.ts b/apps/web/src/constants/subgraph.ts index 454ea4df..b8a5f832 100644 --- a/apps/web/src/constants/subgraph.ts +++ b/apps/web/src/constants/subgraph.ts @@ -1,23 +1,10 @@ -import { CHAIN_ID } from 'src/typings' +import {CHAIN_ID} from 'src/typings' -// TODO: update all when all are deployed to the new BuilderDAO Goldsky account -export const PUBLIC_SUBGRAPH_URL = { - [CHAIN_ID.ETHEREUM]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-ethereum-mainnet/stable/gn', - [CHAIN_ID.OPTIMISM]: - 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-optimism-mainnet/latest/gn', - [CHAIN_ID.SEPOLIA]: - 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-ethereum-sepolia/latest/gn', - [CHAIN_ID.OPTIMISM_SEPOLIA]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-optimism-sepolia/stable/gn', - [CHAIN_ID.BASE]: - 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-base-mainnet/latest/gn', - [CHAIN_ID.BASE_SEPOLIA]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-base-sepolia/stable/gn', - [CHAIN_ID.ZORA]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-mainnet/stable/gn', - [CHAIN_ID.ZORA_SEPOLIA]: - 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-sepolia/stable/gn', - [CHAIN_ID.FOUNDRY]: - 'https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-mainnet', -} +export const PUBLIC_SUBGRAPH_URL: Map = new Map([ + [CHAIN_ID.ETHEREUM, 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-ethereum-mainnet/latest/gn'], + [CHAIN_ID.OPTIMISM, 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-optimism-mainnet/latest/gn'], + [CHAIN_ID.SEPOLIA, 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-ethereum-sepolia/latest/gn'], + [CHAIN_ID.BASE, 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-base-mainnet/latest/gn'], + [CHAIN_ID.ZORA, 'https://api.goldsky.com/api/public/project_cm33ek8kjx6pz010i2c3w8z25/subgraphs/nouns-builder-zora-mainnet/latest/gn'], + [CHAIN_ID.FOUNDRY, 'https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-mainnet'] +]); \ No newline at end of file diff --git a/apps/web/src/data/subgraph/client.ts b/apps/web/src/data/subgraph/client.ts index 2cc0c71b..70099aae 100644 --- a/apps/web/src/data/subgraph/client.ts +++ b/apps/web/src/data/subgraph/client.ts @@ -1,29 +1,29 @@ -import { GraphQLClient } from 'graphql-request' +import {GraphQLClient} from 'graphql-request' -import { PUBLIC_SUBGRAPH_URL } from 'src/constants/subgraph' -import { CHAIN_ID } from 'src/typings' +import {CHAIN_ID} from 'src/typings' -import { getSdk } from './sdk.generated' +import {getSdk} from './sdk.generated' +import {PUBLIC_SUBGRAPH_URL} from "src/constants/subgraph"; const globalForClient = global as unknown as { - subgraphClient: Map + subgraphClient: Map } export class SDK { - static connect(chainId: CHAIN_ID) { - if (!globalForClient.subgraphClient) globalForClient.subgraphClient = new Map() + static connect(chainId: CHAIN_ID) { + if (!globalForClient.subgraphClient) globalForClient.subgraphClient = new Map() - const client = globalForClient.subgraphClient.has(chainId) - ? globalForClient.subgraphClient.get(chainId)! - : new GraphQLClient(PUBLIC_SUBGRAPH_URL[chainId], { - headers: { - 'Content-Type': 'application/json', - }, - }) + const client = globalForClient.subgraphClient.has(chainId) + ? globalForClient.subgraphClient.get(chainId)! + : new GraphQLClient(PUBLIC_SUBGRAPH_URL.get(chainId) as string, { + headers: { + 'Content-Type': 'application/json', + }, + }) - if (process.env.NODE_ENV !== 'production') - globalForClient.subgraphClient.set(chainId, client) + if (process.env.NODE_ENV !== 'production') + globalForClient.subgraphClient.set(chainId, client) - return getSdk(client) - } + return getSdk(client) + } } diff --git a/apps/web/src/typings/index.tsx b/apps/web/src/typings/index.tsx index 4e1ecef1..e4b75044 100644 --- a/apps/web/src/typings/index.tsx +++ b/apps/web/src/typings/index.tsx @@ -7,7 +7,7 @@ export interface Duration { minutes?: number } -export const enum CHAIN_ID { +export enum CHAIN_ID { ETHEREUM = 1, SEPOLIA = 11155111, OPTIMISM = 10,