import { ForkName } from "@lodestar/params";
import { ExecutionPayload, ExecutionRequests, Root, Wei, bellatrix, capella } from "@lodestar/types";
import { BlobAndProof } from "@lodestar/types/deneb";
import { DATA, QUANTITY } from "../../eth1/provider/utils.js";
import { BlobsBundle, ExecutionPayloadStatus, PayloadAttributes, VersionedHashes } from "./interface.js";
import { WithdrawalV1 } from "./payloadIdCache.js";
export type EngineApiRpcParamTypes = {
    /**
     * 1. Object - Instance of ExecutionPayload
     */
    engine_newPayloadV1: [ExecutionPayloadRpc];
    engine_newPayloadV2: [ExecutionPayloadRpc];
    engine_newPayloadV3: [ExecutionPayloadRpc, VersionedHashesRpc, DATA];
    engine_newPayloadV4: [ExecutionPayloadRpc, VersionedHashesRpc, DATA, ExecutionRequestsRpc];
    /**
     * 1. Object - Payload validity status with respect to the consensus rules:
     *   - blockHash: DATA, 32 Bytes - block hash value of the payload
     *   - status: String: VALID|INVALID - result of the payload validation with respect to the proof-of-stake consensus rules
     */
    engine_forkchoiceUpdatedV1: [
        forkChoiceData: {
            headBlockHash: DATA;
            safeBlockHash: DATA;
            finalizedBlockHash: DATA;
        },
        payloadAttributes?: PayloadAttributesRpc
    ];
    engine_forkchoiceUpdatedV2: [
        forkChoiceData: {
            headBlockHash: DATA;
            safeBlockHash: DATA;
            finalizedBlockHash: DATA;
        },
        payloadAttributes?: PayloadAttributesRpc
    ];
    engine_forkchoiceUpdatedV3: [
        forkChoiceData: {
            headBlockHash: DATA;
            safeBlockHash: DATA;
            finalizedBlockHash: DATA;
        },
        payloadAttributes?: PayloadAttributesRpc
    ];
    /**
     * 1. payloadId: QUANTITY, 64 Bits - Identifier of the payload building process
     */
    engine_getPayloadV1: [QUANTITY];
    engine_getPayloadV2: [QUANTITY];
    engine_getPayloadV3: [QUANTITY];
    engine_getPayloadV4: [QUANTITY];
    /**
     * 1. Array of DATA - Array of block_hash field values of the ExecutionPayload structure
     *  */
    engine_getPayloadBodiesByHashV1: DATA[][];
    /**
     *  1. start: QUANTITY, 64 bits - Starting block number
     *  2. count: QUANTITY, 64 bits - Number of blocks to return
     */
    engine_getPayloadBodiesByRangeV1: [start: QUANTITY, count: QUANTITY];
    /**
     * Object - Instance of ClientVersion
     */
    engine_getClientVersionV1: [ClientVersionRpc];
    engine_getBlobsV1: [DATA[]];
};
export type PayloadStatus = {
    status: ExecutionPayloadStatus;
    latestValidHash: DATA | null;
    validationError: string | null;
};
export type EngineApiRpcReturnTypes = {
    /**
     * Object - Response object:
     * - status: String - the result of the payload execution:
     */
    engine_newPayloadV1: PayloadStatus;
    engine_newPayloadV2: PayloadStatus;
    engine_newPayloadV3: PayloadStatus;
    engine_newPayloadV4: PayloadStatus;
    engine_forkchoiceUpdatedV1: {
        payloadStatus: PayloadStatus;
        payloadId: QUANTITY | null;
    };
    engine_forkchoiceUpdatedV2: {
        payloadStatus: PayloadStatus;
        payloadId: QUANTITY | null;
    };
    engine_forkchoiceUpdatedV3: {
        payloadStatus: PayloadStatus;
        payloadId: QUANTITY | null;
    };
    /**
     * payloadId | Error: QUANTITY, 64 Bits - Identifier of the payload building process
     */
    engine_getPayloadV1: ExecutionPayloadRpc;
    engine_getPayloadV2: ExecutionPayloadResponse;
    engine_getPayloadV3: ExecutionPayloadResponse;
    engine_getPayloadV4: ExecutionPayloadResponse;
    engine_getPayloadBodiesByHashV1: (ExecutionPayloadBodyRpc | null)[];
    engine_getPayloadBodiesByRangeV1: (ExecutionPayloadBodyRpc | null)[];
    engine_getClientVersionV1: ClientVersionRpc[];
    engine_getBlobsV1: (BlobAndProofRpc | null)[];
};
type ExecutionPayloadRpcWithValue = {
    executionPayload: ExecutionPayloadRpc;
    blockValue: QUANTITY;
    blobsBundle?: BlobsBundleRpc;
    executionRequests?: ExecutionRequestsRpc;
    shouldOverrideBuilder?: boolean;
};
type ExecutionPayloadResponse = ExecutionPayloadRpc | ExecutionPayloadRpcWithValue;
export type ExecutionPayloadBodyRpc = {
    transactions: DATA[];
    withdrawals: WithdrawalV1[] | null | undefined;
};
export type ExecutionPayloadBody = {
    transactions: bellatrix.Transaction[];
    withdrawals: capella.Withdrawals | null;
};
export type ExecutionPayloadRpc = {
    parentHash: DATA;
    feeRecipient: DATA;
    stateRoot: DATA;
    receiptsRoot: DATA;
    logsBloom: DATA;
    prevRandao: DATA;
    blockNumber: QUANTITY;
    gasLimit: QUANTITY;
    gasUsed: QUANTITY;
    timestamp: QUANTITY;
    extraData: DATA;
    baseFeePerGas: QUANTITY;
    blockHash: DATA;
    transactions: DATA[];
    withdrawals?: WithdrawalRpc[];
    blobGasUsed?: QUANTITY;
    excessBlobGas?: QUANTITY;
    parentBeaconBlockRoot?: QUANTITY;
};
export type WithdrawalRpc = {
    index: QUANTITY;
    validatorIndex: QUANTITY;
    address: DATA;
    amount: QUANTITY;
};
/**
 * ExecutionRequestsRpc only holds at most 3 elements and no repeated type:
 * - ssz'ed DepositRequests
 * - ssz'ed WithdrawalRequests
 * - ssz'ed ConsolidationRequests
 */
export type ExecutionRequestsRpc = (DepositRequestsRpc | WithdrawalRequestsRpc | ConsolidationRequestsRpc)[];
export type DepositRequestsRpc = DATA;
export type WithdrawalRequestsRpc = DATA;
export type ConsolidationRequestsRpc = DATA;
export type BlobAndProofRpc = {
    blob: DATA;
    proof: DATA;
};
export type VersionedHashesRpc = DATA[];
export type PayloadAttributesRpc = {
    /** QUANTITY, 64 Bits - value for the timestamp field of the new payload */
    timestamp: QUANTITY;
    /** DATA, 32 Bytes - value for the prevRandao field of the new payload */
    prevRandao: DATA;
    /** DATA, 20 Bytes - suggested value for the coinbase field of the new payload */
    suggestedFeeRecipient: DATA;
    withdrawals?: WithdrawalRpc[];
    /** DATA, 32 Bytes - value for the parentBeaconBlockRoot to be used for building block */
    parentBeaconBlockRoot?: DATA;
};
export type ClientVersionRpc = {
    /** ClientCode */
    code: string;
    /** string, Human-readable name of the client */
    name: string;
    /** string, the version string of the current implementation */
    version: string;
    /** DATA, 4 bytes - first four bytes of the latest commit hash of this build  */
    commit: DATA;
};
export interface BlobsBundleRpc {
    commitments: DATA[];
    blobs: DATA[];
    proofs: DATA[];
}
export declare function serializeExecutionPayload(fork: ForkName, data: ExecutionPayload): ExecutionPayloadRpc;
export declare function serializeVersionedHashes(vHashes: VersionedHashes): VersionedHashesRpc;
export declare function hasPayloadValue(response: ExecutionPayloadResponse): response is ExecutionPayloadRpcWithValue;
export declare function parseExecutionPayload(fork: ForkName, response: ExecutionPayloadResponse): {
    executionPayload: ExecutionPayload;
    executionPayloadValue: Wei;
    blobsBundle?: BlobsBundle;
    executionRequests?: ExecutionRequests;
    shouldOverrideBuilder?: boolean;
};
export declare function serializePayloadAttributes(data: PayloadAttributes): PayloadAttributesRpc;
export declare function serializeBeaconBlockRoot(data: Root): DATA;
export declare function deserializePayloadAttributes(data: PayloadAttributesRpc): PayloadAttributes;
export declare function parseBlobsBundle(data: BlobsBundleRpc): BlobsBundle;
export declare function serializeBlobsBundle(data: BlobsBundle): BlobsBundleRpc;
export declare function serializeWithdrawal(withdrawal: capella.Withdrawal): WithdrawalRpc;
export declare function deserializeWithdrawal(serialized: WithdrawalRpc): capella.Withdrawal;
/**
 * This is identical to get_execution_requests_list in
 * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.8/specs/electra/beacon-chain.md#new-get_execution_requests_list
 */
export declare function serializeExecutionRequests(executionRequests: ExecutionRequests): ExecutionRequestsRpc;
export declare function deserializeExecutionRequests(serialized: ExecutionRequestsRpc): ExecutionRequests;
export declare function deserializeExecutionPayloadBody(data: ExecutionPayloadBodyRpc | null): ExecutionPayloadBody | null;
export declare function serializeExecutionPayloadBody(data: ExecutionPayloadBody | null): ExecutionPayloadBodyRpc | null;
export declare function deserializeBlobAndProofs(data: BlobAndProofRpc | null): BlobAndProof | null;
export declare function assertReqSizeLimit(blockHashesReqCount: number, count: number): void;
export {};
//# sourceMappingURL=types.d.ts.map