@provablehq/wasm 0.11.1 → 0.11.2

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,6 +1,7 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export function runRayonThread(receiver: number): void;
4
+ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
4
5
  /**
5
6
  * Set the WASM log level from JS. Called automatically by the SDK's
6
7
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -8,7 +9,18 @@ export function runRayonThread(receiver: number): void;
8
9
  * Values above 4 are clamped to debug.
9
10
  */
10
11
  export function setWasmLogLevel(level: number): void;
11
- export function initThreadPool(url: URL, num_threads: number): Promise<void>;
12
+ /**
13
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
14
+ *
15
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
16
+ * Each verifying key is paired with one or more sets of public inputs (instances).
17
+ *
18
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
19
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
20
+ * @param {Proof} proof The batch proof to verify
21
+ * @returns {boolean} True if the batch proof is valid, false otherwise
22
+ */
23
+ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
12
24
  /**
13
25
  * Verify an execution. Executions with multiple transitions must have the program source code and
14
26
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -23,18 +35,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
23
35
  * @returns {boolean} True if the execution is valid, false otherwise
24
36
  */
25
37
  export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
26
- /**
27
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
28
- *
29
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
30
- * Each verifying key is paired with one or more sets of public inputs (instances).
31
- *
32
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
33
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
34
- * @param {Proof} proof The batch proof to verify
35
- * @returns {boolean} True if the batch proof is valid, false otherwise
36
- */
37
- export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
38
38
  /**
39
39
  * Verify a SNARK proof against a verifying key and public inputs.
40
40
  *
Binary file
@@ -292,6 +292,16 @@ function runRayonThread(receiver) {
292
292
  wasm$1.runRayonThread(receiver);
293
293
  }
294
294
 
295
+ /**
296
+ * @param {URL} url
297
+ * @param {number} num_threads
298
+ * @returns {Promise<void>}
299
+ */
300
+ function initThreadPool(url, num_threads) {
301
+ const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
302
+ return takeObject(ret);
303
+ }
304
+
295
305
  /**
296
306
  * Set the WASM log level from JS. Called automatically by the SDK's
297
307
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -303,16 +313,6 @@ function setWasmLogLevel(level) {
303
313
  wasm$1.setWasmLogLevel(level);
304
314
  }
305
315
 
306
- /**
307
- * @param {URL} url
308
- * @param {number} num_threads
309
- * @returns {Promise<void>}
310
- */
311
- function initThreadPool(url, num_threads) {
312
- const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
313
- return takeObject(ret);
314
- }
315
-
316
316
  let stack_pointer = 128;
317
317
 
318
318
  function addBorrowedObject(obj) {
@@ -320,6 +320,38 @@ function addBorrowedObject(obj) {
320
320
  heap[--stack_pointer] = obj;
321
321
  return stack_pointer;
322
322
  }
323
+ /**
324
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
325
+ *
326
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
327
+ * Each verifying key is paired with one or more sets of public inputs (instances).
328
+ *
329
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
330
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
331
+ * @param {Proof} proof The batch proof to verify
332
+ * @returns {boolean} True if the batch proof is valid, false otherwise
333
+ * @param {Array<any>} verifying_keys
334
+ * @param {Array<any>} inputs
335
+ * @param {Proof} proof
336
+ * @returns {boolean}
337
+ */
338
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
339
+ try {
340
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
341
+ _assertClass(proof, Proof);
342
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
343
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
344
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
345
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
346
+ if (r2) {
347
+ throw takeObject(r1);
348
+ }
349
+ return r0 !== 0;
350
+ } finally {
351
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
352
+ }
353
+ }
354
+
323
355
  /**
324
356
  * Verify an execution. Executions with multiple transitions must have the program source code and
325
357
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -368,38 +400,6 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
368
400
  }
369
401
  }
370
402
 
371
- /**
372
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
373
- *
374
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
375
- * Each verifying key is paired with one or more sets of public inputs (instances).
376
- *
377
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
378
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
379
- * @param {Proof} proof The batch proof to verify
380
- * @returns {boolean} True if the batch proof is valid, false otherwise
381
- * @param {Array<any>} verifying_keys
382
- * @param {Array<any>} inputs
383
- * @param {Proof} proof
384
- * @returns {boolean}
385
- */
386
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
387
- try {
388
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
389
- _assertClass(proof, Proof);
390
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
391
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
392
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
393
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
394
- if (r2) {
395
- throw takeObject(r1);
396
- }
397
- return r0 !== 0;
398
- } finally {
399
- wasm$1.__wbindgen_add_to_stack_pointer(16);
400
- }
401
- }
402
-
403
403
  /**
404
404
  * Verify a SNARK proof against a verifying key and public inputs.
405
405
  *
@@ -494,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
494
494
  }
495
495
  return result;
496
496
  }
497
- function __wasm_bindgen_func_elem_8740(arg0, arg1, arg2) {
498
- wasm$1.__wasm_bindgen_func_elem_8740(arg0, arg1, addHeapObject(arg2));
497
+ function __wasm_bindgen_func_elem_8742(arg0, arg1, arg2) {
498
+ wasm$1.__wasm_bindgen_func_elem_8742(arg0, arg1, addHeapObject(arg2));
499
499
  }
500
500
 
501
- function __wasm_bindgen_func_elem_7369(arg0, arg1) {
502
- wasm$1.__wasm_bindgen_func_elem_7369(arg0, arg1);
501
+ function __wasm_bindgen_func_elem_7376(arg0, arg1) {
502
+ wasm$1.__wasm_bindgen_func_elem_7376(arg0, arg1);
503
503
  }
504
504
 
505
- function __wasm_bindgen_func_elem_7641(arg0, arg1, arg2, arg3) {
506
- wasm$1.__wasm_bindgen_func_elem_7641(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
505
+ function __wasm_bindgen_func_elem_7648(arg0, arg1, arg2, arg3) {
506
+ wasm$1.__wasm_bindgen_func_elem_7648(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
507
507
  }
508
508
 
509
509
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19238,7 +19238,7 @@ function __wbg_get_imports(memory) {
19238
19238
  const ret = getObject(arg0).length;
19239
19239
  return ret;
19240
19240
  };
19241
- imports.wbg.__wbg_log_e77f2654b14580d9 = function(arg0, arg1) {
19241
+ imports.wbg.__wbg_log_a61781f88cdec01a = function(arg0, arg1) {
19242
19242
  console.log(getStringFromWasm0(arg0, arg1));
19243
19243
  };
19244
19244
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19256,7 +19256,7 @@ function __wbg_get_imports(memory) {
19256
19256
  const a = state0.a;
19257
19257
  state0.a = 0;
19258
19258
  try {
19259
- return __wasm_bindgen_func_elem_7641(a, state0.b, arg0, arg1);
19259
+ return __wasm_bindgen_func_elem_7648(a, state0.b, arg0, arg1);
19260
19260
  } finally {
19261
19261
  state0.a = a;
19262
19262
  }
@@ -19428,7 +19428,7 @@ function __wbg_get_imports(memory) {
19428
19428
  const ret = Signature.__wrap(arg0);
19429
19429
  return addHeapObject(ret);
19430
19430
  };
19431
- imports.wbg.__wbg_spawnWorker_77887968658d2179 = function(arg0, arg1, arg2, arg3) {
19431
+ imports.wbg.__wbg_spawnWorker_7994cee197aef72d = function(arg0, arg1, arg2, arg3) {
19432
19432
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19433
19433
  return addHeapObject(ret);
19434
19434
  };
@@ -19527,12 +19527,12 @@ function __wbg_get_imports(memory) {
19527
19527
  };
19528
19528
  imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19529
19529
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19530
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19530
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19531
19531
  return addHeapObject(ret);
19532
19532
  };
19533
19533
  imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19534
19534
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19535
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19535
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_8742);
19536
19536
  return addHeapObject(ret);
19537
19537
  };
19538
19538
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19542,7 +19542,7 @@ function __wbg_get_imports(memory) {
19542
19542
  };
19543
19543
  imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19544
19544
  // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19545
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_7369);
19545
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7375, __wasm_bindgen_func_elem_7376);
19546
19546
  return addHeapObject(ret);
19547
19547
  };
19548
19548
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {