import type { Chain } from 'viem' import { Zone } from 'viem/tempo' import { tempo, tempoDevnet, tempoTestnet } from 'viem/tempo/chains' type HostedZone = Zone.from.ReturnValue /** Returns a parent chain and its configured Zones for shared sponsorship accounting. */ export function chainIds(options: chainIds.Options): number[] { return [ options.sourceId, ...[...options.zones] .filter((zone) => zone.sourceId === options.sourceId) .map((zone) => zone.id), ] } export declare namespace chainIds { /** Chains included in the accounting scope. */ type Options = { /** Parent Tempo chain id. */ sourceId: number /** Configured Zone chains. */ zones: Iterable } } /** Internal Moderato Zone on Tempo testnet. */ export const zoneModeratoInternal: HostedZone = Zone.from({ ...tempoTestnet, contracts: { ...tempoTestnet.contracts, messenger: { address: '0x5A4d000000000000000000000000000000000000' }, portal: { address: '0x5Ad0000000000000000000000000000000000003' }, verifier: { address: '0x5a56000000000000000000000000000000000000' }, }, id: 1_424_310_003, name: 'zone-moderato-internal', rpcUrls: { default: { http: ['https://zone-internal-rpc.testnet.tempo.xyz'] }, internal: { http: ['https://zone-internal-rpc.testnet.tempo.xyz'] }, tidx: { http: ['https://indexer-zone-internal.testnet.tempo.xyz'] }, }, sourceId: tempoTestnet.id, }) /** Internal Zone on Tempo mainnet. */ export const zoneMainnetInternal: HostedZone = Zone.from({ ...tempo, contracts: { ...tempo.contracts, messenger: { address: '0x5A4d000000000000000000000000000000000000' }, portal: { address: '0x5ad0000000000000000000000000000000000001' }, verifier: { address: '0x5a56000000000000000000000000000000000000' }, }, id: 421_700_001, name: 'zone-mainnet-internal', rpcUrls: { default: { http: ['https://zone-internal-rpc.tempo.xyz'] }, internal: { http: ['https://zone-internal-rpc.tempo.xyz'] }, tidx: { http: ['https://indexer-zone-internal.tempo.xyz'] }, }, sourceId: tempo.id, }) /** Deel Zone on Tempo mainnet. */ export const zoneDeel: HostedZone = Zone.from({ ...tempo, contracts: { ...tempo.contracts, messenger: { address: '0x5A4d000000000000000000000000000000000000' }, portal: { address: '0x5Ad0000000000000000000000000000000000002' }, verifier: { address: '0x5a56000000000000000000000000000000000000' }, }, id: 421_700_002, name: 'zone-deel', rpcUrls: { default: { http: ['https://zone-2-rpc.tempo.xyz'] }, internal: { http: ['https://zone-2-rpc.tempo.xyz'] }, tidx: { http: ['https://indexer-zone-2.tempo.xyz'] }, }, sourceId: tempo.id, }) /** Stable hosted Zone on Tempo devnet. */ export const zoneStable: HostedZone = Zone.from({ ...tempoDevnet, contracts: { ...tempoDevnet.contracts, messenger: { address: '0x5A4d000000000000000000000000000000000000' }, portal: { address: '0x5aD0000000000000000000000000000000000006' }, }, id: 421_700_006, name: 'zone-stable', rpcUrls: { default: { http: ['https://rpc-zone-stable-public.devnet.tempoxyz.dev'] }, internal: { http: ['https://rpc-zone-stable.devnet.tempoxyz.dev'] }, tidx: { http: ['https://tidx-zone-stable.devnet.tempoxyz.dev'] }, }, sourceId: tempoDevnet.id, }) /** Hosted Zone chains served by the API and admin. */ export const chains: readonly HostedZone[] = [ zoneModeratoInternal, zoneMainnetInternal, zoneDeel, zoneStable, ]