import { HttpRpcClientOptions } from "./getHttpRpcClient.js"; import { ErrorType } from "../errors/utils.js"; import { BtcRpcRequestFn, RpcSchema } from "../types/request.js"; import { CreateTransportErrorType, Transport, TransportConfig } from "../types/transport.js"; import { UrlRequiredErrorType } from "../errors/transport.js"; //#region src/transports/http.d.ts type HttpTransportConfig = { /** * Whether to enable Batch JSON-RPC. * @link https://www.jsonrpc.org/specification#batch */ batch?: boolean | { /** The maximum number of JSON-RPC requests to send in a batch. @default 1_000 */batchSize?: number | undefined; /** The maximum number of milliseconds to wait before sending a batch. @default 0 */ wait?: number | undefined; } | undefined; /** * Request configuration to pass to `fetch`. * @link https://developer.mozilla.org/en-US/docs/Web/API/fetch */ fetchOptions?: HttpRpcClientOptions["fetchOptions"] | undefined; /** A callback to handle the response from `fetch`. */ onFetchRequest?: HttpRpcClientOptions["onRequest"] | undefined; /** A callback to handle the response from `fetch`. */ onFetchResponse?: HttpRpcClientOptions["onResponse"] | undefined; /** The key of the HTTP transport. */ key?: TransportConfig["key"] | undefined; /** Methods to include or exclude from executing RPC requests. */ methods?: TransportConfig["methods"] | undefined; /** The name of the HTTP transport. */ name?: TransportConfig["name"] | undefined; /** Whether to return JSON RPC errors as responses instead of throwing. */ raw?: raw | boolean | undefined; /** The max number of times to retry. */ retryCount?: TransportConfig["retryCount"] | undefined; /** The base delay (in ms) between retries. */ retryDelay?: TransportConfig["retryDelay"] | undefined; /** Typed JSON-RPC schema for the transport. */ rpcSchema?: rpcSchema | RpcSchema | undefined; /** The timeout (in ms) for the HTTP request. Default: 10_000 */ timeout?: TransportConfig["timeout"] | undefined; }; type HttpTransport = Transport<"http", { fetchOptions?: HttpTransportConfig["fetchOptions"] | undefined; url?: string | undefined; }, BtcRpcRequestFn>; type HttpTransportErrorType = CreateTransportErrorType | UrlRequiredErrorType | ErrorType; /** * @description Creates a HTTP transport that connects to a JSON-RPC API. */ declare function http(url?: string | undefined, config?: HttpTransportConfig): HttpTransport; //#endregion export { HttpTransport, HttpTransportConfig, HttpTransportErrorType, http }; //# sourceMappingURL=http.d.ts.map