@provablehq/wasm 0.11.7 → 0.11.9

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.
@@ -9,6 +9,18 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
9
9
  * Values above 4 are clamped to debug.
10
10
  */
11
11
  export function setWasmLogLevel(level: number): 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 a SNARK proof against a verifying key and public inputs.
14
26
  *
@@ -36,17 +48,17 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
36
48
  */
37
49
  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;
38
50
  /**
39
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
51
+ * Set test consensus version heights for testing.
40
52
  *
41
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
42
- * Each verifying key is paired with one or more sets of public inputs (instances).
53
+ * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
43
54
  *
44
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
45
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
46
- * @param {Proof} proof The batch proof to verify
47
- * @returns {boolean} True if the batch proof is valid, false otherwise
55
+ * @example
56
+ * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
57
+ *
58
+ * Set the consensus version heights.
59
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
48
60
  */
49
- export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
61
+ export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
50
62
  export function stringToField(string: string): Field;
51
63
  /**
52
64
  * Returns the maximum number of imports allowed in a program by the
@@ -60,18 +72,6 @@ export function stringToField(string: string): Field;
60
72
  * const maxImports = getMaxProgramImports();
61
73
  */
62
74
  export function getMaxProgramImports(): number;
63
- /**
64
- * Set test consensus version heights for testing.
65
- *
66
- * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
67
- *
68
- * @example
69
- * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
70
- *
71
- * Set the consensus version heights.
72
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
73
- */
74
- export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
75
75
  /**
76
76
  * Public address of an Aleo account
77
77
  */
Binary file
@@ -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 a SNARK proof against a verifying key and public inputs.
325
357
  *
@@ -402,35 +434,23 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
402
434
  }
403
435
 
404
436
  /**
405
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
437
+ * Set test consensus version heights for testing.
406
438
  *
407
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
408
- * Each verifying key is paired with one or more sets of public inputs (instances).
439
+ * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
409
440
  *
410
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
411
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
412
- * @param {Proof} proof The batch proof to verify
413
- * @returns {boolean} True if the batch proof is valid, false otherwise
414
- * @param {Array<any>} verifying_keys
415
- * @param {Array<any>} inputs
416
- * @param {Proof} proof
417
- * @returns {boolean}
441
+ * @example
442
+ * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
443
+ *
444
+ * Set the consensus version heights.
445
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
446
+ * @param {string | null} [heights]
447
+ * @returns {Array<any>}
418
448
  */
419
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
420
- try {
421
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
422
- _assertClass(proof, Proof);
423
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
424
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
425
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
426
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
427
- if (r2) {
428
- throw takeObject(r1);
429
- }
430
- return r0 !== 0;
431
- } finally {
432
- wasm$1.__wbindgen_add_to_stack_pointer(16);
433
- }
449
+ function getOrInitConsensusVersionTestHeights(heights) {
450
+ var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
451
+ var len0 = WASM_VECTOR_LEN;
452
+ const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
453
+ return takeObject(ret);
434
454
  }
435
455
 
436
456
  /**
@@ -472,26 +492,6 @@ function getMaxProgramImports() {
472
492
  return ret >>> 0;
473
493
  }
474
494
 
475
- /**
476
- * Set test consensus version heights for testing.
477
- *
478
- * @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
479
- *
480
- * @example
481
- * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
482
- *
483
- * Set the consensus version heights.
484
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
485
- * @param {string | null} [heights]
486
- * @returns {Array<any>}
487
- */
488
- function getOrInitConsensusVersionTestHeights(heights) {
489
- var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
490
- var len0 = WASM_VECTOR_LEN;
491
- const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
492
- return takeObject(ret);
493
- }
494
-
495
495
  function passArrayJsValueToWasm0(array, malloc) {
496
496
  const ptr = malloc(array.length * 4, 4) >>> 0;
497
497
  const mem = getDataViewMemory0();
@@ -515,12 +515,12 @@ function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
515
515
  wasm$1.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
516
516
  }
517
517
 
518
- function __wasm_bindgen_func_elem_7504(arg0, arg1) {
519
- wasm$1.__wasm_bindgen_func_elem_7504(arg0, arg1);
518
+ function __wasm_bindgen_func_elem_7507(arg0, arg1) {
519
+ wasm$1.__wasm_bindgen_func_elem_7507(arg0, arg1);
520
520
  }
521
521
 
522
- function __wasm_bindgen_func_elem_7776(arg0, arg1, arg2, arg3) {
523
- wasm$1.__wasm_bindgen_func_elem_7776(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
522
+ function __wasm_bindgen_func_elem_7780(arg0, arg1, arg2, arg3) {
523
+ wasm$1.__wasm_bindgen_func_elem_7780(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
524
524
  }
525
525
 
526
526
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19325,7 +19325,7 @@ function __wbg_get_imports(memory) {
19325
19325
  const ret = getObject(arg0).length;
19326
19326
  return ret;
19327
19327
  };
19328
- imports.wbg.__wbg_log_03049fa0ffffc089 = function(arg0, arg1) {
19328
+ imports.wbg.__wbg_log_94d1dab6039baf0d = function(arg0, arg1) {
19329
19329
  console.log(getStringFromWasm0(arg0, arg1));
19330
19330
  };
19331
19331
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19343,7 +19343,7 @@ function __wbg_get_imports(memory) {
19343
19343
  const a = state0.a;
19344
19344
  state0.a = 0;
19345
19345
  try {
19346
- return __wasm_bindgen_func_elem_7776(a, state0.b, arg0, arg1);
19346
+ return __wasm_bindgen_func_elem_7780(a, state0.b, arg0, arg1);
19347
19347
  } finally {
19348
19348
  state0.a = a;
19349
19349
  }
@@ -19515,7 +19515,7 @@ function __wbg_get_imports(memory) {
19515
19515
  const ret = Signature.__wrap(arg0);
19516
19516
  return addHeapObject(ret);
19517
19517
  };
19518
- imports.wbg.__wbg_spawnWorker_6984bbe776b8abdc = function(arg0, arg1, arg2, arg3) {
19518
+ imports.wbg.__wbg_spawnWorker_755c8ce6e1ead587 = function(arg0, arg1, arg2, arg3) {
19519
19519
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19520
19520
  return addHeapObject(ret);
19521
19521
  };
@@ -19604,7 +19604,7 @@ function __wbg_get_imports(memory) {
19604
19604
  };
19605
19605
  imports.wbg.__wbindgen_cast_2adca60326a83a78 = function(arg0, arg1) {
19606
19606
  // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19607
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_7504);
19607
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7506, __wasm_bindgen_func_elem_7507);
19608
19608
  return addHeapObject(ret);
19609
19609
  };
19610
19610
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
@@ -19619,7 +19619,7 @@ function __wbg_get_imports(memory) {
19619
19619
  };
19620
19620
  imports.wbg.__wbindgen_cast_805ada4c4be963fc = function(arg0, arg1) {
19621
19621
  // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19622
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8948);
19622
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7506, __wasm_bindgen_func_elem_8948);
19623
19623
  return addHeapObject(ret);
19624
19624
  };
19625
19625
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19629,7 +19629,7 @@ function __wbg_get_imports(memory) {
19629
19629
  };
19630
19630
  imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
19631
19631
  // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19632
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8948);
19632
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7506, __wasm_bindgen_func_elem_8948);
19633
19633
  return addHeapObject(ret);
19634
19634
  };
19635
19635
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {