UNPKG

zkverifyjs

Version:

Submit proofs to zkVerify and query proof state with ease using our npm package.

46 lines 2.15 kB
import { EventEmitter } from 'events'; import { ConnectionManager } from '../connection/index.js'; import { NewAggregationReceipt, SubscriptionEntry } from '../../../types.js'; export declare class EventManager { private readonly connectionManager; private readonly emitter; private readonly unsubscribeFunctions; private readonly runtimeEventHandlers; private systemEventsSubscribed; private readonly subscribedEvents; private isClosed; private systemEventsGeneration; constructor(connectionManager: ConnectionManager); /** * Subscribes to specified ZkVerifyEvents. * For `NewAggregationReceipt`, `options` can include `domainId` and `aggregationId`. * For runtime events (e.g., ProofVerified), options are ignored. * * Idempotent: subscribing to an event already subscribed to is a no-op for * that event (other entries in the same call are still processed). * * @param subscriptions - List of events to subscribe to with optional callback and filtering options. * @returns EventEmitter to allow listening to additional internal events (e.g., `Unsubscribe`). */ subscribe(subscriptions?: SubscriptionEntry[]): EventEmitter; /** * Registers a per-event handler against the shared system.events * subscription, lazily creating that subscription on first use. */ private _registerRuntimeEvent; private _ensureSystemEventsSubscription; /** * Waits for a specific `NewAggregationReceipt` event and returns the result as a NewAggregationReceipt object. * * @param domainId - The domain ID to listen for. * @param aggregationId - The aggregation ID to listen for. * @param timeout - Optional timeout value in milliseconds. * @returns {Promise<NewAggregationReceipt>} Resolves with the event data when found, or rejects on timeout/error. */ waitForAggregationReceipt(domainId: number, aggregationId: number, timeout?: number): Promise<NewAggregationReceipt>; /** * Unsubscribes from all active subscriptions. */ unsubscribe(): void; } //# sourceMappingURL=index.d.ts.map