From 5c51dd2688cb8f97ed5208297185d783f9be534a Mon Sep 17 00:00:00 2001 From: 0xTranqui Date: Tue, 8 Aug 2023 15:47:20 +0200 Subject: [PATCH 1/2] added zora main + base support --- apps/router-test/src/wagmi.ts | 41 ++++++++++++- .../src/context/ManagerProvider.tsx | 2 + .../builder-utils/src/lib/etherscanLink.ts | 4 ++ .../builder-utils/src/subgraph/subgraph.ts | 3 + packages/builder-utils/src/viem/client.ts | 59 ++++++++++++++++++- 5 files changed, 104 insertions(+), 5 deletions(-) diff --git a/apps/router-test/src/wagmi.ts b/apps/router-test/src/wagmi.ts index 24b3950..af4a621 100644 --- a/apps/router-test/src/wagmi.ts +++ b/apps/router-test/src/wagmi.ts @@ -1,10 +1,45 @@ import { getDefaultWallets } from '@rainbow-me/rainbowkit' -import { configureChains, createConfig } from 'wagmi' -import { goerli, mainnet } from 'wagmi/chains' +import { configureChains, createConfig, Chain } from 'wagmi' +import { goerli, mainnet, zoraTestnet, zora } from 'wagmi/chains' import { publicProvider } from 'wagmi/providers/public' +export const base = { + id: 8453, + network: 'base', + name: 'Base', + nativeCurrency: { name: 'Base', symbol: 'ETH', decimals: 18 }, + rpcUrls: { + default: { + http: ['https://developer-access-mainnet.base.org'], + }, + public: { + http: ['https://developer-access-mainnet.base.org'], + }, + }, + blockExplorers: { + blockscout: { + name: 'Basescout', + url: 'https://base.blockscout.com', + }, + default: { + name: 'Basescan', + url: 'https://basescan.org', + }, + etherscan: { + name: 'Basescan', + url: 'https://basescan.org', + }, + }, + contracts: { + multicall3: { + address: '0xca11bde05977b3631167028862be2a173976ca11', + blockCreated: 5022, + }, + }, +} as const + const { chains, publicClient, webSocketPublicClient } = configureChains( - [mainnet, goerli], + [mainnet, goerli, zoraTestnet, zora, base], [publicProvider()] ) diff --git a/packages/builder-utils/src/context/ManagerProvider.tsx b/packages/builder-utils/src/context/ManagerProvider.tsx index e265d6e..61afeb0 100644 --- a/packages/builder-utils/src/context/ManagerProvider.tsx +++ b/packages/builder-utils/src/context/ManagerProvider.tsx @@ -22,6 +22,8 @@ const MANAGER_PROXY_ADDRESS = { 1: '0xd310a3041dfcf14def5ccbc508668974b5da7174', 5: '0x0E9F3382Cf2508E3bc83248B5b4707FbA86D7Ee0', 999: '0xC521f85613985b7E417FCcd5b348F64263D79397', + 7777777: '0x3ac0e64fe2931f8e082c6bb29283540de9b5371c', + 8453: '0x3ac0e64fe2931f8e082c6bb29283540de9b5371c', }[process.env.NEXT_PUBLIC_CHAIN_ID || 1] export function ManagerProvider({ diff --git a/packages/builder-utils/src/lib/etherscanLink.ts b/packages/builder-utils/src/lib/etherscanLink.ts index 810ad63..e81ddc4 100644 --- a/packages/builder-utils/src/lib/etherscanLink.ts +++ b/packages/builder-utils/src/lib/etherscanLink.ts @@ -11,6 +11,10 @@ export function etherscanLink({ return `https://etherscan.io/tx/${hash}` } else if (process.env.NEXT_PUBLIC_CHAIN_ID == '999') { return `https://testnet.explorer.zora.energy/tx/${hash}` + } else if (process.env.NEXT_PUBLIC_CHAIN_ID == '7777777') { + return `https://explorer.zora.energy/tx/${hash}` + } else if (process.env.NEXT_PUBLIC_CHAIN_ID == '8453') { + return `https://base.blockscout.com/tx/${hash}` } else { return '' } diff --git a/packages/builder-utils/src/subgraph/subgraph.ts b/packages/builder-utils/src/subgraph/subgraph.ts index 4ea640f..1a8300a 100644 --- a/packages/builder-utils/src/subgraph/subgraph.ts +++ b/packages/builder-utils/src/subgraph/subgraph.ts @@ -2,4 +2,7 @@ export const PUBLIC_SUBGRAPH_URL = { 1: 'https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-mainnet', 5: 'https://api.thegraph.com/subgraphs/name/neokry/nouns-builder-goerli', 999: 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-testnet/stable/gn', + 7777777: + 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-zora-mainnet/stable/gn', + 8453: 'https://api.goldsky.com/api/public/project_clkk1ucdyf6ak38svcatie9tf/subgraphs/nouns-builder-base-mainnet/stable/gn', }[process.env.NEXT_PUBLIC_CHAIN_ID || 1] as string diff --git a/packages/builder-utils/src/viem/client.ts b/packages/builder-utils/src/viem/client.ts index 1b443e1..5ef4c13 100644 --- a/packages/builder-utils/src/viem/client.ts +++ b/packages/builder-utils/src/viem/client.ts @@ -1,5 +1,5 @@ import { createPublicClient, http } from 'viem' -import { mainnet, goerli, zoraTestnet } from 'viem/chains' +import { mainnet, goerli, zoraTestnet, zora } from 'viem/chains' import type { PublicClient, Chain } from 'viem' export const mainnetClient: PublicClient = createPublicClient({ @@ -26,9 +26,64 @@ export const zoraTestnetClient: PublicClient = createPublicClient({ transport: http('https://testnet.rpc.zora.co/'), }) +export const zoraMainnetClient: PublicClient = createPublicClient({ + batch: { + multicall: true, + }, + chain: zora as Chain, + transport: http('https://rpc.zora.co/'), +}) + +export const base = { + id: 8453, + network: 'base', + name: 'Base', + nativeCurrency: { name: 'Base', symbol: 'ETH', decimals: 18 }, + rpcUrls: { + default: { + http: ['https://developer-access-mainnet.base.org'], + }, + public: { + http: ['https://developer-access-mainnet.base.org'], + }, + }, + blockExplorers: { + blockscout: { + name: 'Basescout', + url: 'https://base.blockscout.com', + }, + default: { + name: 'Basescan', + url: 'https://basescan.org', + }, + etherscan: { + name: 'Basescan', + url: 'https://basescan.org', + }, + }, + contracts: { + multicall3: { + address: '0xca11bde05977b3631167028862be2a173976ca11', + blockCreated: 5022, + }, + }, +} as const + +export const baseMainnetClient: PublicClient = createPublicClient({ + batch: { + multicall: true, + }, + chain: base as Chain, + transport: http('https://developer-access-mainnet.base.org'), +}) + export const viemClient: PublicClient | undefined = process.env.NEXT_PUBLIC_CHAIN_ID == '5' ? goerliClient : process.env.NEXT_PUBLIC_CHAIN_ID == '1' ? mainnetClient - : zoraTestnetClient + : process.env.NEXT_PUBLIC_CHAIN_ID == '999' + ? zoraTestnetClient + : process.env.NEXT_PUBLIC_CHAIN_ID == '7777777' + ? zoraMainnetClient + : baseMainnetClient From a85bced8153cf5b5f60a1face339bbc9745356c7 Mon Sep 17 00:00:00 2001 From: 0xTranqui Date: Tue, 8 Aug 2023 15:49:19 +0200 Subject: [PATCH 2/2] added changeset --- .changeset/wild-parents-call.md | 5 +++++ packages/builder-utils/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/wild-parents-call.md diff --git a/.changeset/wild-parents-call.md b/.changeset/wild-parents-call.md new file mode 100644 index 0000000..d90d053 --- /dev/null +++ b/.changeset/wild-parents-call.md @@ -0,0 +1,5 @@ +--- +'@public-assembly/builder-utils': patch +--- + +Added support for zora mainnet and base diff --git a/packages/builder-utils/package.json b/packages/builder-utils/package.json index 59704f1..1d5a88a 100644 --- a/packages/builder-utils/package.json +++ b/packages/builder-utils/package.json @@ -1,6 +1,6 @@ { "name": "@public-assembly/builder-utils", - "version": "0.1.15", + "version": "0.1.16", "description": "React hooks and utilities for Nouns Builder DAOs.", "main": "./dist/index.js", "module": "./dist/index.mjs",