import { Bool, ProvablePure, Pickles, Provable } from '../snarky.js'; import { Context } from './global-context.js'; export { Proof, SelfProof, ZkProgram, verify }; export { CompiledTag, sortMethodArguments, getPreviousProofsForProver, MethodInterface, GenericArgument, picklesRuleFromFunction, compileProgram, analyzeMethod, emptyValue, emptyWitness, synthesizeMethodArguments, methodArgumentsToConstant, methodArgumentTypesAndValues, isAsFields, snarkContext, Prover, inProver, inCompile, inAnalyze, inCheckedComputation, inCompileMode, }; declare type SnarkContext = { witnesses?: unknown[]; proverData?: any; inProver?: boolean; inCompile?: boolean; inCheckedComputation?: boolean; inAnalyze?: boolean; inRunAndCheck?: boolean; inWitnessBlock?: boolean; }; declare let snarkContext: Context.t; declare class Proof { static publicInputType: ProvablePure; static tag: () => { name: string; }; publicInput: T; proof: RawProof; maxProofsVerified: 0 | 1 | 2; shouldVerify: Bool; verify(): void; verifyIf(condition: Bool): void; toJSON(): JsonProof; static fromJSON>(this: S, { maxProofsVerified, proof: proofString, publicInput: publicInputJson, }: JsonProof): Proof>; constructor({ proof, publicInput, maxProofsVerified, }: { proof: RawProof; publicInput: T; maxProofsVerified: 0 | 1 | 2; }); } declare function verify(proof: Proof | JsonProof, verificationKey: string): Promise; declare type RawProof = unknown; declare type JsonProof = { publicInput: string[]; maxProofsVerified: 0 | 1 | 2; proof: string; }; declare type CompiledTag = unknown; declare let CompiledTag: { get(tag: any): CompiledTag | undefined; store(tag: any, compiledTag: CompiledTag): void; }; declare function ZkProgram, Types extends { [I in string]: Tuple; }>({ publicInput: publicInputType, methods, }: { publicInput: PublicInputType; methods: { [I in keyof Types]: Method, Types[I]>; }; }): { name: string; compile: () => Promise<{ verificationKey: string; }>; verify: (proof: Proof>) => Promise; digest: () => string; publicInputType: PublicInputType; } & { [I in keyof Types]: Prover, Types[I]>; }; declare namespace ZkProgram { var Proof: >(program: { name: string; publicInputType: PublicInputType; }) => { new ({ proof, publicInput, maxProofsVerified, }: { proof: unknown; publicInput: InferInstance; maxProofsVerified: 0 | 2 | 1; }): { publicInput: InferInstance; proof: unknown; maxProofsVerified: 0 | 2 | 1; shouldVerify: Bool; verify(): void; verifyIf(condition: Bool): void; toJSON(): JsonProof; }; publicInputType: PublicInputType; tag: () => { name: string; publicInputType: PublicInputType; }; fromJSON>(this: S, { maxProofsVerified, proof, publicInput, }: JsonProof): Proof>; }; } declare class SelfProof extends Proof { } declare function sortMethodArguments(programName: string, methodName: string, privateInputs: unknown[], selfProof: Subclass): MethodInterface; declare function isAsFields(type: unknown): type is Provable & ObjectConstructor; declare class GenericArgument { isEmpty: boolean; constructor(isEmpty?: boolean); } declare function getPreviousProofsForProver(methodArgs: any[], { allArgs, proofArgs }: MethodInterface): Pickles.ProofWithPublicInput[]; declare type MethodInterface = { methodName: string; witnessArgs: Provable[]; proofArgs: Subclass[]; genericArgs: Subclass[]; allArgs: { type: 'witness' | 'proof' | 'generic'; index: number; }[]; returnType?: Provable; }; declare function compileProgram(publicInputType: ProvablePure, methodIntfs: MethodInterface[], methods: ((...args: any) => void)[], proofSystemTag: { name: string; }): { getVerificationKeyArtifact: () => { data: string; hash: string; }; provers: Pickles.Prover[]; verify: (publicInput: Pickles.PublicInput, proof: unknown) => Promise; tag: unknown; }; declare function analyzeMethod(publicInputType: ProvablePure, methodIntf: MethodInterface, method: (...args: any) => T): { rows: number; digest: string; result: T; }; declare function picklesRuleFromFunction(publicInputType: ProvablePure, func: (...args: unknown[]) => void, proofSystemTag: { name: string; }, { methodName, witnessArgs, proofArgs, allArgs }: MethodInterface): Pickles.Rule; declare function synthesizeMethodArguments({ allArgs, proofArgs, witnessArgs }: MethodInterface, asVariables?: boolean): unknown[]; declare function methodArgumentsToConstant({ allArgs, proofArgs, witnessArgs }: MethodInterface, args: any[]): any[]; declare type TypeAndValue = { type: Provable; value: T; }; declare function methodArgumentTypesAndValues({ allArgs, proofArgs, witnessArgs }: MethodInterface, args: unknown[]): TypeAndValue[]; declare function emptyValue(type: Provable): T; declare function emptyWitness(type: Provable): T; declare function Prover(): { run(witnesses: unknown[], proverData: ProverData, callback: () => Promise): Promise<[SnarkContext, Result]>; getData(): ProverData; }; declare function inProver(): boolean; declare function inCompile(): boolean; declare function inAnalyze(): boolean; declare function inCheckedComputation(): boolean; declare function inCompileMode(): boolean; declare type Tuple = [T, ...T[]] | []; declare type InferInstance = T extends new (...args: any) => any ? InstanceType : never; declare type TupleToInstances = { [I in keyof T]: InferInstance; }; declare type Subclass any> = (new (...args: any) => InstanceType) & { [K in keyof Class]: Class[K]; } & { prototype: InstanceType; }; declare type PrivateInput = Provable | Subclass; declare type Method> = { privateInputs: Args; method(publicInput: PublicInput, ...args: TupleToInstances): void; }; declare type Prover> = (publicInput: PublicInput, ...args: TupleToInstances) => Promise>;