import { ExecutionEngineState, ExecutionPayloadStatus } from "./interface.js";
import { IJsonRpcHttpClient, JsonRpcHttpClientEventEmitter } from "./jsonRpcHttpClient.js";
/** QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API */
export type QUANTITY = string;
/** DATA as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API */
export type DATA = string;
export declare const rootHexRegex: RegExp;
export type IJson = string | number | boolean | undefined | IJson[] | {
    [key: string]: IJson;
};
export interface RpcPayload<P = IJson[]> {
    method: string;
    params: P;
}
/**
 * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
 *
 * When encoding QUANTITIES (integers, numbers): encode as hex, prefix with “0x”, the most compact representation (slight exception: zero should be represented as “0x0”). Examples:
 * - 0x41 (65 in decimal)
 * - 0x400 (1024 in decimal)
 * - WRONG: 0x (should always have at least one digit - zero is “0x0”)
 * - WRONG: 0x0400 (no leading zeroes allowed)
 * - WRONG: ff (must be prefixed 0x)
 */
export declare function numToQuantity(num: number | bigint): QUANTITY;
/**
 * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
 */
export declare function quantityToNum(hex: QUANTITY, id?: string): number;
/**
 * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API.
 * Typesafe fn to convert hex string to bigint. The BigInt constructor param is any
 */
export declare function quantityToBigint(hex: QUANTITY, id?: string): bigint;
/**
 * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API.
 */
export declare function quantityToBytes(hex: QUANTITY): Uint8Array;
/**
 * QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API.
 * Compress a 32 ByteVector into a QUANTITY
 */
export declare function bytesToQuantity(bytes: Uint8Array): QUANTITY;
/**
 * DATA as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
 *
 * When encoding UNFORMATTED DATA (byte arrays, account addresses, hashes, bytecode arrays): encode as hex, prefix with
 * “0x”, two hex digits per byte. Examples:
 *
 * - 0x41 (size 1, “A”)
 * - 0x004200 (size 3, “\0B\0”)
 * - 0x (size 0, “”)
 * - WRONG: 0xf0f0f (must be even number of digits)
 * - WRONG: 004200 (must be prefixed 0x)
 */
export declare function bytesToData(bytes: Uint8Array): DATA;
/**
 * DATA as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API
 */
export declare function dataToBytes(hex: DATA, fixedLength: number | null): Uint8Array;
/**
 * Convert DATA into a preallocated buffer
 * fromHexInto will throw if buffer's length is not the same as the decoded hex length
 */
export declare function dataIntoBytes(hex: DATA, buffer: Uint8Array): Uint8Array;
export type JsonRpcBackend = {
    readonly handlers: Record<string, (...args: any[]) => any>;
};
export declare class ExecutionEngineMockJsonRpcClient implements IJsonRpcHttpClient {
    private readonly backend;
    readonly emitter: JsonRpcHttpClientEventEmitter;
    constructor(backend: JsonRpcBackend);
    fetch<R, P = IJson[]>(payload: RpcPayload<P>): Promise<R>;
    fetchWithRetries<R, P = IJson[]>(payload: RpcPayload<P>): Promise<R>;
    fetchBatch<R>(rpcPayloadArr: RpcPayload<IJson[]>[]): Promise<R[]>;
    private wrapWithEvents;
}
export declare const HTTP_FATAL_ERROR_CODES: string[];
export declare const HTTP_CONNECTION_ERROR_CODES: string[];
export declare function getExecutionEngineState<S extends ExecutionPayloadStatus | undefined, E extends unknown | undefined>({ payloadError, payloadStatus, targetState, oldState }: {
    payloadStatus: S;
    payloadError?: never;
    targetState?: never;
    oldState: ExecutionEngineState;
} | {
    payloadStatus?: never;
    payloadError: E;
    targetState?: never;
    oldState: ExecutionEngineState;
} | {
    payloadStatus?: never;
    payloadError?: never;
    targetState: ExecutionEngineState;
    oldState: ExecutionEngineState;
}): ExecutionEngineState;
//# sourceMappingURL=utils.d.ts.map