/** * This is a little library to streamline the creation of new provable types. */ import { type ProvableHashable, type InferProvable, type InferValue, type IsPure, type Field } from 'o1js'; import type { NestedProvable } from './nested.ts'; import type { HashInput, ProvableHashablePure } from './o1js-missing.ts'; export { TypeBuilder, TypeBuilderPure }; declare class TypeBuilder { type: ProvableHashable; constructor(type: ProvableHashable); static shape(nested: A): IsPure extends true ? TypeBuilderPure, InferValue> : TypeBuilder, InferValue>; build(): this['type']; forClass(Class: new (t: T) => C): TypeBuilder; forConstructor(constructor: (t: T) => C): TypeBuilder; mapValue(transform: { there: (x: V) => W; back: (x: W) => V; distinguish: (x: T | W) => x is T; } | { there: (x: V) => W; backAndDistinguish: (x: W | T) => V | T; }): TypeBuilder; replaceCheck(check: (x: T) => void): TypeBuilder; withAdditionalCheck(check: (x: T) => void): TypeBuilder; hashInput(toInput: (x: T) => HashInput): TypeBuilder; } declare class TypeBuilderPure extends TypeBuilder { type: ProvableHashablePure; constructor(type: ProvableHashablePure); forClass(Class: new (t: T) => C): TypeBuilderPure; forConstructor(constructor: (t: T) => C): TypeBuilderPure; mapValue(transform: { there: (x: V) => W; back: (x: W) => V; distinguish: (x: T | W) => x is T; } | { there: (x: V) => W; backAndDistinguish: (x: W | T) => V | T; }): TypeBuilderPure; replaceCheck(check: (x: T) => void): TypeBuilderPure; withAdditionalCheck(check: (x: T) => void): TypeBuilderPure; }