@gear-js/api
Version:
A JavaScript library that provides functionality to connect GEAR Component APIs.
23 lines (22 loc) • 1.31 kB
TypeScript
import type { UnsubscribePromise } from '@polkadot/api/types';
import type { GearApi } from '../GearApi';
import type { HexString, IBalanceCallback, IBlocksCallback } from '../types';
import type { Transfer, UserMessageSent } from './GearEvents';
import type { IGearEvent, IGearVoucherEvent } from './types';
export declare class GearEvents {
#private;
private api;
constructor(gearApi: GearApi);
subscribeToGearEvent<M extends keyof IGearEvent>(method: M, callback: (event: IGearEvent[M]) => void | Promise<void>, fromBlock?: number | HexString, blocks?: 'finalized' | 'latest'): Promise<() => void>;
subscribeToGearVoucherEvent<M extends keyof IGearVoucherEvent>(method: M, callback: (event: IGearVoucherEvent[M]) => void | Promise<void>): UnsubscribePromise;
subscribeToUserMessageSentByActor(options: {
from?: HexString;
to?: HexString;
}, callback: (event: UserMessageSent) => void): UnsubscribePromise;
subscribeToTransferEvents(callback: (event: Transfer) => void | Promise<void>): UnsubscribePromise;
/**
* @deprecated Use api.blocks.subscribeNewHeads instead
*/
subscribeToNewBlocks(callback: IBlocksCallback): UnsubscribePromise;
subscribeToBalanceChanges(accountAddress: string, callback: IBalanceCallback): UnsubscribePromise;
}