/// import { Commitment, PublicKey, TransactionSignature } from '@solana/web3.js'; import { DepositRecord, FundingPaymentRecord, FundingRateRecord, LiquidationRecord, NewUserRecord, OrderActionRecord, OrderRecord, SettlePnlRecord, LPRecord, InsuranceFundRecord, SpotInterestRecord, InsuranceFundStakeRecord, CurveRecord, SwapRecord } from '../index'; import { EventEmitter } from 'events'; export type EventSubscriptionOptions = { address?: PublicKey; eventTypes?: EventType[]; maxEventsPerType?: number; orderBy?: EventSubscriptionOrderBy; orderDir?: EventSubscriptionOrderDirection; commitment?: Commitment; maxTx?: number; logProviderConfig?: LogProviderConfig; untilTx?: TransactionSignature; }; export declare const DefaultEventSubscriptionOptions: EventSubscriptionOptions; export type EventSubscriptionOrderBy = 'blockchain' | 'client'; export type EventSubscriptionOrderDirection = 'asc' | 'desc'; export type Event = T & { txSig: TransactionSignature; slot: number; txSigIndex: number; }; export type WrappedEvent = EventMap[Type] & { eventType: Type; }; export type WrappedEvents = WrappedEvent[]; export type EventMap = { DepositRecord: Event; FundingPaymentRecord: Event; LiquidationRecord: Event; FundingRateRecord: Event; OrderRecord: Event; OrderActionRecord: Event; SettlePnlRecord: Event; NewUserRecord: Event; LPRecord: Event; InsuranceFundRecord: Event; SpotInterestRecord: Event; InsuranceFundStakeRecord: Event; CurveRecord: Event; SwapRecord: Event; }; export type EventType = keyof EventMap; export type DriftEvent = Event | Event | Event | Event | Event | Event | Event | Event | Event | Event | Event | Event | Event | Event; export interface EventSubscriberEvents { newEvent: (event: WrappedEvent) => void; } export type SortFn = (currentRecord: EventMap[EventType], newRecord: EventMap[EventType]) => 'less than' | 'greater than'; export type logProviderCallback = (txSig: TransactionSignature, slot: number, logs: string[], mostRecentBlockTime: number | undefined) => void; export interface LogProvider { isSubscribed(): boolean; subscribe(callback: logProviderCallback, skipHistory?: boolean): Promise; unsubscribe(external?: boolean): Promise; eventEmitter?: EventEmitter; } export type WebSocketLogProviderConfig = { type: 'websocket'; resubTimeoutMs?: number; maxReconnectAttempts?: number; fallbackFrequency?: number; fallbackBatchSize?: number; }; export type PollingLogProviderConfig = { type: 'polling'; frequency: number; batchSize?: number; }; export type LogProviderConfig = WebSocketLogProviderConfig | PollingLogProviderConfig;