import { Fr } from '@aztec/foundation/curves/bn254'; import { z } from 'zod'; import { FunctionSelector } from '../../abi/index.js'; declare const VERSION: 1; /** * A Contract Class in the protocol. Aztec differentiates contracts classes and instances, where a * contract class represents the code of the contract, but holds no state. Classes are identified by * an id that is a commitment to all its data. */ export interface ContractClass { /** Version of the contract class. */ version: typeof VERSION; /** * Hash of the contract artifact. The specification of this hash is not enforced by the protocol. Should include * commitments to code of utility functions and compilation metadata. Intended to be used by clients to verify that * an offchain fetched artifact matches a registered class. */ artifactHash: Fr; /** List of individual private functions, constructors included. */ privateFunctions: PrivateFunction[]; /** Bytecode for the public_dispatch function, or empty. */ packedBytecode: Buffer; } /** Private function definition within a contract class. */ export interface PrivateFunction { /** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */ selector: FunctionSelector; /** Hash of the verification key associated to this private function. */ vkHash: Fr; } /** Private function definition with executable bytecode. */ export interface ExecutablePrivateFunction extends PrivateFunction { /** ACIR and Brillig bytecode */ bytecode: Buffer; } /** Utility function definition. */ export interface UtilityFunction { /** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */ selector: FunctionSelector; /** Brillig. */ bytecode: Buffer; } /** Sibling paths and sibling commitments for proving membership of a private function within a contract class. */ export type PrivateFunctionMembershipProof = { artifactMetadataHash: Fr; functionMetadataHash: Fr; utilityFunctionsTreeRoot: Fr; privateFunctionTreeSiblingPath: Fr[]; privateFunctionTreeLeafIndex: number; artifactTreeSiblingPath: Fr[]; artifactTreeLeafIndex: number; }; /** A private function with a membership proof. */ export type ExecutablePrivateFunctionWithMembershipProof = ExecutablePrivateFunction & PrivateFunctionMembershipProof; /** Sibling paths and commitments for proving membership of a utility function within a contract class. */ export type UtilityFunctionMembershipProof = { artifactMetadataHash: Fr; functionMetadataHash: Fr; privateFunctionsArtifactTreeRoot: Fr; artifactTreeSiblingPath: Fr[]; artifactTreeLeafIndex: number; }; /** A utility function with a membership proof. */ export type UtilityFunctionWithMembershipProof = UtilityFunction & UtilityFunctionMembershipProof; export declare const ContractClassSchema: z.ZodObject<{ version: z.ZodLiteral<1>; artifactHash: z.ZodType; privateFunctions: z.ZodArray; vkHash: z.ZodType; }, "strip", z.ZodTypeAny, { selector: FunctionSelector; vkHash: Fr; }, { selector?: any; vkHash: string; }>, "many">; packedBytecode: import("@aztec/foundation/schemas").ZodFor>; }, "strip", z.ZodTypeAny, { version: 1; artifactHash: Fr; privateFunctions: { selector: FunctionSelector; vkHash: Fr; }[]; packedBytecode: Buffer; }, { version: 1; artifactHash: string; privateFunctions: { selector?: any; vkHash: string; }[]; packedBytecode?: any; }>; /** Commitments to fields of a contract class. */ interface ContractClassCommitments { /** Identifier of the contract class. */ id: Fr; /** Commitment to the public bytecode. */ publicBytecodeCommitment: Fr; /** Root of the private functions tree */ privateFunctionsRoot: Fr; } /** A contract class with its precomputed id. */ export type ContractClassWithId = ContractClass & Pick; export declare const ContractClassWithIdSchema: z.ZodObject<{ version: z.ZodLiteral<1>; artifactHash: z.ZodType; privateFunctions: z.ZodArray; vkHash: z.ZodType; }, "strip", z.ZodTypeAny, { selector: FunctionSelector; vkHash: Fr; }, { selector?: any; vkHash: string; }>, "many">; packedBytecode: import("@aztec/foundation/schemas").ZodFor>; } & { id: z.ZodType; }, "strip", z.ZodTypeAny, { version: 1; artifactHash: Fr; privateFunctions: { selector: FunctionSelector; vkHash: Fr; }[]; packedBytecode: Buffer; id: Fr; }, { version: 1; artifactHash: string; privateFunctions: { selector?: any; vkHash: string; }[]; packedBytecode?: any; id: string; }>; /** A contract class with public bytecode information, and optional private and utility functions. */ export type ContractClassPublic = { privateFunctions: ExecutablePrivateFunctionWithMembershipProof[]; utilityFunctions: UtilityFunctionWithMembershipProof[]; } & Pick & Omit; export type ContractClassPublicWithCommitment = ContractClassPublic & Pick; export declare const ContractClassPublicSchema: z.ZodIntersection; privateFunctionsRoot: z.ZodType; privateFunctions: z.ZodArray; vkHash: z.ZodType; }, "strip", z.ZodTypeAny, { selector: FunctionSelector; vkHash: Fr; }, { selector?: any; vkHash: string; }>, z.ZodObject<{ bytecode: import("@aztec/foundation/schemas").ZodFor>; }, "strip", z.ZodTypeAny, { bytecode: Buffer; }, { bytecode?: any; }>>, z.ZodObject<{ artifactMetadataHash: z.ZodType; functionMetadataHash: z.ZodType; utilityFunctionsTreeRoot: z.ZodType; privateFunctionTreeSiblingPath: z.ZodArray, "many">; privateFunctionTreeLeafIndex: z.ZodPipeline, z.ZodNumber>; artifactTreeSiblingPath: z.ZodArray, "many">; artifactTreeLeafIndex: z.ZodPipeline, z.ZodNumber>; }, "strip", z.ZodTypeAny, { artifactMetadataHash: Fr; functionMetadataHash: Fr; utilityFunctionsTreeRoot: Fr; privateFunctionTreeSiblingPath: Fr[]; privateFunctionTreeLeafIndex: number; artifactTreeSiblingPath: Fr[]; artifactTreeLeafIndex: number; }, { artifactMetadataHash: string; functionMetadataHash: string; utilityFunctionsTreeRoot: string; privateFunctionTreeSiblingPath: string[]; privateFunctionTreeLeafIndex: string | number | bigint; artifactTreeSiblingPath: string[]; artifactTreeLeafIndex: string | number | bigint; }>>, "many">; utilityFunctions: z.ZodArray; bytecode: import("@aztec/foundation/schemas").ZodFor>; }, "strip", z.ZodTypeAny, { selector: FunctionSelector; bytecode: Buffer; }, { selector?: any; bytecode?: any; }>, z.ZodObject<{ artifactMetadataHash: z.ZodType; functionMetadataHash: z.ZodType; privateFunctionsArtifactTreeRoot: z.ZodType; artifactTreeSiblingPath: z.ZodArray, "many">; artifactTreeLeafIndex: z.ZodPipeline, z.ZodNumber>; }, "strip", z.ZodTypeAny, { artifactMetadataHash: Fr; functionMetadataHash: Fr; privateFunctionsArtifactTreeRoot: Fr; artifactTreeSiblingPath: Fr[]; artifactTreeLeafIndex: number; }, { artifactMetadataHash: string; functionMetadataHash: string; privateFunctionsArtifactTreeRoot: string; artifactTreeSiblingPath: string[]; artifactTreeLeafIndex: string | number | bigint; }>>, "many">; }, "strip", z.ZodTypeAny, { id: Fr; privateFunctionsRoot: Fr; privateFunctions: ({ selector: FunctionSelector; vkHash: Fr; } & { bytecode: Buffer; } & { artifactMetadataHash: Fr; functionMetadataHash: Fr; utilityFunctionsTreeRoot: Fr; privateFunctionTreeSiblingPath: Fr[]; privateFunctionTreeLeafIndex: number; artifactTreeSiblingPath: Fr[]; artifactTreeLeafIndex: number; })[]; utilityFunctions: ({ selector: FunctionSelector; bytecode: Buffer; } & { artifactMetadataHash: Fr; functionMetadataHash: Fr; privateFunctionsArtifactTreeRoot: Fr; artifactTreeSiblingPath: Fr[]; artifactTreeLeafIndex: number; })[]; }, { id: string; privateFunctionsRoot: string; privateFunctions: ({ selector?: any; vkHash: string; } & { bytecode?: any; } & { artifactMetadataHash: string; functionMetadataHash: string; utilityFunctionsTreeRoot: string; privateFunctionTreeSiblingPath: string[]; privateFunctionTreeLeafIndex: string | number | bigint; artifactTreeSiblingPath: string[]; artifactTreeLeafIndex: string | number | bigint; })[]; utilityFunctions: ({ selector?: any; bytecode?: any; } & { artifactMetadataHash: string; functionMetadataHash: string; privateFunctionsArtifactTreeRoot: string; artifactTreeSiblingPath: string[]; artifactTreeLeafIndex: string | number | bigint; })[]; }>, z.ZodObject; artifactHash: z.ZodType; privateFunctions: z.ZodArray; vkHash: z.ZodType; }, "strip", z.ZodTypeAny, { selector: FunctionSelector; vkHash: Fr; }, { selector?: any; vkHash: string; }>, "many">; packedBytecode: import("@aztec/foundation/schemas").ZodFor>; }, "privateFunctions">, "strip", z.ZodTypeAny, { version: 1; artifactHash: Fr; packedBytecode: Buffer; }, { version: 1; artifactHash: string; packedBytecode?: any; }>>; /** The contract class with the block it was initially deployed at */ export type ContractClassPublicWithBlockNumber = { l2BlockNumber: number; } & ContractClassPublic; /** * Creates a ContractClassPublic from a plain object without Zod validation. * Suitable for deserializing trusted data (e.g., from C++ via MessagePack). * Note: privateFunctions and utilityFunctions are set to empty arrays since * C++ does not provide them. */ export declare function contractClassPublicFromPlainObject(obj: any): ContractClassPublic; export {}; //# sourceMapping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