Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
1import { LENS_MAINNET_RPCS, LENS_TESTNET_RPCS } from "@hey/data/rpcs";
2import type { FallbackTransport } from "viem";
3import { fallback, http } from "viem";
4
5interface GetRpcOptions {
6 mainnet: boolean;
7}
8
9const BATCH_SIZE = 10;
10
11const getRpc = ({ mainnet }: GetRpcOptions): FallbackTransport => {
12 const rpcs = mainnet ? LENS_MAINNET_RPCS : LENS_TESTNET_RPCS;
13
14 return fallback(
15 rpcs.map((rpc) => http(rpc, { batch: { batchSize: BATCH_SIZE } }))
16 );
17};
18
19export default getRpc;