import { APIProvider, FetchProviderOptions } from "./Provider.js";
import { ABISerializableConstructor } from "../serializer/Serializable.js";
import { ChainAPI } from "./v1/Chain.js";
import { HistoryAPI } from "./v1/History.js";
import { BuiltinTypes } from "../serializer/Builtins.js";
import { HistoryAPIv2 } from "./v2/History.js";
import { StateAPIv2 } from "./v2/State.js";
import { StatsAPIv2 } from "./v2/Stats.js";
import { GetRowsOptions, TransactionExtraOptions } from "./Types.js";
export { ChainAPI, HistoryAPI };
import { Action, AnyAction } from "../chain/Action.js";
import { SignedTransaction } from "../chain/Transaction.js";
import { UInt32Type } from "../chain/Integer.js";
import { SignerProvider } from "../signing/SignerProvider.js";
import * as v1 from "./v1/Types.js";
export interface APIClientOptions extends FetchProviderOptions {
    /** URL to the API node to use, only used if the provider option is not set. */
    url?: string;
    /** API provider to use, if omitted and the url option is set the default provider will be used.  */
    provider?: APIProvider;
    /** URL specifically for Hyperion API, if available */
    hyperionUrl?: string;
    /** Optional signer function that receives a message digest (Uint8Array) and returns a signed hash bytes (Promise<Uint8Array>). */
    signer?: SignerProvider;
}
export interface APIErrorDetail {
    message: string;
    file: string;
    line_number: number;
    method: string;
}
export interface APIErrorData {
    code: number;
    name: string;
    what: string;
    details: APIErrorDetail[];
}
export type APIMethods = "POST" | "GET";
/** Response to an API call.  */
export interface APIResponse {
    json?: any;
    text: string;
    status: number;
    headers: Record<string, string>;
}
export declare class APIError extends Error {
    static __className: string;
    static formatError(error: APIErrorData): string;
    /** The path to the API that failed, e.g. `/v1/chain/get_info`. */
    readonly path: string;
    /** The full response from the API that failed. */
    readonly response: APIResponse;
    constructor(path: string, response: APIResponse);
    /** The nodeop error object. */
    get error(): APIErrorData | undefined;
    /** The nodeop error name, e.g. `tx_net_usage_exceeded` */
    get name(): string;
    /** The nodeop error code, e.g. `3080002`. */
    get code(): number;
    /** List of exceptions, if any. */
    get details(): APIErrorDetail[];
}
export declare class APIClient {
    static __className: string;
    readonly v1Provider: APIProvider;
    readonly v2Provider?: APIProvider;
    private _signer?;
    get signer(): SignerProvider;
    constructor(options: APIClientOptions);
    v1: {
        chain: ChainAPI;
        history: HistoryAPI;
    };
    v2: {
        history: HistoryAPIv2;
        state: StateAPIv2;
        stats: StatsAPIv2;
    };
    call<T extends ABISerializableConstructor>(args: {
        method?: APIMethods;
        path: string;
        params?: unknown;
        headers?: Record<string, string>;
        responseType: T;
    }): Promise<InstanceType<T>>;
    call<T extends keyof BuiltinTypes>(args: {
        method?: APIMethods;
        path: string;
        params?: unknown;
        headers?: Record<string, string>;
        responseType: T;
    }): Promise<BuiltinTypes[T]>;
    call<T = unknown>(args: {
        method?: APIMethods;
        path: string;
        params?: unknown;
        headers?: Record<string, string>;
    }): Promise<T>;
    setSigner(signer: SignerProvider): void;
    /**
     * Fetches rows based on the provided options.
     * @param options The options for fetching rows.
     * @returns A Promise that resolves to the fetched rows.
     */
    getRows<T = any>(options: GetRowsOptions): Promise<v1.GetTableRowsResponse<any, T>>;
    pushTransaction(action: AnyAction | AnyAction[], opts?: TransactionExtraOptions): Promise<v1.PushTransactionResponse>;
    buildSignedTransaction(action: AnyAction | AnyAction[], opts?: TransactionExtraOptions): Promise<SignedTransaction>;
    anyToAction(action: AnyAction | AnyAction[]): Promise<Action[]>;
    /**
     * Waits until the specified block number is irreversible.
     * @param blocknum The block number to wait for.
     * @param onProgress Optional callback to report progress (blocksLeft, secondsLeft).
     * @param timeoutMs Optional timeout in milliseconds (default: 2 minutes).
     * @throws Error if the timeout is reached before the block becomes irreversible.
     */
    awaitBlock(blocknum: UInt32Type, onProgress?: (blocksLeft: number, secondsLeft: number) => void, timeoutMs?: number, // 2 minutes
    pollInterval?: number): Promise<void>;
}
//# sourceMappingURL=Client.d.ts.map