import { type Hex } from '@tevm/utils'; import type { ExecutionPayload, VerkleExecutionWitness } from './types.js'; type BeaconWithdrawal = { index: Hex; validator_index: Hex; address: Hex; amount: Hex; }; /** * Represents the JSON structure of an execution payload from the Beacon API * * This type uses snake_case property names as returned by the Beacon API, * as opposed to the camelCase used internally in Tevm. Used when fetching * execution payloads from a consensus layer client. * * @see https://ethereum.github.io/beacon-APIs/ for the Beacon API specification * * @example * ```typescript * import { BeaconPayloadJson, executionPayloadFromBeaconPayload } from '@tevm/block' * * // Fetch the payload from a Beacon API * async function getExecutionPayload(blockNumber: number) { * const response = await fetch( * `http://localhost:5052/eth/v2/beacon/blocks/${blockNumber}` * ) * const data = await response.json() * * // Extract and parse the execution payload * const beaconPayload: BeaconPayloadJson = data.data.message.body.execution_payload * * // Convert to Tevm's internal ExecutionPayload format * return executionPayloadFromBeaconPayload(beaconPayload) * } * ``` */ export type BeaconPayloadJson = { parent_hash: Hex; fee_recipient: Hex; state_root: Hex; receipts_root: Hex; logs_bloom: Hex; prev_randao: Hex; block_number: Hex; gas_limit: Hex; gas_used: Hex; timestamp: Hex; extra_data: Hex; base_fee_per_gas: Hex; block_hash: Hex; transactions: Hex[]; withdrawals?: BeaconWithdrawal[]; blob_gas_used?: Hex; excess_blob_gas?: Hex; parent_beacon_block_root?: Hex; execution_witness?: VerkleExecutionWitness; }; /** * Converts a beacon block execution payload JSON object {@link BeaconPayloadJson} to the {@link ExecutionPayload} data needed to construct a {@link Block}. * The JSON data can be retrieved from a consensus layer (CL) client on this Beacon API `/eth/v2/beacon/blocks/[block number]` */ export declare function executionPayloadFromBeaconPayload(payload: BeaconPayloadJson): ExecutionPayload; export {}; //# sourceMappingURL=from-beacon-payload.d.ts.map