Skip to content

Commit

Permalink
Merge pull request #135 from public-assembly/0xTranqui/Add-ZoraMain-a…
Browse files Browse the repository at this point in the history
…nd_Base

0x tranqui/add zora main and base
  • Loading branch information
0xTranqui authored Aug 8, 2023
2 parents 8edd516 + a85bced commit 31af90e
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-parents-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@public-assembly/builder-utils': patch
---

Added support for zora mainnet and base
41 changes: 38 additions & 3 deletions apps/router-test/src/wagmi.ts
Original file line number Diff line number Diff line change
@@ -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()]
)

Expand Down
2 changes: 1 addition & 1 deletion packages/builder-utils/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 2 additions & 0 deletions packages/builder-utils/src/context/ManagerProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 4 additions & 0 deletions packages/builder-utils/src/lib/etherscanLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
}
Expand Down
3 changes: 3 additions & 0 deletions packages/builder-utils/src/subgraph/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
59 changes: 57 additions & 2 deletions packages/builder-utils/src/viem/client.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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

1 comment on commit 31af90e

@vercel
Copy link

@vercel vercel bot commented on 31af90e Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.