Skip to content

Commit

Permalink
Merge pull request #131 from public-assembly/0xTranqui/Add-ZoraTestne…
Browse files Browse the repository at this point in the history
…t-Support

just published 0.1.15 which adds support for zora testnet chainId 999
  • Loading branch information
0xTranqui authored Jul 29, 2023
2 parents 2955a9e + ca4abfd commit de21088
Show file tree
Hide file tree
Showing 11 changed files with 298 additions and 668 deletions.
3 changes: 3 additions & 0 deletions apps/router-test/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
NEXT_PUBLIC_ALCHEMY_API_KEY=
NEXT_PUBLIC_WALLET_CONNECT=
NEXT_PUBLIC_TOKEN_ADDRESS=
NEXT_PUBLIC_CHAIN_ID=
6 changes: 3 additions & 3 deletions apps/router-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
},
"dependencies": {
"@public-assembly/builder-utils": "workspace:*",
"@rainbow-me/rainbowkit": "^1.0.0",
"@rainbow-me/rainbowkit": "^1.0.7",
"next": "^13.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "~0.3.24",
"wagmi": "^1.0.5"
"viem": "~1.1.4",
"wagmi": "^1.2.1"
},
"devDependencies": {
"@types/node": "^17.0.31",
Expand Down
2 changes: 1 addition & 1 deletion apps/router-test/src/components/HistoricalAuction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useHistoricalTokenQuery } from '@public-assembly/builder-utils'

export function HistoricalAuction({ navigatedTokenId }: { navigatedTokenId: number }) {
const { tokenName, tokenImage } = useHistoricalTokenQuery({
tokenAddress: '0xd2e7684cf3e2511cc3b4538bb2885dc206583076',
tokenAddress: process.env.NEXT_PUBLIC_TOKEN_ADDRESS as `0x${string}`,
tokenId: BigInt(navigatedTokenId),
})

Expand Down
1 change: 1 addition & 0 deletions apps/router-test/src/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const { chains, publicClient, webSocketPublicClient } = configureChains(

const { connectors } = getDefaultWallets({
appName: 'My wagmi + RainbowKit App',
projectId: '57383c91ed88bb5edb9e5faeb1b67d1e',
chains,
})

Expand Down
6 changes: 6 additions & 0 deletions packages/builder-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @public-assembly/builder-utils

## 0.1.15

### Patch Changes

- : Adds support for Zora Testnet (chainId - 999)

## 0.1.14

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions 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.14",
"version": "0.1.15",
"description": "React hooks and utilities for Nouns Builder DAOs.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down Expand Up @@ -31,8 +31,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "^1.3.0",
"viem": "^0.3.36",
"wagmi": "^1.0.6"
"viem": "^1.1.4",
"wagmi": "^1.2.1"
},
"devDependencies": {
"@graphql-codegen/cli": "3.2.1",
Expand All @@ -50,7 +50,7 @@
"react-dom": "^18.2.0",
"swr": "^1.3.0",
"typescript": "^5.0.4",
"viem": "^0.3.36",
"wagmi": "^1.0.6"
"viem": "^1.1.4",
"wagmi": "^1.2.1"
}
}
1 change: 1 addition & 0 deletions packages/builder-utils/src/context/ManagerProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ManagerContext = createContext<ManagerReturnTypes | undefined>(undefined)
const MANAGER_PROXY_ADDRESS = {
1: '0xd310a3041dfcf14def5ccbc508668974b5da7174',
5: '0x0E9F3382Cf2508E3bc83248B5b4707FbA86D7Ee0',
999: '0xC521f85613985b7E417FCcd5b348F64263D79397',
}[process.env.NEXT_PUBLIC_CHAIN_ID || 1]

export function ManagerProvider({
Expand Down
10 changes: 9 additions & 1 deletion packages/builder-utils/src/lib/etherscanLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@ export function etherscanLink({
linkType?: 'tx' | 'address' | 'contract'
hash?: string
}) {
return `https://etherscan.io/tx/${hash}`
if (process.env.NEXT_PUBLIC_CHAIN_ID == '1') {
return `https://etherscan.io/tx/${hash}`
} else if (process.env.NEXT_PUBLIC_CHAIN_ID == '5') {
return `https://etherscan.io/tx/${hash}`
} else if (process.env.NEXT_PUBLIC_CHAIN_ID == '999') {
return `https://testnet.explorer.zora.energy/tx/${hash}`
} else {
return ''
}
}
1 change: 1 addition & 0 deletions packages/builder-utils/src/subgraph/subgraph.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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',
}[process.env.NEXT_PUBLIC_CHAIN_ID || 1] as string
22 changes: 17 additions & 5 deletions packages/builder-utils/src/viem/client.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
import { createPublicClient, http } from 'viem'
import { mainnet, goerli } from 'viem/chains'
import type { PublicClient } from 'viem'
import { mainnet, goerli, zoraTestnet } from 'viem/chains'
import type { PublicClient, Chain } from 'viem'

export const mainnetClient: PublicClient = createPublicClient({
batch: {
multicall: true,
},
chain: mainnet,
chain: mainnet as Chain,
transport: http(process.env.NEXT_PUBLIC_MAINNET_ALCHEMY_ENDPOINT),
})

export const goerliClient: PublicClient = createPublicClient({
batch: {
multicall: true,
},
chain: goerli,
chain: goerli as Chain,
transport: http(process.env.NEXT_PUBLIC_GOERLI_ALCHEMY_ENDPOINT),
})

export const zoraTestnetClient: PublicClient = createPublicClient({
batch: {
multicall: true,
},
chain: zoraTestnet as Chain,
transport: http('https://testnet.rpc.zora.co/'),
})

export const viemClient: PublicClient | undefined =
process.env.NEXT_PUBLIC_CHAIN_ID == '5' ? goerliClient : mainnetClient
process.env.NEXT_PUBLIC_CHAIN_ID == '5'
? goerliClient
: process.env.NEXT_PUBLIC_CHAIN_ID == '1'
? mainnetClient
: zoraTestnetClient
Loading

1 comment on commit de21088

@vercel
Copy link

@vercel vercel bot commented on de21088 Jul 29, 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.