/**
* Session-events SSE resource.
*
* Subscribes to `/api/session/events?userAddress=
&network=`
* and yields typed `session-active` / `session-expired` events as they arrive.
*
* Each event is additionally dispatched to the SDK event bus so application
* code can centralise listeners on `sdk.events.on("sessionActive", ...)` and
* `sdk.events.on("sessionExpired", ...)` without plumbing the iterator
* manually.
*
* The iterator auto-reconnects transparently on network errors using the
* retry policy configured on the HTTP client; callers cancel via the
* provided `AbortSignal`.
*/
import type { EventBus } from "../events.js";
import type { HttpClient } from "../http.js";
import type { NetworkId } from "../chains/index.js";
import type { SessionEvent } from "../types/index.js";
export interface SessionEventsOptions {
userAddress: string;
network: NetworkId;
signal?: AbortSignal;
/** Max delay between reconnect attempts, in milliseconds. Default 10_000. */
reconnectMaxDelayMs?: number;
}
/**
* Drive a raw SSE subscription to `/api/session/events` and yield one event
* at a time. The generator terminates only when the caller aborts the signal
* or when a terminal `session-expired` event is emitted for the requested
* `(userAddress, network)` tuple (a terminal signal from the server side).
*/
export declare class SessionEventsResource {
private readonly client;
private readonly events;
private readonly hubs;
constructor(client: HttpClient, events: EventBus);
subscribe(opts: SessionEventsOptions): AsyncIterable;
private createIterator;
private key;
private start;
private run;
private publish;
private close;
private fail;
private drop;
private finish;
private next;
private stream;
private consumeStream;
}
//# sourceMappingURL=session-events.d.ts.map