/** * WebSocket client for real-time Sequence0 agent events * * Connects to the agent node's /ws endpoint, receives typed events * for signing progress, DKG status, and fee collection. */ /** WebSocket event types — mirrors agent-node WsEvent enum */ export type WsEventType = 'SigningStarted' | 'CommitmentReceived' | 'PartialSignatureReceived' | 'SigningComplete' | 'SigningFailed' | 'DkgStarted' | 'DkgRoundProgress' | 'WalletCreated' | 'FeeCollected' | 'FeeCollectionFailed' | 'Heartbeat'; export interface WsMessage { type: WsEventType; [key: string]: unknown; } export type WsEventHandler = (event: WsMessage) => void; export interface WsClientOptions { /** WebSocket URL (e.g. ws://host:8080/ws) */ url: string; /** Filter events by wallet_id (optional) */ walletId?: string; /** Auto-reconnect on disconnect (default: true) */ autoReconnect?: boolean; /** Reconnect delay in ms (default: 3000) */ reconnectDelay?: number; } export declare class WsClient { private ws; private handlers; private options; private reconnectTimer; private _connected; constructor(options: WsClientOptions); get connected(): boolean; /** Connect to the agent WebSocket */ connect(): Promise; /** Disconnect and stop reconnecting */ disconnect(): void; /** Subscribe to a specific event type, or '*' for all */ on(event: WsEventType | 'connected' | 'disconnected' | '*', handler: WsEventHandler): void; /** Remove an event handler */ off(event: string, handler: WsEventHandler): void; /** Wait for a specific event matching a predicate (with timeout) */ waitFor(eventType: WsEventType, predicate: (event: WsMessage) => boolean, timeoutMs?: number): Promise; private emit; private scheduleReconnect; } //# sourceMappingURL=websocket.d.ts.map