@@ -2,37 +2,31 @@ import {
22 contracts as addrs ,
33 l2ToL2CrossDomainMessengerAbi ,
44} from '@eth-optimism/viem'
5+ import type { ChainConfig } from 'ponder'
56import { createConfig } from 'ponder'
6- import type { Transport } from 'viem'
7-
8- export type Endpoint = {
9- chainId : number
10- transport : Transport
11- disableCache ?: boolean
12- }
137
148/**
159 * A map of name to {@link Endpoint}
1610 */
17- export type Endpoints = Record < string , Endpoint >
11+ export type ChainConfigs = Record < string , ChainConfig >
1812
1913/**
2014 * Create a Ponder config for interop
2115 * @param endpoints - Interoperable endpoints to index -- {@link Endpoints}
2216 * @returns Ponder configuration
2317 */
24- export function createPonderConfig ( endpoints : Endpoints ) {
25- if ( Object . keys ( endpoints ) . length === 0 ) {
26- throw new Error ( 'no endpoints provided' )
18+ export function createPonderConfig ( chainConfigs : ChainConfigs ) {
19+ if ( Object . keys ( chainConfigs ) . length === 0 ) {
20+ throw new Error ( 'no chain configs provided' )
2721 }
2822
2923 // relevant interop contracts
3024 const contracts = {
3125 L2ToL2CDM : {
3226 abi : l2ToL2CrossDomainMessengerAbi ,
3327 startBlock : 1 ,
34- network : Object . fromEntries (
35- Object . keys ( endpoints ) . map ( ( key ) => [
28+ chain : Object . fromEntries (
29+ Object . keys ( chainConfigs ) . map ( ( key ) => [
3630 key ,
3731 { address : addrs . l2ToL2CrossDomainMessenger . address } ,
3832 ] ) ,
@@ -42,7 +36,7 @@ export function createPonderConfig(endpoints: Endpoints) {
4236
4337 return createConfig ( {
4438 ordering : 'multichain' ,
45- networks : endpoints ,
39+ chains : chainConfigs ,
4640 contracts,
4741 } )
4842}
0 commit comments