import { type HttpRequestErrorType as HttpRequestErrorType_, type TimeoutErrorType } from '../../errors/request.js'; import type { ErrorType } from '../../errors/utils.js'; import type { RpcRequest, RpcResponse } from '../../types/rpc.js'; import type { MaybePromise } from '../../types/utils.js'; import { type WithTimeoutErrorType } from '../promise/withTimeout.js'; export type HttpRpcClientOptions = { /** Override for the fetch function used to make requests. */ fetchFn?: ((input: string | URL | Request, init?: RequestInit) => Promise) | undefined; /** Request configuration to pass to `fetch`. */ fetchOptions?: Omit | undefined; /** A callback to handle the request. */ onRequest?: ((request: Request, init: RequestInit) => MaybePromise) | undefined; /** A callback to handle the response. */ onResponse?: ((response: Response) => Promise | void) | undefined; /** The timeout (in ms) for the request. */ timeout?: number | undefined; }; export type HttpRequestParameters = { /** The RPC request body. */ body: body; /** Override for the fetch function used to make requests. */ fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined; /** Request configuration to pass to `fetch`. */ fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined; /** A callback to handle the response. */ onRequest?: ((request: Request, init: RequestInit) => MaybePromise) | undefined; /** A callback to handle the response. */ onResponse?: ((response: Response) => Promise | void) | undefined; /** The timeout (in ms) for the request. */ timeout?: HttpRpcClientOptions['timeout'] | undefined; }; export type HttpRequestReturnType = body extends RpcRequest[] ? RpcResponse[] : RpcResponse; export type HttpRequestErrorType = HttpRequestErrorType_ | TimeoutErrorType | WithTimeoutErrorType | ErrorType; export type HttpRpcClient = { request(params: HttpRequestParameters): Promise>; }; export declare function getHttpRpcClient(url_: string, options?: HttpRpcClientOptions): HttpRpcClient; /** @internal */ export declare function parseUrl(url_: string): { url: string; headers?: { Authorization: string; }; }; //# sourceMappingURL=http.d.ts.map