Skip to content

Commit

Permalink
base support
Browse files Browse the repository at this point in the history
  • Loading branch information
noahlitvin committed Jan 21, 2025
1 parent 2740ef9 commit 273f298
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/api/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}`);
}
Expand Down

0 comments on commit 273f298

Please sign in to comment.