/** * This file exports types and functions that actually should be exported from o1js */ import { Field, type InferProvable, type InferValue, Provable, type ProvableHashable, type ProvablePure } from 'o1js'; import type { NestedProvable } from './nested.ts'; import type { Json } from './types.ts'; export { ProvableType, assertPure, type ProvablePureType, type ProvableHashableType, type ProvableHashablePure, type ProvableHashableWide, array, toFieldsPacked, hashPacked, empty, toInput, HashInput, }; declare const ProvableType: { get(type: A): ToProvable; fromValue(value: T): ProvableHashableType; synthesize(type_: ProvableType): T; isProvableType(type: unknown): type is ProvableType; isProvableHashableType(type: unknown): type is ProvableHashableType; constant(value: T): ProvablePure & { serialize(): any; }; }; declare function assertPure(type_: Provable): asserts type_ is ProvablePure; declare function assertPure(type: ProvableType): asserts type is ProvablePureType; type WithProvable = { provable: A; } | A; type ProvableType = WithProvable>; type ProvablePureType = WithProvable>; type ProvableHashableType = WithProvable>; type ProvableHashableWide = Omit, 'fromValue'> & { fromValue: (value: T | W) => T; }; type ToProvable> = A extends { provable: infer P; } ? P : A; type HashInput = { fields?: Field[]; packed?: [Field, number][]; }; type MaybeHashable = { toInput?: (x: T) => HashInput; empty?: () => T; }; type ProvableMaybeHashable = Provable & MaybeHashable; type ProvableHashablePure = ProvablePure & ProvableHashable; /** * Pack a value to as few field elements as possible using `toInput()`, falling back to `toFields()` if that's not available. * * Note: Different than `Packed` in o1js, this uses little-endian packing. */ declare function toFieldsPacked(type_: WithProvable>, value: T): Field[]; /** * Hash a provable value efficiently, by first packing it into as few field elements as possible. * * Note: Different than `Poseidon.hashPacked()` and `Hashed` (by default) in o1js, this uses little-endian packing. */ declare function hashPacked(type: WithProvable>, value: T): Field; declare function array(elementType: A, length: number): { _isArray: true; innerType: A; size: number; /** * Returns the size of this structure in {@link Field} elements. * @returns size of this structure */ sizeInFields(): number; /** * Serializes this structure into {@link Field} elements. * @returns an array of {@link Field} elements */ toFields(array: InferProvable[]): import("node_modules/o1js/dist/node/lib/provable/field.js").Field[]; /** * Serializes this structure's auxiliary data. * @returns auxiliary data */ toAuxiliary(array?: InferProvable[] | undefined): any[][]; /** * Deserializes an array of {@link Field} elements into this structure. */ fromFields(fields: Field[], aux?: any[]): InferProvable[]; check(array: InferProvable[]): void; toCanonical(x: InferProvable[]): import("node_modules/o1js/dist/node/bindings/lib/provable-generic.js").InferProvable[]; toValue(x: InferProvable[]): InferValue[]; fromValue(x: InferProvable[] | InferValue[]): import("node_modules/o1js/dist/node/bindings/lib/provable-generic.js").InferProvable[]; toInput(array: InferProvable[]): {}; empty(): import("node_modules/o1js/dist/node/bindings/lib/provable-generic.js").InferProvable[]; }; declare const HashInput: { readonly empty: {}; append(input1: HashInput, input2: HashInput): HashInput; }; declare function toInput(type: ProvableMaybeHashable, value: T): HashInput; declare function empty(type: ProvableMaybeHashable): T;