@noir-lang/acvm_js 0.28.0-88682da → 0.28.0-e88ce80.nightly

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
- *
6
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
7
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
8
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
9
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
10
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
11
- */
12
- export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
13
- /**
14
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
15
- *
16
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
17
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
18
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
19
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
20
- */
21
- export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
22
- /**
23
- * @returns {Promise<WasmBlackBoxFunctionSolver>}
24
- */
25
- export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
26
- /**
27
4
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
28
5
  *
29
6
  * @param {Uint8Array} compressed_witness - A compressed witness.
@@ -38,6 +15,11 @@ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
38
15
  */
39
16
  export function compressWitness(witness_map: WitnessMap): Uint8Array;
40
17
  /**
18
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
19
+ * @returns {BuildInfo} - Information on how the installed package was built.
20
+ */
21
+ export function buildInfo(): BuildInfo;
22
+ /**
41
23
  * Verifies a ECDSA signature over the secp256r1 curve.
42
24
  * @param {Uint8Array} hashed_msg
43
25
  * @param {Uint8Array} public_key_x_bytes
@@ -89,10 +71,28 @@ export function xor(lhs: string, rhs: string): string;
89
71
  */
90
72
  export function and(lhs: string, rhs: string): string;
91
73
  /**
92
- * Returns the `BuildInfo` object containing information about how the installed package was built.
93
- * @returns {BuildInfo} - Information on how the installed package was built.
74
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
75
+ *
76
+ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
77
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
78
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
79
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
80
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
94
81
  */
95
- export function buildInfo(): BuildInfo;
82
+ export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
83
+ /**
84
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
85
+ *
86
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
87
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
88
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
89
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
90
+ */
91
+ export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
92
+ /**
93
+ * @returns {Promise<WasmBlackBoxFunctionSolver>}
94
+ */
95
+ export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
96
96
  /**
97
97
  * Sets the package's logging level.
98
98
  *
package/nodejs/acvm_js.js CHANGED
@@ -229,59 +229,12 @@ function __wbg_adapter_54(arg0, arg1, arg2) {
229
229
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(arg0, arg1, addHeapObject(arg2));
230
230
  }
231
231
 
232
- function _assertClass(instance, klass) {
233
- if (!(instance instanceof klass)) {
234
- throw new Error(`expected instance of ${klass.name}`);
235
- }
236
- return instance.ptr;
237
- }
238
-
239
232
  function passArray8ToWasm0(arg, malloc) {
240
233
  const ptr = malloc(arg.length * 1) >>> 0;
241
234
  getUint8Memory0().set(arg, ptr / 1);
242
235
  WASM_VECTOR_LEN = arg.length;
243
236
  return ptr;
244
237
  }
245
- /**
246
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
247
- *
248
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
249
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
250
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
251
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
252
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
253
- */
254
- module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) {
255
- _assertClass(solver, WasmBlackBoxFunctionSolver);
256
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
257
- const len0 = WASM_VECTOR_LEN;
258
- const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
259
- return takeObject(ret);
260
- };
261
-
262
- /**
263
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
264
- *
265
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
266
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
267
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
268
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
269
- */
270
- module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) {
271
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
272
- const len0 = WASM_VECTOR_LEN;
273
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
274
- return takeObject(ret);
275
- };
276
-
277
- /**
278
- * @returns {Promise<WasmBlackBoxFunctionSolver>}
279
- */
280
- module.exports.createBlackBoxSolver = function() {
281
- const ret = wasm.createBlackBoxSolver();
282
- return takeObject(ret);
283
- };
284
-
285
238
  /**
286
239
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
287
240
  *
@@ -335,6 +288,15 @@ module.exports.compressWitness = function(witness_map) {
335
288
  }
336
289
  };
337
290
 
291
+ /**
292
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
293
+ * @returns {BuildInfo} - Information on how the installed package was built.
294
+ */
295
+ module.exports.buildInfo = function() {
296
+ const ret = wasm.buildInfo();
297
+ return takeObject(ret);
298
+ };
299
+
338
300
  /**
339
301
  * Verifies a ECDSA signature over the secp256r1 curve.
340
302
  * @param {Uint8Array} hashed_msg
@@ -463,12 +425,49 @@ module.exports.and = function(lhs, rhs) {
463
425
  return takeObject(ret);
464
426
  };
465
427
 
428
+ function _assertClass(instance, klass) {
429
+ if (!(instance instanceof klass)) {
430
+ throw new Error(`expected instance of ${klass.name}`);
431
+ }
432
+ return instance.ptr;
433
+ }
466
434
  /**
467
- * Returns the `BuildInfo` object containing information about how the installed package was built.
468
- * @returns {BuildInfo} - Information on how the installed package was built.
435
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
436
+ *
437
+ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
438
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
439
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
440
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
441
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
469
442
  */
470
- module.exports.buildInfo = function() {
471
- const ret = wasm.buildInfo();
443
+ module.exports.executeCircuitWithBlackBoxSolver = function(solver, circuit, initial_witness, foreign_call_handler) {
444
+ _assertClass(solver, WasmBlackBoxFunctionSolver);
445
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
446
+ const len0 = WASM_VECTOR_LEN;
447
+ const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
448
+ return takeObject(ret);
449
+ };
450
+
451
+ /**
452
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
453
+ *
454
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
455
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
456
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
457
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
458
+ */
459
+ module.exports.executeCircuit = function(circuit, initial_witness, foreign_call_handler) {
460
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
461
+ const len0 = WASM_VECTOR_LEN;
462
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
463
+ return takeObject(ret);
464
+ };
465
+
466
+ /**
467
+ * @returns {Promise<WasmBlackBoxFunctionSolver>}
468
+ */
469
+ module.exports.createBlackBoxSolver = function() {
470
+ const ret = wasm.createBlackBoxSolver();
472
471
  return takeObject(ret);
473
472
  };
474
473
 
@@ -1190,8 +1189,8 @@ module.exports.__wbindgen_function_table = function() {
1190
1189
  return addHeapObject(ret);
1191
1190
  };
1192
1191
 
1193
- module.exports.__wbindgen_closure_wrapper605 = function(arg0, arg1, arg2) {
1194
- const ret = makeMutClosure(arg0, arg1, 193, __wbg_adapter_54);
1192
+ module.exports.__wbindgen_closure_wrapper602 = function(arg0, arg1, arg2) {
1193
+ const ret = makeMutClosure(arg0, arg1, 189, __wbg_adapter_54);
1195
1194
  return addHeapObject(ret);
1196
1195
  };
1197
1196
 
Binary file
@@ -1,12 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
5
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
6
- export function createBlackBoxSolver(): number;
7
- export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
8
4
  export function decompressWitness(a: number, b: number, c: number): void;
9
5
  export function compressWitness(a: number, b: number): void;
6
+ export function buildInfo(): number;
10
7
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
11
8
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
12
9
  export function keccak256(a: number, b: number, c: number): void;
@@ -14,7 +11,10 @@ export function blake2s256(a: number, b: number, c: number): void;
14
11
  export function sha256(a: number, b: number, c: number): void;
15
12
  export function xor(a: number, b: number): number;
16
13
  export function and(a: number, b: number): number;
17
- export function buildInfo(): number;
14
+ export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
15
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
16
+ export function createBlackBoxSolver(): number;
17
+ export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
18
18
  export function initLogLevel(a: number): void;
19
19
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
20
20
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.28.0-88682da",
3
+ "version": "0.28.0-e88ce80.nightly",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/noir-lang/acvm.git"
@@ -28,8 +28,10 @@
28
28
  "test:browser": "web-test-runner",
29
29
  "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
30
30
  "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
31
- "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
32
- "clean": "chmod u+w web nodejs || true && rm -rf web nodejs"
31
+ "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
32
+ "clean": "chmod u+w web nodejs || true && rm -rf web nodejs",
33
+ "build:nix": "nix build -L .#acvm_js",
34
+ "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/acvm_js/nodejs ./ && cp -rL ./result/acvm_js/web ./"
33
35
  },
34
36
  "devDependencies": {
35
37
  "@esm-bundle/chai": "^4.3.4-fix.0",
package/web/acvm_js.d.ts CHANGED
@@ -1,29 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
- *
6
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
7
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
8
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
9
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
10
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
11
- */
12
- export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
13
- /**
14
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
15
- *
16
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
17
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
18
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
19
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
20
- */
21
- export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
22
- /**
23
- * @returns {Promise<WasmBlackBoxFunctionSolver>}
24
- */
25
- export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
26
- /**
27
4
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
28
5
  *
29
6
  * @param {Uint8Array} compressed_witness - A compressed witness.
@@ -38,6 +15,11 @@ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
38
15
  */
39
16
  export function compressWitness(witness_map: WitnessMap): Uint8Array;
40
17
  /**
18
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
19
+ * @returns {BuildInfo} - Information on how the installed package was built.
20
+ */
21
+ export function buildInfo(): BuildInfo;
22
+ /**
41
23
  * Verifies a ECDSA signature over the secp256r1 curve.
42
24
  * @param {Uint8Array} hashed_msg
43
25
  * @param {Uint8Array} public_key_x_bytes
@@ -89,10 +71,28 @@ export function xor(lhs: string, rhs: string): string;
89
71
  */
90
72
  export function and(lhs: string, rhs: string): string;
91
73
  /**
92
- * Returns the `BuildInfo` object containing information about how the installed package was built.
93
- * @returns {BuildInfo} - Information on how the installed package was built.
74
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
75
+ *
76
+ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
77
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
78
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
79
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
80
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
94
81
  */
95
- export function buildInfo(): BuildInfo;
82
+ export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
83
+ /**
84
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
85
+ *
86
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
87
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
88
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
89
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
90
+ */
91
+ export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
92
+ /**
93
+ * @returns {Promise<WasmBlackBoxFunctionSolver>}
94
+ */
95
+ export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
96
96
  /**
97
97
  * Sets the package's logging level.
98
98
  *
@@ -195,12 +195,9 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
195
195
 
196
196
  export interface InitOutput {
197
197
  readonly memory: WebAssembly.Memory;
198
- readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
199
- readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
200
- readonly createBlackBoxSolver: () => number;
201
- readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
202
198
  readonly decompressWitness: (a: number, b: number, c: number) => void;
203
199
  readonly compressWitness: (a: number, b: number) => void;
200
+ readonly buildInfo: () => number;
204
201
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
205
202
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
206
203
  readonly keccak256: (a: number, b: number, c: number) => void;
@@ -208,7 +205,10 @@ export interface InitOutput {
208
205
  readonly sha256: (a: number, b: number, c: number) => void;
209
206
  readonly xor: (a: number, b: number) => number;
210
207
  readonly and: (a: number, b: number) => number;
211
- readonly buildInfo: () => number;
208
+ readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
209
+ readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
210
+ readonly createBlackBoxSolver: () => number;
211
+ readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
212
212
  readonly initLogLevel: (a: number) => void;
213
213
  readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
214
214
  readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
package/web/acvm_js.js CHANGED
@@ -226,59 +226,12 @@ function __wbg_adapter_54(arg0, arg1, arg2) {
226
226
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(arg0, arg1, addHeapObject(arg2));
227
227
  }
228
228
 
229
- function _assertClass(instance, klass) {
230
- if (!(instance instanceof klass)) {
231
- throw new Error(`expected instance of ${klass.name}`);
232
- }
233
- return instance.ptr;
234
- }
235
-
236
229
  function passArray8ToWasm0(arg, malloc) {
237
230
  const ptr = malloc(arg.length * 1) >>> 0;
238
231
  getUint8Memory0().set(arg, ptr / 1);
239
232
  WASM_VECTOR_LEN = arg.length;
240
233
  return ptr;
241
234
  }
242
- /**
243
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
244
- *
245
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
246
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
247
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
248
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
249
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
250
- */
251
- export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) {
252
- _assertClass(solver, WasmBlackBoxFunctionSolver);
253
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
256
- return takeObject(ret);
257
- }
258
-
259
- /**
260
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
261
- *
262
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
263
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
264
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
265
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
266
- */
267
- export function executeCircuit(circuit, initial_witness, foreign_call_handler) {
268
- const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
269
- const len0 = WASM_VECTOR_LEN;
270
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
271
- return takeObject(ret);
272
- }
273
-
274
- /**
275
- * @returns {Promise<WasmBlackBoxFunctionSolver>}
276
- */
277
- export function createBlackBoxSolver() {
278
- const ret = wasm.createBlackBoxSolver();
279
- return takeObject(ret);
280
- }
281
-
282
235
  /**
283
236
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
284
237
  *
@@ -332,6 +285,15 @@ export function compressWitness(witness_map) {
332
285
  }
333
286
  }
334
287
 
288
+ /**
289
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
290
+ * @returns {BuildInfo} - Information on how the installed package was built.
291
+ */
292
+ export function buildInfo() {
293
+ const ret = wasm.buildInfo();
294
+ return takeObject(ret);
295
+ }
296
+
335
297
  /**
336
298
  * Verifies a ECDSA signature over the secp256r1 curve.
337
299
  * @param {Uint8Array} hashed_msg
@@ -460,12 +422,49 @@ export function and(lhs, rhs) {
460
422
  return takeObject(ret);
461
423
  }
462
424
 
425
+ function _assertClass(instance, klass) {
426
+ if (!(instance instanceof klass)) {
427
+ throw new Error(`expected instance of ${klass.name}`);
428
+ }
429
+ return instance.ptr;
430
+ }
463
431
  /**
464
- * Returns the `BuildInfo` object containing information about how the installed package was built.
465
- * @returns {BuildInfo} - Information on how the installed package was built.
432
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
433
+ *
434
+ * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
435
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
436
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
437
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
438
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
466
439
  */
467
- export function buildInfo() {
468
- const ret = wasm.buildInfo();
440
+ export function executeCircuitWithBlackBoxSolver(solver, circuit, initial_witness, foreign_call_handler) {
441
+ _assertClass(solver, WasmBlackBoxFunctionSolver);
442
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
443
+ const len0 = WASM_VECTOR_LEN;
444
+ const ret = wasm.executeCircuitWithBlackBoxSolver(solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
445
+ return takeObject(ret);
446
+ }
447
+
448
+ /**
449
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
450
+ *
451
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
452
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
453
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
454
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
455
+ */
456
+ export function executeCircuit(circuit, initial_witness, foreign_call_handler) {
457
+ const ptr0 = passArray8ToWasm0(circuit, wasm.__wbindgen_malloc);
458
+ const len0 = WASM_VECTOR_LEN;
459
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
460
+ return takeObject(ret);
461
+ }
462
+
463
+ /**
464
+ * @returns {Promise<WasmBlackBoxFunctionSolver>}
465
+ */
466
+ export function createBlackBoxSolver() {
467
+ const ret = wasm.createBlackBoxSolver();
469
468
  return takeObject(ret);
470
469
  }
471
470
 
@@ -1120,8 +1119,8 @@ function __wbg_get_imports() {
1120
1119
  const ret = wasm.__wbindgen_export_2;
1121
1120
  return addHeapObject(ret);
1122
1121
  };
1123
- imports.wbg.__wbindgen_closure_wrapper605 = function(arg0, arg1, arg2) {
1124
- const ret = makeMutClosure(arg0, arg1, 193, __wbg_adapter_54);
1122
+ imports.wbg.__wbindgen_closure_wrapper602 = function(arg0, arg1, arg2) {
1123
+ const ret = makeMutClosure(arg0, arg1, 189, __wbg_adapter_54);
1125
1124
  return addHeapObject(ret);
1126
1125
  };
1127
1126
 
Binary file
@@ -1,12 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
5
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
6
- export function createBlackBoxSolver(): number;
7
- export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
8
4
  export function decompressWitness(a: number, b: number, c: number): void;
9
5
  export function compressWitness(a: number, b: number): void;
6
+ export function buildInfo(): number;
10
7
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
11
8
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
12
9
  export function keccak256(a: number, b: number, c: number): void;
@@ -14,7 +11,10 @@ export function blake2s256(a: number, b: number, c: number): void;
14
11
  export function sha256(a: number, b: number, c: number): void;
15
12
  export function xor(a: number, b: number): number;
16
13
  export function and(a: number, b: number): number;
17
- export function buildInfo(): number;
14
+ export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
15
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
16
+ export function createBlackBoxSolver(): number;
17
+ export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
18
18
  export function initLogLevel(a: number): void;
19
19
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
20
20
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;