import { Halo2LibWasm, Halo2Wasm } from "@axiom-crypto/halo2-wasm/web"; import { CircuitValue } from "./CircuitValue"; import { RawCircuitInput } from "../shared/types"; export declare class Halo2Lib { private _halo2wasm; private _halo2lib; private _firstPass; private _MAX_BITS; constructor(halo2wasm: Halo2Wasm, circuit: Halo2LibWasm, options?: { firstPass?: boolean; }); private Cell; private getPaddedNumBits; /** * Creates a circuit variable from a number, bigint, or string. * * @param a - The raw circuit input. * @returns The witness cell. */ witness: (a: RawCircuitInput) => CircuitValue; /** * Creates a circuit constant from a number, bigint, or string. * * @param a - The raw circuit input. * @returns The constant cell. */ constant: (a: RawCircuitInput) => CircuitValue; /** * Adds two circuit values. * * @param a - The first circuit value. * @param b - The second circuit value. * @returns The sum of the two circuit values. */ add: (a: CircuitValue, b: CircuitValue) => CircuitValue; /** * Subtracts the second circuit value from the first circuit value. * * @param a - The first circuit value. * @param b - The second circuit value. * @returns The difference between the two circuit values. */ sub: (a: CircuitValue, b: CircuitValue) => CircuitValue; /** * Negates a circuit value. * * @param a - The circuit value to negate. * @returns The negation of the circuit value. */ neg: (a: CircuitValue) => CircuitValue; /** * Multiplies two circuit values. * * @param a - The first circuit value. * @param b - The second circuit value. * @returns The product of the two circuit values. */ mul: (a: CircuitValue, b: CircuitValue) => CircuitValue; /** * Multiplies two circuit values and adds a third circuit value. * * @param a - The first circuit value. * @param b - The second circuit value. * @param c - The third circuit value. * @returns The result of multiplying the first two circuit values and adding the third circuit value. */ mulAdd: (a: CircuitValue, b: CircuitValue, c: CircuitValue) => CircuitValue; /** * Multiplies a circuit value by the negation of another circuit value. * * @param a - The first circuit value. * @param b - The second circuit value. * @returns The result of multiplying the first circuit value by the negation of the second circuit value. */ mulNot: (a: CircuitValue, b: CircuitValue) => CircuitValue; /** * Asserts that a circuit value is a bit. * * @param a - The circuit value to assert. */ assertBit: (a: CircuitValue) => void; /** * Asserts that a circuit value is a constant. * * @param a - The circuit value to assert. * @param b - The raw circuit input. */ assertIsConst: (a: CircuitValue, b: RawCircuitInput) => void; /** * Computes the inner product of two arrays of circuit values. * * @param a - The first array of circuit values. * @param b - The second array of circuit values. * @returns The inner product of the two arrays. */ innerProduct: (a: CircuitValue[], b: CircuitValue[]) => CircuitValue; /** * Computes the sum of an array of circuit values. * * @param arr - The array of circuit values. * @returns The sum of the array of circuit values. */ sum: (arr: CircuitValue[]) => CircuitValue; /** * Performs a bitwise AND operation on two circuit values. * * @param a - The first circuit value. * @param b - The second circuit value. * @returns The result of the bitwise AND operation. */ and: (a: CircuitValue, b: CircuitValue) => CircuitValue; /** * Performs a bitwise OR operation on two circuit values. * * @param a - The first circuit value. * @param b - The second circuit value. * @returns The result of the bitwise OR operation. */ or: (a: CircuitValue, b: CircuitValue) => CircuitValue; /** * Performs a bitwise NOT operation on a circuit value. * * @param a - The circuit value. * @returns The result of the bitwise NOT operation. */ not: (a: CircuitValue) => CircuitValue; /** * Decrements a circuit value by 1. * * @param a - The circuit value. * @returns The decremented circuit value. */ dec: (a: CircuitValue) => CircuitValue; /** * Selects a circuit value based on a condition. * * @param a - The condition circuit value. * @param b - The first circuit value. * @param c - The second circuit value. * @returns The selected circuit value. */ select: (a: CircuitValue, b: CircuitValue, c: CircuitValue) => CircuitValue; /** * Performs a bitwise OR-AND operation on three circuit values. * * @param a - The first circuit value. * @param b - The second circuit value. * @param c - The third circuit value. * @returns The result of the OR-AND operation. */ orAnd: (a: CircuitValue, b: CircuitValue, c: CircuitValue) => CircuitValue; /** * Converts an array of circuit values to an indicator array. * * @param bits - The array of circuit values. * @returns The indicator circuit value. */ bitsToIndicator: (bits: CircuitValue[]) => CircuitValue[]; /** * Converts an index circuit value to an indicator circuit value. * * @param idx - The index circuit value. * @param len - The length of the indicator circuit value. * @returns The indicator circuit value. */ idxToIndicator: (idx: CircuitValue, len: RawCircuitInput) => CircuitValue[]; /** * Selects circuit values from an array based on an indicator circuit value. * * @param arr - The array of circuit values. * @param indicator - The indicator circuit value. * @returns The selected circuit values. */ selectByIndicator: (arr: CircuitValue[], indicator: CircuitValue[]) => CircuitValue; /** * Selects a circuit value from an array based on an index circuit value. * * @param arr - The array of circuit values. * @param idx - The index circuit value. * @returns The selected circuit value. */ selectFromIdx: (arr: CircuitValue[], idx: CircuitValue) => CircuitValue; /** * Checks if a circuit value is zero. * * @param a - The circuit value to check. * @returns The indicator circuit value representing whether the input is zero. */ isZero: (a: CircuitValue) => CircuitValue; /** * Checks if two circuit values are equal. * * @param a - The first circuit value. * @param b - The second circuit value. * @returns The indicator circuit value representing whether the two inputs are equal. */ isEqual: (a: CircuitValue, b: CircuitValue) => CircuitValue; /** * Converts a circuit value to an array of bits. * * @param a - The circuit value to convert. * @param len - The length of the resulting bit array. * @returns The array of bits representing the input circuit value. */ numToBits: (a: CircuitValue, len: RawCircuitInput) => CircuitValue[]; /** * Asserts that two circuit values are equal. * * @param a - The first circuit value. * @param b - The second circuit value. */ checkEqual: (a: CircuitValue, b: CircuitValue) => void; /** * Checks if a circuit value is within a specified range. * * @param a - The circuit value to check. * @param b - The range of the circuit value. */ rangeCheck: (a: CircuitValue, b: RawCircuitInput) => void; /** * Checks if the first circuit value is less than the second circuit value. * * @param a - The first circuit value. * @param b - The second circuit value. * @param c - The range of the circuit values. */ checkLessThan: (a: CircuitValue, b: CircuitValue, c?: string) => void; /** * Checks if the first circuit value is less than the second circuit value. * * @param a - The first circuit value. * @param b - The second circuit value. * @param c - The range of the circuit values. * @returns The indicator circuit value representing whether the first input is less than the second input. */ isLessThan: (a: CircuitValue, b: CircuitValue, c?: string) => CircuitValue; /** * Divides two circuit values and returns the quotient. * * @param a - The dividend circuit value. * @param b - The divisor circuit value. * @returns The quotient. * */ div: (a: CircuitValue, b: CircuitValue, c?: string, d?: string) => CircuitValue; /** * Divides two circuit values and returns the remainder. * * @param a - The dividend circuit value. * @param b - The divisor circuit value. * @returns The remainder. * */ mod: (a: CircuitValue, b: CircuitValue, c?: string, d?: string) => CircuitValue; /** * Raises a circuit value to the power of another circuit value. * * @param a - The base circuit value. * @param b - The exponent circuit value. * @returns The result of the exponentiation. */ pow: (a: CircuitValue, b: CircuitValue, c?: string) => CircuitValue; /** * Computes the Poseidon hash of multiple circuit values. * * @param args - The circuit values to hash. * @returns The hash value. */ poseidon: (...args: CircuitValue[]) => CircuitValue; /** * Retrieves the value of a circuit value. * * @param a - The circuit value. * @returns The value of the circuit value. */ value: (a: CircuitValue) => string; /** * Logs the provided *circuit* values to the console. Use `console.log` for normal logging. * * @param args - The values to log (can be `CircuitValue`s or `CircuitValue256`s). */ log: (...args: any) => void; /** * Makes a circuit value public. * * @param a - The circuit value to make public. */ makePublic: (a: CircuitValue) => void; ecdsaBenchmark: (sk: bigint, msg_hash: bigint, k: bigint) => CircuitValue; }