zkverifyjs
Version:
Submit proofs to zkVerify and query proof state with ease using our npm package.
28 lines • 1.55 kB
TypeScript
import { ApiPromise } from '@polkadot/api';
import { EventEmitter } from 'events';
import { NewAggregationEventSubscriptionOptions } from './types';
/**
* Subscribes to `aggregation.NewAggregationReceipt` events and triggers the provided callback.
*
* - If both `domainId` and `aggregationId` are provided, the listener stops after the matching receipt is found.
* - If only `domainId` is provided, listens indefinitely for all receipts within that domain.
* - If neither is provided, listens to all receipts across all domains.
* - Throws if `aggregationId` is provided without a `domainId`.
*
* @param {ApiPromise} api - The Polkadot.js API instance.
* @param callback
* @param options - NewAggregationEventSubscriptionOptions containing domainId, aggregationId and optional timeout.
* @param emitter - EventEmitter
* @returns {EventEmitter} EventEmitter for listening to emitted events and unsubscribing.
*/
export declare function subscribeToNewAggregationReceipts(api: ApiPromise, callback: (data: unknown) => void, options: NewAggregationEventSubscriptionOptions, emitter: EventEmitter): Promise<EventEmitter>;
/**
* Unsubscribes from all event tracking.
*
* - Emits a `ZkVerifyEvents.Unsubscribe` event before removing all listeners.
* - Use this to manually stop listening when not auto-unsubscribing on matched receipts.
*
* @param {EventEmitter} emitter - The EventEmitter instance returned by the subscription.
*/
export declare function unsubscribe(emitter: EventEmitter): void;
//# sourceMappingURL=index.d.ts.map