@noir-lang/acvm_js
Advanced tools
Comparing version 0.30.0-a01549b.nightly to 0.30.0-a098541.nightly
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function buildInfo(): number; | ||
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
@@ -13,11 +20,4 @@ export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
export function and(a: number, b: number): number; | ||
export function buildInfo(): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function __wbg_trap_free(a: number): void; | ||
@@ -28,6 +28,6 @@ export function trap___wbgd_downcast_token(): number; | ||
export const __wbindgen_export_2: WebAssembly.Table; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(a: number, b: number, c: number): void; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h52952476ed423c11(a: number, b: number, c: number): void; | ||
export function __wbindgen_add_to_stack_pointer(a: number): number; | ||
export function __wbindgen_free(a: number, b: number): void; | ||
export function __wbindgen_exn_store(a: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(a: number, b: number, c: number, d: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h59b9f7ecd67d6688(a: number, b: number, c: number, d: number): void; |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo(): BuildInfo; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -69,68 +122,15 @@ * @param {Uint8Array} hashed_msg | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo(): BuildInfo; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
@@ -151,2 +151,11 @@ export type ForeignCallInput = string[] | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
/** | ||
@@ -166,6 +175,2 @@ * @typedef {Object} BuildInfo - Information about how the installed package was built | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
export type ExecutionError = Error & { | ||
@@ -176,7 +181,2 @@ callStack?: string[]; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
/** | ||
@@ -183,0 +183,0 @@ * A struct representing a Trap |
@@ -53,24 +53,2 @@ let imports = {}; | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
@@ -131,2 +109,24 @@ | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedBigInt64Memory0 = null; | ||
@@ -231,3 +231,3 @@ | ||
function __wbg_adapter_54(arg0, arg1, arg2) { | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(arg0, arg1, addHeapObject(arg2)); | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h52952476ed423c11(arg0, arg1, addHeapObject(arg2)); | ||
} | ||
@@ -242,13 +242,17 @@ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.decompressWitness = function(compressed_witness) { | ||
module.exports.getPublicWitness = function(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -266,26 +270,25 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.compressWitness = function(witness_map) { | ||
module.exports.getPublicParametersWitness = function(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
return takeObject(r0); | ||
} finally { | ||
@@ -297,2 +300,94 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.getReturnWitness = function(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
}; | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
module.exports.createBlackBoxSolver = function() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
module.exports.initLogLevel = function(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
}; | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
module.exports.buildInfo = function() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -340,2 +435,6 @@ * @param {Uint8Array} hashed_msg | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
@@ -427,81 +526,13 @@ * Calculates the Keccak256 hash of the input bytes | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
module.exports.buildInfo = function() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
}; | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
module.exports.createBlackBoxSolver = function() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
}; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
module.exports.initLogLevel = function(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
}; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.getPublicWitness = function(circuit, solved_witness) { | ||
module.exports.decompressWitness = function(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -520,24 +551,21 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
module.exports.getPublicParametersWitness = function(circuit, solved_witness) { | ||
module.exports.compressWitness = function(witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
return takeObject(r0); | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
} finally { | ||
@@ -548,30 +576,2 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
module.exports.getReturnWitness = function(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
}; | ||
function handleError(f, args) { | ||
@@ -585,3 +585,3 @@ try { | ||
function __wbg_adapter_155(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h59b9f7ecd67d6688(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
} | ||
@@ -644,2 +644,12 @@ | ||
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_error_new = function(arg0, arg1) { | ||
@@ -655,2 +665,11 @@ const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
module.exports.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
}; | ||
module.exports.__wbindgen_is_string = function(arg0) { | ||
@@ -661,14 +680,9 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
module.exports.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
module.exports.__wbg_new_e290c3c041336f87 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
module.exports.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
@@ -684,14 +698,10 @@ }; | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
module.exports.__wbg_constructor_6e18ba778d67e20b = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
@@ -709,17 +719,7 @@ | ||
module.exports.__wbg_new_e290c3c041336f87 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_constructor_6e18ba778d67e20b = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -765,12 +765,2 @@ const ret = new Error(); | ||
module.exports.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_bigint_from_u64 = function(arg0) { | ||
@@ -786,10 +776,9 @@ const ret = BigInt.asUintN(64, arg0); | ||
module.exports.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
module.exports.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_is_function = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'function'; | ||
module.exports.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
@@ -809,2 +798,13 @@ }; | ||
module.exports.__wbindgen_is_function = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'function'; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
return ret; | ||
}; | ||
module.exports.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() { | ||
@@ -1211,4 +1211,4 @@ const ret = Symbol; | ||
module.exports.__wbindgen_closure_wrapper631 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_54); | ||
module.exports.__wbindgen_closure_wrapper505 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_54); | ||
return addHeapObject(ret); | ||
@@ -1215,0 +1215,0 @@ }; |
{ | ||
"name": "@noir-lang/acvm_js", | ||
"version": "0.30.0-a01549b.nightly", | ||
"version": "0.30.0-a098541.nightly", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export const memory: WebAssembly.Memory; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function buildInfo(): number; | ||
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
@@ -13,11 +20,4 @@ export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number; | ||
export function and(a: number, b: number): number; | ||
export function buildInfo(): number; | ||
export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number; | ||
export function executeCircuit(a: number, b: number, c: number, d: number): number; | ||
export function createBlackBoxSolver(): number; | ||
export function __wbg_wasmblackboxfunctionsolver_free(a: number): void; | ||
export function initLogLevel(a: number): void; | ||
export function getPublicWitness(a: number, b: number, c: number, d: number): void; | ||
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void; | ||
export function getReturnWitness(a: number, b: number, c: number, d: number): void; | ||
export function decompressWitness(a: number, b: number, c: number): void; | ||
export function compressWitness(a: number, b: number): void; | ||
export function __wbg_trap_free(a: number): void; | ||
@@ -28,6 +28,6 @@ export function trap___wbgd_downcast_token(): number; | ||
export const __wbindgen_export_2: WebAssembly.Table; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(a: number, b: number, c: number): void; | ||
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h52952476ed423c11(a: number, b: number, c: number): void; | ||
export function __wbindgen_add_to_stack_pointer(a: number): number; | ||
export function __wbindgen_free(a: number, b: number): void; | ||
export function __wbindgen_exn_store(a: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(a: number, b: number, c: number, d: number): void; | ||
export function wasm_bindgen__convert__closures__invoke2_mut__h59b9f7ecd67d6688(a: number, b: number, c: number, d: number): void; |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo(): BuildInfo; | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -69,68 +122,15 @@ * @param {Uint8Array} hashed_msg | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo(): BuildInfo; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap; | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>; | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>; | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level: LogLevel): void; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap; | ||
export function compressWitness(witness_map: WitnessMap): Uint8Array; | ||
@@ -151,2 +151,11 @@ export type ForeignCallInput = string[] | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
/** | ||
@@ -166,6 +175,2 @@ * @typedef {Object} BuildInfo - Information about how the installed package was built | ||
export type LogLevel = "OFF" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE"; | ||
export type ExecutionError = Error & { | ||
@@ -176,7 +181,2 @@ callStack?: string[]; | ||
// Map from witness index to hex string value of witness. | ||
export type WitnessMap = Map<number, string>; | ||
/** | ||
@@ -202,4 +202,11 @@ * A struct representing a Trap | ||
readonly memory: WebAssembly.Memory; | ||
readonly decompressWitness: (a: number, b: number, c: number) => void; | ||
readonly compressWitness: (a: number, b: number) => void; | ||
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number; | ||
readonly createBlackBoxSolver: () => number; | ||
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void; | ||
readonly initLogLevel: (a: number) => void; | ||
readonly buildInfo: () => number; | ||
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; | ||
@@ -212,11 +219,4 @@ readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number; | ||
readonly and: (a: number, b: number) => number; | ||
readonly buildInfo: () => number; | ||
readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number; | ||
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number; | ||
readonly createBlackBoxSolver: () => number; | ||
readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void; | ||
readonly initLogLevel: (a: number) => void; | ||
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void; | ||
readonly decompressWitness: (a: number, b: number, c: number) => void; | ||
readonly compressWitness: (a: number, b: number) => void; | ||
readonly __wbg_trap_free: (a: number) => void; | ||
@@ -227,7 +227,7 @@ readonly trap___wbgd_downcast_token: () => number; | ||
readonly __wbindgen_export_2: WebAssembly.Table; | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5: (a: number, b: number, c: number) => void; | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h52952476ed423c11: (a: number, b: number, c: number) => void; | ||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; | ||
readonly __wbindgen_free: (a: number, b: number) => void; | ||
readonly __wbindgen_exn_store: (a: number) => void; | ||
readonly wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade: (a: number, b: number, c: number, d: number) => void; | ||
readonly wasm_bindgen__convert__closures__invoke2_mut__h59b9f7ecd67d6688: (a: number, b: number, c: number, d: number) => void; | ||
} | ||
@@ -234,0 +234,0 @@ |
@@ -50,24 +50,2 @@ let wasm; | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
@@ -128,2 +106,24 @@ | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedBigInt64Memory0 = null; | ||
@@ -228,3 +228,3 @@ | ||
function __wbg_adapter_54(arg0, arg1, arg2) { | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(arg0, arg1, addHeapObject(arg2)); | ||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h52952476ed423c11(arg0, arg1, addHeapObject(arg2)); | ||
} | ||
@@ -239,13 +239,17 @@ | ||
/** | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function decompressWitness(compressed_witness) { | ||
export function getPublicWitness(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -263,26 +267,53 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicParametersWitness(circuit, solved_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
/** | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function compressWitness(witness_map) { | ||
export function getReturnWitness(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
return takeObject(r0); | ||
} finally { | ||
@@ -293,3 +324,67 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
} | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Verifies a ECDSA signature over the secp256r1 curve. | ||
@@ -337,2 +432,6 @@ * @param {Uint8Array} hashed_msg | ||
function getArrayU8FromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); | ||
} | ||
/** | ||
@@ -424,81 +523,13 @@ * Calculates the Keccak256 hash of the input bytes | ||
/** | ||
* Returns the `BuildInfo` object containing information about how the installed package was built. | ||
* @returns {BuildInfo} - Information on how the installed package was built. | ||
*/ | ||
export function buildInfo() { | ||
const ret = wasm.buildInfo(); | ||
return takeObject(ret); | ||
} | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`. | ||
* | ||
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver. | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
* @param {Uint8Array} compressed_witness - A compressed witness. | ||
* @returns {WitnessMap} The decompressed witness map. | ||
*/ | ||
export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) { | ||
_assertClass(solver, WasmBlackBoxFunctionSolver); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Executes an ACIR circuit to generate the solved witness from the initial witness. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`.. | ||
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit. | ||
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs. | ||
*/ | ||
export function executeCircuit(circuit, initial_witness, foreign_call_handler) { | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler)); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {Promise<WasmBlackBoxFunctionSolver>} | ||
*/ | ||
export function createBlackBoxSolver() { | ||
const ret = wasm.createBlackBoxSolver(); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* Sets the package's logging level. | ||
* | ||
* @param {LogLevel} level - The maximum level of logging to be emitted. | ||
*/ | ||
export function initLogLevel(level) { | ||
wasm.initLogLevel(addHeapObject(level)); | ||
} | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public inputs. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getPublicWitness(circuit, solved_witness) { | ||
export function decompressWitness(compressed_witness) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.decompressWitness(retptr, ptr0, len0); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -517,24 +548,21 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters. | ||
* Compresses a `WitnessMap` into the binary format outputted by Nargo. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's public parameters. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} solved_witness | ||
* @returns {WitnessMap} | ||
* @param {Uint8Array} compressed_witness - A witness map. | ||
* @returns {WitnessMap} A compressed witness map | ||
*/ | ||
export function getPublicParametersWitness(circuit, solved_witness) { | ||
export function compressWitness(witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness)); | ||
wasm.compressWitness(retptr, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
var r3 = getInt32Memory0()[retptr / 4 + 3]; | ||
if (r3) { | ||
throw takeObject(r2); | ||
} | ||
return takeObject(r0); | ||
var v1 = getArrayU8FromWasm0(r0, r1).slice(); | ||
wasm.__wbindgen_free(r0, r1 * 1); | ||
return v1; | ||
} finally { | ||
@@ -545,30 +573,2 @@ wasm.__wbindgen_add_to_stack_pointer(16); | ||
/** | ||
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values. | ||
* | ||
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit | ||
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit. | ||
* @returns {WitnessMap} A witness map containing the circuit's return values. | ||
* @param {Uint8Array} circuit | ||
* @param {WitnessMap} witness_map | ||
* @returns {WitnessMap} | ||
*/ | ||
export function getReturnWitness(circuit, witness_map) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc); | ||
const len0 = WASM_VECTOR_LEN; | ||
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
var r2 = getInt32Memory0()[retptr / 4 + 2]; | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
} | ||
function handleError(f, args) { | ||
@@ -582,3 +582,3 @@ try { | ||
function __wbg_adapter_155(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h59b9f7ecd67d6688(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
} | ||
@@ -672,2 +672,10 @@ | ||
}; | ||
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_error_new = function(arg0, arg1) { | ||
@@ -681,2 +689,10 @@ const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
}; | ||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
}; | ||
imports.wbg.__wbindgen_is_string = function(arg0) { | ||
@@ -686,12 +702,8 @@ const ret = typeof(getObject(arg0)) === 'string'; | ||
}; | ||
imports.wbg.__wbindgen_is_array = function(arg0) { | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
imports.wbg.__wbg_new_e290c3c041336f87 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_wasmblackboxfunctionsolver_new = function(arg0) { | ||
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0); | ||
imports.wbg.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
@@ -705,13 +717,9 @@ }; | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
imports.wbg.__wbg_constructor_6e18ba778d67e20b = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len1 = WASM_VECTOR_LEN; | ||
getInt32Memory0()[arg0 / 4 + 1] = len1; | ||
getInt32Memory0()[arg0 / 4 + 0] = ptr1; | ||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
@@ -727,14 +735,6 @@ imports.wbg.__wbindgen_cb_drop = function(arg0) { | ||
}; | ||
imports.wbg.__wbg_new_e290c3c041336f87 = function() { | ||
const ret = new Map(); | ||
return addHeapObject(ret); | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_number_new = function(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_constructor_6e18ba778d67e20b = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -774,10 +774,2 @@ const ret = new Error(); | ||
}; | ||
imports.wbg.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) { | ||
@@ -791,9 +783,8 @@ const ret = BigInt.asUintN(64, arg0); | ||
}; | ||
imports.wbg.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { | ||
const ret = getObject(arg0) === getObject(arg1); | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_function = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'function'; | ||
imports.wbg.__wbindgen_is_bigint = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'bigint'; | ||
return ret; | ||
@@ -811,2 +802,11 @@ }; | ||
}; | ||
imports.wbg.__wbindgen_is_function = function(arg0) { | ||
const ret = typeof(getObject(arg0)) === 'function'; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_object = function(arg0) { | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
return ret; | ||
}; | ||
imports.wbg.__wbg_static_accessor_SYMBOL_45d4d15e3c4aeb33 = function() { | ||
@@ -1141,4 +1141,4 @@ const ret = Symbol; | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper631 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_54); | ||
imports.wbg.__wbindgen_closure_wrapper505 = function(arg0, arg1, arg2) { | ||
const ret = makeMutClosure(arg0, arg1, 160, __wbg_adapter_54); | ||
return addHeapObject(ret); | ||
@@ -1145,0 +1145,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3389175