import { Fetch } from "../common/Types.js";
import type { APIMethods, APIResponse } from "./Client.js";
export interface APIProvider {
    /**
     * Call an API endpoint and return the response.
     * Provider is responsible for JSON encoding the params and decoding the response.
     * @argument path The endpoint path, e.g. `/v1/chain/get_info`
     * @argument params The request body if any.
     */
    call(args: {
        path: string;
        params?: unknown;
        method?: APIMethods;
    }): Promise<APIResponse>;
}
export interface FetchProviderOptions {
    /**
     * Fetch instance, must be provided in non-browser environments.
     * You can use the node-fetch package in Node.js.
     */
    fetch?: Fetch;
    /**
     * Headers that will be applied to every request
     * */
    headers?: Record<string, string>;
    /** Maximum time to wait for the request and response body, in milliseconds. */
    timeoutMs?: number;
    /**
     * Maximum response body size to read before JSON parsing.
     *
     * Non-streaming fetch fallbacks must provide a valid Content-Length within
     * this limit before FetchProvider can call response.arrayBuffer().
     */
    maxResponseBytes?: number;
}
/** Defaults used by FetchProvider for bounded HTTP requests. */
export declare namespace FetchProviderDefaults {
    /** Default request and response body timeout. */
    const TimeoutMs = 60000;
    /** Default maximum response body size, matching the 10 MiB SDK decompression cap. */
    const MaxResponseBytes = 10485760;
}
/** Default provider that uses the Fetch API to call a single node. */
export declare class FetchProvider implements APIProvider {
    readonly url: string;
    readonly fetch: Fetch;
    readonly headers: Record<string, string>;
    readonly timeoutMs: number;
    readonly maxResponseBytes: number;
    constructor(url: string, options?: FetchProviderOptions);
    call(args: {
        path: string;
        params?: Record<string, unknown>;
        method?: APIMethods;
        headers?: Record<string, string>;
    }): Promise<APIResponse>;
    /** Run a request phase with the provider timeout and abort when supported. */
    private callWithTimeout;
}
//# sourceMappingURL=Provider.d.ts.map