import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types'; import { Fr } from '@aztec/foundation/curves/bn254'; import { EthAddress } from '@aztec/foundation/eth-address'; import { BufferReader, FieldReader } from '@aztec/foundation/serialize'; import type { FieldsOf } from '@aztec/foundation/types'; import { inspect } from 'util'; import { z } from 'zod'; import { AztecAddress } from '../aztec-address/index.js'; import { GasFees } from '../gas/gas_fees.js'; import type { UInt64 } from '../types/index.js'; /** * Global variables that are constant across the entire checkpoint (slot). * Excludes blockNumber since that varies per block within a checkpoint. */ export type CheckpointGlobalVariables = Omit, 'blockNumber'>; /** * Global variables of the L2 block. */ export declare class GlobalVariables { /** ChainId for the L2 block. */ chainId: Fr; /** Version for the L2 block. */ version: Fr; /** Block number of the L2 block. */ blockNumber: BlockNumber; /** Slot number of the L2 block */ slotNumber: SlotNumber; /** Timestamp of the L2 block. */ timestamp: UInt64; /** Recipient of block reward. */ coinbase: EthAddress; /** Address to receive fees. */ feeRecipient: AztecAddress; /** Global gas prices for this block. */ gasFees: GasFees; constructor( /** ChainId for the L2 block. */ chainId: Fr, /** Version for the L2 block. */ version: Fr, /** Block number of the L2 block. */ blockNumber: BlockNumber, /** Slot number of the L2 block */ slotNumber: SlotNumber, /** Timestamp of the L2 block. */ timestamp: UInt64, /** Recipient of block reward. */ coinbase: EthAddress, /** Address to receive fees. */ feeRecipient: AztecAddress, /** Global gas prices for this block. */ gasFees: GasFees); static get schema(): z.ZodEffects; version: import("../schemas/index.js").ZodFor; blockNumber: z.ZodEffects, z.ZodNumber>, BlockNumber, string | number | bigint>; slotNumber: import("../schemas/index.js").ZodFor; timestamp: z.ZodPipeline, z.ZodBigInt>; coinbase: import("../schemas/index.js").ZodFor; feeRecipient: import("../schemas/index.js").ZodFor; gasFees: z.ZodEffects, z.ZodBigInt>; feePerL2Gas: z.ZodPipeline, z.ZodBigInt>; }, "strip", z.ZodTypeAny, { feePerDaGas: bigint; feePerL2Gas: bigint; }, { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }>, GasFees, { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }>; }, "strip", z.ZodTypeAny, { chainId: Fr; version: Fr; blockNumber: number & { _branding: "BlockNumber"; }; slotNumber: number & { _branding: "SlotNumber"; }; timestamp: bigint; coinbase: EthAddress; feeRecipient: AztecAddress; gasFees: GasFees; }, { chainId?: any; version?: any; blockNumber: string | number | bigint; slotNumber?: any; timestamp: string | number | bigint; coinbase?: any; feeRecipient?: any; gasFees: { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }; }>, GlobalVariables, { chainId?: any; version?: any; blockNumber: string | number | bigint; slotNumber?: any; timestamp: string | number | bigint; coinbase?: any; feeRecipient?: any; gasFees: { feePerDaGas: string | number | bigint; feePerL2Gas: string | number | bigint; }; }>; getSize(): number; static from(fields: FieldsOf): GlobalVariables; /** * Creates a GlobalVariables instance from a plain object without Zod validation. * This method is optimized for performance and skips validation, making it suitable * for deserializing trusted data (e.g., from C++ via MessagePack). * @param obj - Plain object containing GlobalVariables fields * @returns A GlobalVariables instance */ static fromPlainObject(obj: any): GlobalVariables; static empty(fields?: Partial>): GlobalVariables; static fromBuffer(buffer: Buffer | BufferReader): GlobalVariables; static fromFields(fields: Fr[] | FieldReader): GlobalVariables; static getFields(fields: FieldsOf): readonly [Fr, Fr, BlockNumber, SlotNumber, bigint, EthAddress, AztecAddress, GasFees]; toBuffer(): Buffer; toFields(): Fr[]; /** * A trimmed version of the JSON representation of the global variables, * tailored for human consumption. */ toFriendlyJSON(): { blockNumber: BlockNumber; slotNumber: SlotNumber; timestamp: string; coinbase: `0x${string}`; gasFees: string; }; /** * Converts GlobalVariables to a plain object suitable for MessagePack serialization. * This method ensures that slotNumber is serialized as a Fr (Field element) to match * the C++ struct definition which expects slot_number as FF. */ toJSON(): { chainId: Fr; version: Fr; blockNumber: BlockNumber; slotNumber: Fr; timestamp: bigint; coinbase: EthAddress; feeRecipient: AztecAddress; gasFees: GasFees; }; clone(): GlobalVariables; isEmpty(): boolean; static random(overrides?: Partial>): GlobalVariables; toInspect(): { chainId: number; version: number; blockNumber: BlockNumber; slotNumber: SlotNumber; timestamp: bigint; coinbase: `0x${string}`; feeRecipient: `0x${string}`; feePerDaGas: number; feePerL2Gas: number; }; [inspect.custom](): string; equals(other: this): boolean; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xvYmFsX3ZhcmlhYmxlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R4L2dsb2JhbF92YXJpYWJsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFdBQVcsRUFBcUIsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFN0YsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUUzRCxPQUFPLEVBQ0wsWUFBWSxFQUNaLFdBQVcsRUFJWixNQUFNLDZCQUE2QixDQUFDO0FBQ3JDLE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRXhELE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDL0IsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRTdDLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRWhEOzs7R0FHRztBQUNILE1BQU0sTUFBTSx5QkFBeUIsR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDLGVBQWU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