import type { Channel, JsonRpcRequest, JsonRpcResponse } from '../transport.js'; import type { UrlFlow } from './urlFlow.js'; /** * A {@link Channel} implementation for the ICRC-167 browser URL transport, * driving a shared {@link UrlFlow} journal. * * Each request either resolves from the journal (a replayed call on the return * load) or is buffered for the next redirect. Concurrently issued requests are * coalesced by the flow into a single JSON-RPC batch and one redirect. When the * redirect fires the page unloads, so the caller's awaited response never * arrives on this load — it arrives on the return load, when the calling code * replays this request and it resolves from the journal. * * Callers need no explicit resume or cleanup step: a signer return continues * the flow, and any other load starts a fresh one. Issue the same requests (and * `memoize` steps) in the same order on every load, and route any value a * request depends on through `memoize` so it stays stable across the redirect; * see {@link UrlFlow} and the module README for the replay contract. * @see https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_167_browser_url_transport.md */ export declare class UrlChannel implements Channel { #private; constructor(flow: UrlFlow); /** Whether this channel has been closed. */ get closed(): boolean; addEventListener(...[event, listener]: [event: 'close', listener: () => void] | [event: 'response', listener: (response: JsonRpcResponse) => void]): () => void; /** * Resolves the request from the journal if the flow has already reached this * call, otherwise buffers it for the next redirect. * @param request - The JSON-RPC request to send. */ send(request: JsonRpcRequest): Promise; /** Marks the channel closed and notifies all close listeners. */ close(): Promise; }