UNPKG

@symbioticfi/relay-stats-ts

Version:

TypeScript library for deriving validator sets from Symbiotic network contracts

48 lines 3.04 kB
import type { PublicClient } from 'viem'; import type { CrossChainAddress, ValSetLogEvent, ValSetStatus, CacheInterface, SettlementValSetStatus } from './types.js'; import { type BlockTagPreference } from './utils.js'; export declare const settlementKey: (settlement: CrossChainAddress) => string; export declare const valsetEventsStateKey: (blockTag: BlockTagPreference, settlement: CrossChainAddress) => string; type VerificationMode = 'simple' | 'zk'; export declare const getOrCreateValSetEventsState: (states: Map<string, ValSetEventsState>, blockTag: BlockTagPreference, settlement: CrossChainAddress) => ValSetEventsState; type StoredValSetEvent = { event: ValSetLogEvent; logIndex: number | null; }; export interface ValSetEventsState { settlement: CrossChainAddress; map: Map<number, StoredValSetEvent>; } export declare const ingestSettlementEvents: (client: PublicClient, settlement: CrossChainAddress, state: ValSetEventsState, fromBlock: bigint, toBlock: bigint, mode: VerificationMode) => Promise<void>; export declare const getValSetLogEventFromSet: (settlement: CrossChainAddress, state: ValSetEventsState, epoch: number) => ValSetLogEvent | null; export declare const selectDefaultSettlement: (settlements: readonly CrossChainAddress[]) => CrossChainAddress; export declare const pruneValSetEventState: (states: Map<string, ValSetEventsState>, cache: CacheInterface | null, epoch: number) => Promise<void>; export declare const findBlockNumberForTimestamp: (client: PublicClient, timestamp: number, highestBlock: bigint, highestTimestamp: number) => Promise<bigint>; export declare const estimateEpochBlockRange: (client: PublicClient, startTimestamp: number, endTimestamp: number, buffer: bigint, blockTag: BlockTagPreference) => Promise<{ fromBlock: bigint; toBlock: bigint; }>; export declare const loadValSetEvent: (state: ValSetEventsState, cache: CacheInterface | null, clientFactory: (chainId: number) => PublicClient, params: { epoch: number; settlement: CrossChainAddress; finalized: boolean; startTimestamp: number; endTimestamp: number; buffer: bigint; mode: VerificationMode; allowCache: boolean; }) => Promise<ValSetLogEvent | null>; export declare const retrieveValSetEvent: (params: { epoch: number; settlement: CrossChainAddress; finalized: boolean; mode: VerificationMode; }, stateFactory: (blockTag: BlockTagPreference, settlement: CrossChainAddress) => ValSetEventsState, cache: CacheInterface | null, statusFetcher: (epoch: number, finalized: boolean) => Promise<ValSetStatus>, blockMetrics: { getStart: (epoch: number, finalized: boolean) => Promise<number>; getEnd: (epoch: number, finalized: boolean, fallbackStart: number) => Promise<number>; }, clientFactory: (chainId: number) => PublicClient, buffer: bigint, statusContext?: { overall?: ValSetStatus | null; detail?: SettlementValSetStatus | null; }, allowCache?: boolean) => Promise<ValSetLogEvent | null>; export {}; //# sourceMappingURL=valset_events.d.ts.map