import { type Event } from './event.ts'; import { type Filter } from './filter.ts'; declare type RelayEvent = { connect: () => void | Promise; disconnect: () => void | Promise; error: () => void | Promise; notice: (msg: string) => void | Promise; auth: (challenge: string) => void | Promise; }; export declare type CountPayload = { count: number; }; declare type SubEvent = { event: (event: Event) => void | Promise; count: (payload: CountPayload) => void | Promise; eose: () => void | Promise; }; export declare type Relay = { url: string; status: number; connect: () => Promise; close: () => void; sub: (filters: Filter[], opts?: SubscriptionOptions) => Sub; list: (filters: Filter[], opts?: SubscriptionOptions) => Promise[]>; get: (filter: Filter, opts?: SubscriptionOptions) => Promise | null>; count: (filters: Filter[], opts?: SubscriptionOptions) => Promise; publish: (event: Event) => Promise; auth: (event: Event) => Promise; off: (event: T, listener: U) => void; on: (event: T, listener: U) => void; }; export declare type Sub = { sub: (filters: Filter[], opts: SubscriptionOptions) => Sub; unsub: () => void; on: , U extends SubEvent[T]>(event: T, listener: U) => void; off: , U extends SubEvent[T]>(event: T, listener: U) => void; }; export declare type SubscriptionOptions = { id?: string; verb?: 'REQ' | 'COUNT'; skipVerification?: boolean; alreadyHaveEvent?: null | ((id: string, relay: string) => boolean); }; export declare function relayInit(url: string, options?: { getTimeout?: number; listTimeout?: number; countTimeout?: number; }): Relay; export {};