@provablehq/wasm 0.11.4 → 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.
@@ -286,16 +286,6 @@ function runRayonThread(receiver) {
286
286
  wasm.runRayonThread(receiver);
287
287
  }
288
288
 
289
- /**
290
- * @param {URL} url
291
- * @param {number} num_threads
292
- * @returns {Promise<void>}
293
- */
294
- function initThreadPool(url, num_threads) {
295
- const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
296
- return takeObject(ret);
297
- }
298
-
299
289
  /**
300
290
  * Set the WASM log level from JS. Called automatically by the SDK's
301
291
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -307,6 +297,16 @@ function setWasmLogLevel(level) {
307
297
  wasm.setWasmLogLevel(level);
308
298
  }
309
299
 
300
+ /**
301
+ * @param {URL} url
302
+ * @param {number} num_threads
303
+ * @returns {Promise<void>}
304
+ */
305
+ function initThreadPool(url, num_threads) {
306
+ const ret = wasm.initThreadPool(addHeapObject(url), num_threads);
307
+ return takeObject(ret);
308
+ }
309
+
310
310
  let stack_pointer = 128;
311
311
 
312
312
  function addBorrowedObject(obj) {
@@ -314,38 +314,6 @@ function addBorrowedObject(obj) {
314
314
  heap[--stack_pointer] = obj;
315
315
  return stack_pointer;
316
316
  }
317
- /**
318
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
319
- *
320
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
321
- * Each verifying key is paired with one or more sets of public inputs (instances).
322
- *
323
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
324
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
325
- * @param {Proof} proof The batch proof to verify
326
- * @returns {boolean} True if the batch proof is valid, false otherwise
327
- * @param {Array<any>} verifying_keys
328
- * @param {Array<any>} inputs
329
- * @param {Proof} proof
330
- * @returns {boolean}
331
- */
332
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
333
- try {
334
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
- _assertClass(proof, Proof);
336
- wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
337
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
338
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
339
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
340
- if (r2) {
341
- throw takeObject(r1);
342
- }
343
- return r0 !== 0;
344
- } finally {
345
- wasm.__wbindgen_add_to_stack_pointer(16);
346
- }
347
- }
348
-
349
317
  /**
350
318
  * Verify a SNARK proof against a verifying key and public inputs.
351
319
  *
@@ -427,6 +395,38 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
427
395
  }
428
396
  }
429
397
 
398
+ /**
399
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
400
+ *
401
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
402
+ * Each verifying key is paired with one or more sets of public inputs (instances).
403
+ *
404
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
405
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
406
+ * @param {Proof} proof The batch proof to verify
407
+ * @returns {boolean} True if the batch proof is valid, false otherwise
408
+ * @param {Array<any>} verifying_keys
409
+ * @param {Array<any>} inputs
410
+ * @param {Proof} proof
411
+ * @returns {boolean}
412
+ */
413
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
414
+ try {
415
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
416
+ _assertClass(proof, Proof);
417
+ wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
418
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
419
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
420
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
421
+ if (r2) {
422
+ throw takeObject(r1);
423
+ }
424
+ return r0 !== 0;
425
+ } finally {
426
+ wasm.__wbindgen_add_to_stack_pointer(16);
427
+ }
428
+ }
429
+
430
430
  /**
431
431
  * Set test consensus version heights for testing.
432
432
  *
@@ -436,7 +436,7 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
436
436
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
437
437
  *
438
438
  * Set the consensus version heights.
439
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
439
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17");
440
440
  * @param {string | null} [heights]
441
441
  * @returns {Array<any>}
442
442
  */
@@ -447,6 +447,23 @@ function getOrInitConsensusVersionTestHeights(heights) {
447
447
  return takeObject(ret);
448
448
  }
449
449
 
450
+ /**
451
+ * Returns the maximum number of imports allowed in a program by the
452
+ * snarkVM network implementation this SDK was built against.
453
+ *
454
+ * @returns {number} The maximum number of program imports.
455
+ *
456
+ * @example
457
+ * import { getMaxProgramImports } from '@provablehq/sdk';
458
+ *
459
+ * const maxImports = getMaxProgramImports();
460
+ * @returns {number}
461
+ */
462
+ function getMaxProgramImports() {
463
+ const ret = wasm.getMaxProgramImports();
464
+ return ret >>> 0;
465
+ }
466
+
450
467
  /**
451
468
  * @param {string} string
452
469
  * @returns {Field}
@@ -488,16 +505,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
488
505
  }
489
506
  return result;
490
507
  }
491
- function __wasm_bindgen_func_elem_7392(arg0, arg1) {
492
- wasm.__wasm_bindgen_func_elem_7392(arg0, arg1);
508
+ function __wasm_bindgen_func_elem_7463(arg0, arg1) {
509
+ wasm.__wasm_bindgen_func_elem_7463(arg0, arg1);
493
510
  }
494
511
 
495
- function __wasm_bindgen_func_elem_8765(arg0, arg1, arg2) {
496
- wasm.__wasm_bindgen_func_elem_8765(arg0, arg1, addHeapObject(arg2));
512
+ function __wasm_bindgen_func_elem_8910(arg0, arg1, arg2) {
513
+ wasm.__wasm_bindgen_func_elem_8910(arg0, arg1, addHeapObject(arg2));
497
514
  }
498
515
 
499
- function __wasm_bindgen_func_elem_7664(arg0, arg1, arg2, arg3) {
500
- wasm.__wasm_bindgen_func_elem_7664(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
516
+ function __wasm_bindgen_func_elem_7736(arg0, arg1, arg2, arg3) {
517
+ wasm.__wasm_bindgen_func_elem_7736(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
501
518
  }
502
519
 
503
520
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19302,7 +19319,7 @@ function __wbg_get_imports(memory) {
19302
19319
  const ret = getObject(arg0).length;
19303
19320
  return ret;
19304
19321
  };
19305
- imports.wbg.__wbg_log_4507b73801c06872 = function(arg0, arg1) {
19322
+ imports.wbg.__wbg_log_27d73c032446232d = function(arg0, arg1) {
19306
19323
  console.log(getStringFromWasm0(arg0, arg1));
19307
19324
  };
19308
19325
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19320,7 +19337,7 @@ function __wbg_get_imports(memory) {
19320
19337
  const a = state0.a;
19321
19338
  state0.a = 0;
19322
19339
  try {
19323
- return __wasm_bindgen_func_elem_7664(a, state0.b, arg0, arg1);
19340
+ return __wasm_bindgen_func_elem_7736(a, state0.b, arg0, arg1);
19324
19341
  } finally {
19325
19342
  state0.a = a;
19326
19343
  }
@@ -19492,7 +19509,7 @@ function __wbg_get_imports(memory) {
19492
19509
  const ret = Signature.__wrap(arg0);
19493
19510
  return addHeapObject(ret);
19494
19511
  };
19495
- imports.wbg.__wbg_spawnWorker_6197e35077a8baba = function(arg0, arg1, arg2, arg3) {
19512
+ imports.wbg.__wbg_spawnWorker_e00cacfddf7ee0c0 = function(arg0, arg1, arg2, arg3) {
19496
19513
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19497
19514
  return addHeapObject(ret);
19498
19515
  };
@@ -19574,21 +19591,11 @@ function __wbg_get_imports(memory) {
19574
19591
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
19575
19592
  return addHeapObject(ret);
19576
19593
  };
19577
- imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
19578
- // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19579
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_7392);
19580
- return addHeapObject(ret);
19581
- };
19582
19594
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
19583
19595
  // Cast intrinsic for `Ref(String) -> Externref`.
19584
19596
  const ret = getStringFromWasm0(arg0, arg1);
19585
19597
  return addHeapObject(ret);
19586
19598
  };
19587
- imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
19588
- // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19589
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
19590
- return addHeapObject(ret);
19591
- };
19592
19599
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
19593
19600
  // Cast intrinsic for `I128 -> Externref`.
19594
19601
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
@@ -19599,9 +19606,9 @@ function __wbg_get_imports(memory) {
19599
19606
  const ret = BigInt.asUintN(64, arg0);
19600
19607
  return addHeapObject(ret);
19601
19608
  };
19602
- imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
19603
- // Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19604
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7391, __wasm_bindgen_func_elem_8765);
19609
+ imports.wbg.__wbindgen_cast_69588da295a6a0d2 = function(arg0, arg1) {
19610
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 390, function: Function { arguments: [], shim_idx: 495, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19611
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_7463);
19605
19612
  return addHeapObject(ret);
19606
19613
  };
19607
19614
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19609,11 +19616,21 @@ function __wbg_get_imports(memory) {
19609
19616
  const ret = arg0;
19610
19617
  return addHeapObject(ret);
19611
19618
  };
19619
+ imports.wbg.__wbindgen_cast_b5deba2f813aede2 = function(arg0, arg1) {
19620
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 390, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 391, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19621
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_8910);
19622
+ return addHeapObject(ret);
19623
+ };
19612
19624
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
19613
19625
  // Cast intrinsic for `F64 -> Externref`.
19614
19626
  const ret = arg0;
19615
19627
  return addHeapObject(ret);
19616
19628
  };
19629
+ imports.wbg.__wbindgen_cast_e15614d8168764d1 = function(arg0, arg1) {
19630
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 390, function: Function { arguments: [Externref], shim_idx: 391, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19631
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7462, __wasm_bindgen_func_elem_8910);
19632
+ return addHeapObject(ret);
19633
+ };
19617
19634
  imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
19618
19635
  // Cast intrinsic for `U128 -> Externref`.
19619
19636
  const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
@@ -19761,6 +19778,7 @@ var exports$1 = /*#__PURE__*/Object.freeze({
19761
19778
  VerifyingKey: VerifyingKey,
19762
19779
  ViewKey: ViewKey,
19763
19780
  default: __wbg_init,
19781
+ getMaxProgramImports: getMaxProgramImports,
19764
19782
  getOrInitConsensusVersionTestHeights: getOrInitConsensusVersionTestHeights,
19765
19783
  initSync: initSync,
19766
19784
  initThreadPool: initThreadPool,