@provablehq/wasm 0.11.5 → 0.11.6

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,19 +9,6 @@ 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 SNARK proof against a verifying key and public inputs.
14
- *
15
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
16
- * It directly invokes the Varuna proof verification from snarkVM.
17
- *
18
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
19
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
20
- * @param {Proof} proof The proof to verify
21
- * @returns {boolean} True if the proof is valid, false otherwise
22
- */
23
- export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
24
12
  /**
25
13
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
26
14
  *
@@ -33,6 +21,18 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
33
21
  * @returns {boolean} True if the batch proof is valid, false otherwise
34
22
  */
35
23
  export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
24
+ /**
25
+ * Verify a SNARK proof against a verifying key and public inputs.
26
+ *
27
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
28
+ * It directly invokes the Varuna proof verification from snarkVM.
29
+ *
30
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
31
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
32
+ * @param {Proof} proof The proof to verify
33
+ * @returns {boolean} True if the proof is valid, false otherwise
34
+ */
35
+ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
36
36
  /**
37
37
  * Verify an execution. Executions with multiple transitions must have the program source code and
38
38
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -47,6 +47,18 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
47
47
  * @returns {boolean} True if the execution is valid, false otherwise
48
48
  */
49
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;
50
+ /**
51
+ * Set test consensus version heights for testing.
52
+ *
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.
54
+ *
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");
60
+ */
61
+ export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
50
62
  /**
51
63
  * Returns the maximum number of imports allowed in a program by the
52
64
  * snarkVM network implementation this SDK was built against.
@@ -60,18 +72,6 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
60
72
  */
61
73
  export function getMaxProgramImports(): number;
62
74
  export function stringToField(string: string): Field;
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");
73
- */
74
- export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
75
75
  /**
76
76
  * Public address of an Aleo account
77
77
  */
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) {
@@ -321,26 +321,25 @@ function addBorrowedObject(obj) {
321
321
  return stack_pointer;
322
322
  }
323
323
  /**
324
- * Verify a SNARK proof against a verifying key and public inputs.
324
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
325
325
  *
326
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
327
- * It directly invokes the Varuna proof verification from snarkVM.
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
328
  *
329
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
330
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
331
- * @param {Proof} proof The proof to verify
332
- * @returns {boolean} True if the proof is valid, false otherwise
333
- * @param {VerifyingKey} verifying_key
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
334
  * @param {Array<any>} inputs
335
335
  * @param {Proof} proof
336
336
  * @returns {boolean}
337
337
  */
338
- function snarkVerify(verifying_key, inputs, proof) {
338
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
339
339
  try {
340
340
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
341
- _assertClass(verifying_key, VerifyingKey);
342
341
  _assertClass(proof, Proof);
343
- wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
342
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
344
343
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
345
344
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
346
345
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -354,25 +353,26 @@ function snarkVerify(verifying_key, inputs, proof) {
354
353
  }
355
354
 
356
355
  /**
357
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
356
+ * Verify a SNARK proof against a verifying key and public inputs.
358
357
  *
359
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
360
- * Each verifying key is paired with one or more sets of public inputs (instances).
358
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
359
+ * It directly invokes the Varuna proof verification from snarkVM.
361
360
  *
362
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
363
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
364
- * @param {Proof} proof The batch proof to verify
365
- * @returns {boolean} True if the batch proof is valid, false otherwise
366
- * @param {Array<any>} verifying_keys
361
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
362
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
363
+ * @param {Proof} proof The proof to verify
364
+ * @returns {boolean} True if the proof is valid, false otherwise
365
+ * @param {VerifyingKey} verifying_key
367
366
  * @param {Array<any>} inputs
368
367
  * @param {Proof} proof
369
368
  * @returns {boolean}
370
369
  */
371
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
370
+ function snarkVerify(verifying_key, inputs, proof) {
372
371
  try {
373
372
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
373
+ _assertClass(verifying_key, VerifyingKey);
374
374
  _assertClass(proof, Proof);
375
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
375
+ wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
376
376
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
377
377
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
378
378
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -433,6 +433,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
433
433
  }
434
434
  }
435
435
 
436
+ /**
437
+ * Set test consensus version heights for testing.
438
+ *
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.
440
+ *
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");
446
+ * @param {string | null} [heights]
447
+ * @returns {Array<any>}
448
+ */
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);
454
+ }
455
+
436
456
  /**
437
457
  * Returns the maximum number of imports allowed in a program by the
438
458
  * snarkVM network implementation this SDK was built against.
@@ -472,26 +492,6 @@ function stringToField(string) {
472
492
  }
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");
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();
@@ -511,16 +511,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
511
511
  }
512
512
  return result;
513
513
  }
514
- function __wasm_bindgen_func_elem_7393(arg0, arg1) {
515
- wasm$1.__wasm_bindgen_func_elem_7393(arg0, arg1);
514
+ function __wasm_bindgen_func_elem_8910(arg0, arg1, arg2) {
515
+ wasm$1.__wasm_bindgen_func_elem_8910(arg0, arg1, addHeapObject(arg2));
516
516
  }
517
517
 
518
- function __wasm_bindgen_func_elem_8766(arg0, arg1, arg2) {
519
- wasm$1.__wasm_bindgen_func_elem_8766(arg0, arg1, addHeapObject(arg2));
518
+ function __wasm_bindgen_func_elem_7471(arg0, arg1) {
519
+ wasm$1.__wasm_bindgen_func_elem_7471(arg0, arg1);
520
520
  }
521
521
 
522
- function __wasm_bindgen_func_elem_7666(arg0, arg1, arg2, arg3) {
523
- wasm$1.__wasm_bindgen_func_elem_7666(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
522
+ function __wasm_bindgen_func_elem_7743(arg0, arg1, arg2, arg3) {
523
+ wasm$1.__wasm_bindgen_func_elem_7743(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_a530da429f854235 = function(arg0, arg1) {
19328
+ imports.wbg.__wbg_log_27d73c032446232d = 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_7666(a, state0.b, arg0, arg1);
19346
+ return __wasm_bindgen_func_elem_7743(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_ad641c7b32ebd520 = function(arg0, arg1, arg2, arg3) {
19518
+ imports.wbg.__wbg_spawnWorker_e00cacfddf7ee0c0 = 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
  };
@@ -19597,6 +19597,16 @@ function __wbg_get_imports(memory) {
19597
19597
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
19598
19598
  return addHeapObject(ret);
19599
19599
  };
19600
+ imports.wbg.__wbindgen_cast_01d4af51d575cfe0 = function(arg0, arg1) {
19601
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 388, function: Function { arguments: [], shim_idx: 495, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19602
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7470, __wasm_bindgen_func_elem_7471);
19603
+ return addHeapObject(ret);
19604
+ };
19605
+ imports.wbg.__wbindgen_cast_13f76f7c228ed64d = function(arg0, arg1) {
19606
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 388, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 389, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19607
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7470, __wasm_bindgen_func_elem_8910);
19608
+ return addHeapObject(ret);
19609
+ };
19600
19610
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
19601
19611
  // Cast intrinsic for `Ref(String) -> Externref`.
19602
19612
  const ret = getStringFromWasm0(arg0, arg1);
@@ -19607,31 +19617,21 @@ function __wbg_get_imports(memory) {
19607
19617
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
19608
19618
  return addHeapObject(ret);
19609
19619
  };
19620
+ imports.wbg.__wbindgen_cast_42ef79217ed4073d = function(arg0, arg1) {
19621
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 388, function: Function { arguments: [Externref], shim_idx: 389, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19622
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7470, __wasm_bindgen_func_elem_8910);
19623
+ return addHeapObject(ret);
19624
+ };
19610
19625
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
19611
19626
  // Cast intrinsic for `U64 -> Externref`.
19612
19627
  const ret = BigInt.asUintN(64, arg0);
19613
19628
  return addHeapObject(ret);
19614
19629
  };
19615
- imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19616
- // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19617
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7392, __wasm_bindgen_func_elem_8766);
19618
- return addHeapObject(ret);
19619
- };
19620
- imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19621
- // 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`.
19622
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7392, __wasm_bindgen_func_elem_8766);
19623
- return addHeapObject(ret);
19624
- };
19625
19630
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
19626
19631
  // Cast intrinsic for `I64 -> Externref`.
19627
19632
  const ret = arg0;
19628
19633
  return addHeapObject(ret);
19629
19634
  };
19630
- imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19631
- // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19632
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7392, __wasm_bindgen_func_elem_7393);
19633
- return addHeapObject(ret);
19634
- };
19635
19635
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
19636
19636
  // Cast intrinsic for `F64 -> Externref`.
19637
19637
  const ret = arg0;