import { CustomError } from "ts-custom-error"; import { Address, GetContractReturnType, Hash, PublicClient } from "viem"; import { abi } from "../_generated/abi"; export declare class VersionRejectedByContract extends CustomError { constructor(); } export declare function handleWrongContractVersionError(func: () => Promise): Promise; export type NoteEvent = { name: "NewAccountNative" | "DepositNative" | "WithdrawNative"; contractVersion: `0x${string}`; amount: bigint; newNoteIndex: bigint; newNote: bigint; txHash: Hash; to?: Address; block: bigint; }; declare const getShielderContract: (account: PublicClient, contractAddress: Address) => GetContractReturnType; export type IContract = { getAddress: () => Address; getMerklePath: (idx: bigint) => Promise; newAccountCalldata: (expectedContractVersion: `0x${string}`, from: Address, newNote: bigint, idHash: bigint, amount: bigint, proof: Uint8Array) => Promise<`0x${string}`>; depositCalldata: (expectedContractVersion: `0x${string}`, from: Address, idHiding: bigint, oldNoteNullifierHash: bigint, newNote: bigint, merkleRoot: bigint, amount: bigint, proof: Uint8Array) => Promise<`0x${string}`>; nullifierBlock: (nullifierHash: bigint) => Promise; getNoteEventsFromBlock: (block: bigint) => Promise; }; export declare class Contract implements IContract { account: PublicClient; contract: ReturnType; constructor(account: PublicClient, contractAddress: Address); getAddress: () => `0x${string}`; getMerklePath: (idx: bigint) => Promise; newAccountCalldata: (expectedContractVersion: `0x${string}`, from: Address, newNote: bigint, idHash: bigint, amount: bigint, proof: Uint8Array) => Promise<`0x${string}`>; depositCalldata: (expectedContractVersion: `0x${string}`, from: Address, idHiding: bigint, oldNoteNullifierHash: bigint, newNote: bigint, merkleRoot: bigint, amount: bigint, proof: Uint8Array) => Promise<`0x${string}`>; /** * Returns the block number in which the nullifier was used. * If the nullifier was not used, returns null * @param nullifierHash hash of the nullifier to look for * @returns block number in which the nullifier was used, or null if it was not used */ nullifierBlock: (nullifierHash: bigint) => Promise; /** * Fetch the note indices from the contract by block number and filter them. * Stops fetching when the first event with tag is found. * @param block * @returns event array */ getNoteEventsFromBlock: (block: bigint) => Promise; } export {};