From 273f2981f2d31bae8262272e63a25561dd7493cf Mon Sep 17 00:00:00 2001 From: Noah Litvin <335975+noahlitvin@users.noreply.github.com> Date: Tue, 21 Jan 2025 11:47:18 -0500 Subject: [PATCH] base support --- packages/api/src/helpers.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/api/src/helpers.ts b/packages/api/src/helpers.ts index 33d52835..aab0820d 100644 --- a/packages/api/src/helpers.ts +++ b/packages/api/src/helpers.ts @@ -7,7 +7,7 @@ import { webSocket, type Transport, } from "viem"; -import { mainnet, sepolia, cannon } from "viem/chains"; +import { mainnet, sepolia, cannon, base } from "viem/chains"; import { TOKEN_PRECISION } from "./constants"; import { epochRepository } from "./db"; import { Deployment } from "./interfaces"; @@ -58,6 +58,16 @@ export const mainnetPublicClient = createPublicClient({ }, }); +export const basePublicClient = createPublicClient({ + chain: base, + transport: process.env.INFURA_API_KEY + ? createInfuraWebSocketTransport("base-mainnet") + : http(), + batch: { + multicall: true, + }, +}); + export const sepoliaPublicClient = createPublicClient({ chain: sepolia, transport: process.env.INFURA_API_KEY @@ -90,6 +100,9 @@ export function getProviderForChain(chainId: number): PublicClient { case 13370: newClient = cannonPublicClient; break; + case 8453: + newClient = basePublicClient; + break; default: throw new Error(`Unsupported chain ID: ${chainId}`); }