import { type Channel, type JsonRpcRequest, type JsonRpcResponse } from '../transport.js'; /** Options for creating a {@link PostMessageChannel}. */ export interface PostMessageChannelOptions { /** The signer window that this channel communicates with. */ signerWindow: Window; /** The verified origin of the signer window. */ signerOrigin: string; /** * Initial status of the signer. When `"pending"`, messages are queued * until the status changes to `"ready"`. * @default "ready" */ signerStatus?: 'pending' | 'ready'; /** * The relying party window, used to listen for incoming `postMessage` events. * @default globalThis.window */ window?: Window; /** * Manage focus between the relying party and signer windows. * @default true */ manageFocus?: boolean; } /** * A {@link Channel} implementation that communicates with a signer * via `window.postMessage`. Created by {@link PostMessageTransport} * after the ICRC-29 heartbeat handshake completes. * * Messages are filtered by source window and origin to prevent * cross-origin interference. When the signer status is `"pending"`, * outgoing messages are queued and flushed when it becomes `"ready"`. */ export declare class PostMessageChannel implements Channel { #private; constructor(options: PostMessageChannelOptions); /** Whether this channel has been closed. */ get closed(): boolean; addEventListener(...[event, listener]: [event: 'close', listener: () => void] | [event: 'response', listener: (response: JsonRpcResponse) => void]): () => void; /** * Sends a JSON-RPC request to the signer. If the signer status is * `"pending"`, the request is queued until {@link changeStatus} is * called with `"ready"`. * @param request - The JSON-RPC request to send. */ send(request: JsonRpcRequest): Promise; /** Closes the signer window and notifies all close listeners. */ close(): Promise; /** * Updates the signer status. When transitioning to `"ready"`, * all queued messages are flushed to the signer window. * @param status - The new signer status. */ changeStatus(status: 'pending' | 'ready'): void; }