import { DomainSeparator } from '@aztec/constants'; import { Fr } from '@aztec/foundation/curves/bn254'; import type { EthAddress } from '@aztec/foundation/eth-address'; import { AztecAddress } from '../aztec-address/index.js'; /** * Computes a hash of a given verification key. * @param keyAsFields - The verification key as fields. * @returns The hash of the verification key. */ export declare function hashVK(keyAsFields: Fr[]): Promise; /** * Computes a note hash nonce, which will be used to create a unique note hash. * @param nullifierZero - The first nullifier in the tx. * @param noteHashIndex - The index of the note hash. * @returns A note hash nonce. */ export declare function computeNoteHashNonce(nullifierZero: Fr, noteHashIndex: number): Promise; /** * Computes a siloed note hash, given the contract address and the note hash itself. * A siloed note hash effectively namespaces a note hash to a specific contract. * @param contract - The contract address * @param noteHash - The note hash to silo. * @returns A siloed note hash. */ export declare function siloNoteHash(contract: AztecAddress, noteHash: Fr): Promise; /** * Computes a unique note hash. * @param noteNonce - The nonce that was injected into the note hash preimage in order to guarantee uniqueness. * @param siloedNoteHash - A siloed note hash. * @returns A unique note hash. */ export declare function computeUniqueNoteHash(noteNonce: Fr, siloedNoteHash: Fr): Promise; /** * Computes a siloed nullifier, given the contract address and the inner nullifier. * A siloed nullifier effectively namespaces a nullifier to a specific contract. * @param contract - The contract address. * @param innerNullifier - The nullifier to silo. * @returns A siloed nullifier. */ export declare function siloNullifier(contract: AztecAddress, innerNullifier: Fr): Promise; /** * Computes the siloed private initialization nullifier for a contract, given its address and initialization hash. * @param contract - The contract address. * @param initializationHash - The contract's initialization hash. * @returns The siloed private initialization nullifier. */ export declare function computeSiloedPrivateInitializationNullifier(contract: AztecAddress, initializationHash: Fr): Promise; /** * Computes the siloed public initialization nullifier for a contract. Not all contracts emit this nullifier: it is only * emitted when the contract has public functions that perform initialization checks (i.e. external public functions that * are not `#[noinitcheck]` or `#[only_self]`). * @param contract - The contract address. * @returns The siloed public initialization nullifier. */ export declare function computeSiloedPublicInitializationNullifier(contract: AztecAddress): Promise; /** * Computes the protocol nullifier, which is the hash of the initial tx request siloed with the null msg sender address. * @param txRequestHash - The hash of the initial tx request. * @returns The siloed value of the protocol nullifier. * * @dev Must match the implementation in noir-protocol-circuits/crates/types/src/hash.nr > compute_protocol_nullifier */ export declare function computeProtocolNullifier(txRequestHash: Fr): Promise; /** Domain-separates a raw log tag with the given domain separator. */ export declare function computeLogTag(rawTag: number | bigint | boolean | Fr | Buffer, domSep: DomainSeparator): Promise; /** * Computes the commitment of a private event from its preimage. * @param randomness - Random value emitted alongside the event to prevent preimage brute-forcing. * @param eventSelector - Event selector as an Fr. * @param content - Serialized event content. * * @dev Must match the implementation in aztec-nr/aztec/src/event/event_interface.nr > compute_private_serialized_event_commitment */ export declare function computePrivateEventCommitment(randomness: Fr, eventSelector: Fr, content: Fr[]): Promise; export declare function computeSiloedPrivateLogFirstField(contract: AztecAddress, field: Fr): Promise; /** * Computes a public data tree value ready for insertion. * @param value - Raw public data tree value to hash into a tree-insertion-ready value. * @returns Value hash into a tree-insertion-ready value. */ export declare function computePublicDataTreeValue(value: Fr): Fr; /** * Computes a public data tree index from contract address and storage slot. * @param contractAddress - Contract where insertion is occurring. * @param storageSlot - Storage slot where insertion is occurring. * @returns Public data tree index computed from contract address and storage slot. */ export declare function computePublicDataTreeLeafSlot(contractAddress: AztecAddress, storageSlot: Fr): Promise; /** * Computes the hash of a list of arguments. * Used for input arguments or return values for private functions, or for authwit creation. * @param args - Arguments to hash. * @returns Hash of the arguments. */ export declare function computeVarArgsHash(args: Fr[]): Promise; /** * Computes the hash of a public function's calldata. * @param calldata - Calldata to hash. * @returns Hash of the calldata. */ export declare function computeCalldataHash(calldata: Fr[]): Promise; /** * Computes a hash of a secret. * @dev This function is used to generate secrets for the L1 to L2 message flow and for the TransparentNote. * @param secret - The secret to hash (could be generated however you want e.g. `Fr.random()`) * @returns The hash */ export declare function computeSecretHash(secret: Fr): Promise; export declare function computeL1ToL2MessageNullifier(contract: AztecAddress, messageHash: Fr, secret: Fr): Promise; /** * Calculates a siloed hash of a scoped l2 to l1 message. * @returns Fr containing 248 bits of information of sha256 hash. */ export declare function computeL2ToL1MessageHash({ l2Sender, l1Recipient, content, rollupVersion, chainId }: { l2Sender: AztecAddress; l1Recipient: EthAddress; content: Fr; rollupVersion: Fr; chainId: Fr; }): Fr; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFzaC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hhc2gvaGFzaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFHbkQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBRWhFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV6RDs7OztHQUlHO0FBQ0gsd0JBQXNCLE1BQU0sQ0FBQyxXQUFXLEVBQUUsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLEVBQUUsQ0FBQyxDQUczRDtBQUVEOzs7OztHQUtHO0FBQ0gsd0JBQWdCLG9CQUFvQixDQUFDLGFBQWEsRUFBRSxFQUFFLEVBQUUsYUFBYSxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsRUFBRSxDQUFDLENBRTFGO0FBRUQ7Ozs7OztHQU1HO0FBQ0gsd0JBQWdCLFlBQVksQ0FBQyxRQUFRLEVBQUUsWUFBWSxFQUFFLFFBQVEsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLEVBQUUsQ0FBQyxDQUU5RTtBQUVEOzs7OztHQUtHO0FBQ0gsd0JBQWdCLHFCQUFxQixDQUFDLFNBQVMsRUFBRSxFQUFFLEVBQUUsY0FBYyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsRUFBRSxDQUFDLENBRXB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