@provablehq/wasm 0.11.5 → 0.11.7

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,6 +286,16 @@ 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
+
289
299
  /**
290
300
  * Set the WASM log level from JS. Called automatically by the SDK's
291
301
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -297,16 +307,6 @@ function setWasmLogLevel(level) {
297
307
  wasm.setWasmLogLevel(level);
298
308
  }
299
309
 
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) {
@@ -347,38 +347,6 @@ function snarkVerify(verifying_key, inputs, proof) {
347
347
  }
348
348
  }
349
349
 
350
- /**
351
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
352
- *
353
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
354
- * Each verifying key is paired with one or more sets of public inputs (instances).
355
- *
356
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
357
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
358
- * @param {Proof} proof The batch proof to verify
359
- * @returns {boolean} True if the batch proof is valid, false otherwise
360
- * @param {Array<any>} verifying_keys
361
- * @param {Array<any>} inputs
362
- * @param {Proof} proof
363
- * @returns {boolean}
364
- */
365
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
366
- try {
367
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
368
- _assertClass(proof, Proof);
369
- wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
370
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
371
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
372
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
373
- if (r2) {
374
- throw takeObject(r1);
375
- }
376
- return r0 !== 0;
377
- } finally {
378
- wasm.__wbindgen_add_to_stack_pointer(16);
379
- }
380
- }
381
-
382
350
  /**
383
351
  * Verify an execution. Executions with multiple transitions must have the program source code and
384
352
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -428,20 +396,35 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
428
396
  }
429
397
 
430
398
  /**
431
- * Returns the maximum number of imports allowed in a program by the
432
- * snarkVM network implementation this SDK was built against.
433
- *
434
- * @returns {number} The maximum number of program imports.
399
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
435
400
  *
436
- * @example
437
- * import { getMaxProgramImports } from '@provablehq/sdk';
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).
438
403
  *
439
- * const maxImports = getMaxProgramImports();
440
- * @returns {number}
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}
441
412
  */
442
- function getMaxProgramImports() {
443
- const ret = wasm.getMaxProgramImports();
444
- return ret >>> 0;
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
+ }
445
428
  }
446
429
 
447
430
  /**
@@ -466,6 +449,23 @@ function stringToField(string) {
466
449
  }
467
450
  }
468
451
 
452
+ /**
453
+ * Returns the maximum number of imports allowed in a program by the
454
+ * snarkVM network implementation this SDK was built against.
455
+ *
456
+ * @returns {number} The maximum number of program imports.
457
+ *
458
+ * @example
459
+ * import { getMaxProgramImports } from '@provablehq/sdk';
460
+ *
461
+ * const maxImports = getMaxProgramImports();
462
+ * @returns {number}
463
+ */
464
+ function getMaxProgramImports() {
465
+ const ret = wasm.getMaxProgramImports();
466
+ return ret >>> 0;
467
+ }
468
+
469
469
  /**
470
470
  * Set test consensus version heights for testing.
471
471
  *
@@ -475,7 +475,7 @@ function stringToField(string) {
475
475
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
476
476
  *
477
477
  * Set the consensus version heights.
478
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16");
478
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
479
479
  * @param {string | null} [heights]
480
480
  * @returns {Array<any>}
481
481
  */
@@ -505,16 +505,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
505
505
  }
506
506
  return result;
507
507
  }
508
- function __wasm_bindgen_func_elem_7393(arg0, arg1) {
509
- wasm.__wasm_bindgen_func_elem_7393(arg0, arg1);
508
+ function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
509
+ wasm.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
510
510
  }
511
511
 
512
- function __wasm_bindgen_func_elem_8766(arg0, arg1, arg2) {
513
- wasm.__wasm_bindgen_func_elem_8766(arg0, arg1, addHeapObject(arg2));
512
+ function __wasm_bindgen_func_elem_7504(arg0, arg1) {
513
+ wasm.__wasm_bindgen_func_elem_7504(arg0, arg1);
514
514
  }
515
515
 
516
- function __wasm_bindgen_func_elem_7666(arg0, arg1, arg2, arg3) {
517
- wasm.__wasm_bindgen_func_elem_7666(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
516
+ function __wasm_bindgen_func_elem_7776(arg0, arg1, arg2, arg3) {
517
+ wasm.__wasm_bindgen_func_elem_7776(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
518
518
  }
519
519
 
520
520
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19319,7 +19319,7 @@ function __wbg_get_imports(memory) {
19319
19319
  const ret = getObject(arg0).length;
19320
19320
  return ret;
19321
19321
  };
19322
- imports.wbg.__wbg_log_a530da429f854235 = function(arg0, arg1) {
19322
+ imports.wbg.__wbg_log_03049fa0ffffc089 = function(arg0, arg1) {
19323
19323
  console.log(getStringFromWasm0(arg0, arg1));
19324
19324
  };
19325
19325
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19337,7 +19337,7 @@ function __wbg_get_imports(memory) {
19337
19337
  const a = state0.a;
19338
19338
  state0.a = 0;
19339
19339
  try {
19340
- return __wasm_bindgen_func_elem_7666(a, state0.b, arg0, arg1);
19340
+ return __wasm_bindgen_func_elem_7776(a, state0.b, arg0, arg1);
19341
19341
  } finally {
19342
19342
  state0.a = a;
19343
19343
  }
@@ -19509,7 +19509,7 @@ function __wbg_get_imports(memory) {
19509
19509
  const ret = Signature.__wrap(arg0);
19510
19510
  return addHeapObject(ret);
19511
19511
  };
19512
- imports.wbg.__wbg_spawnWorker_ad641c7b32ebd520 = function(arg0, arg1, arg2, arg3) {
19512
+ imports.wbg.__wbg_spawnWorker_6984bbe776b8abdc = function(arg0, arg1, arg2, arg3) {
19513
19513
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19514
19514
  return addHeapObject(ret);
19515
19515
  };
@@ -19596,6 +19596,11 @@ function __wbg_get_imports(memory) {
19596
19596
  const ret = getStringFromWasm0(arg0, arg1);
19597
19597
  return addHeapObject(ret);
19598
19598
  };
19599
+ imports.wbg.__wbindgen_cast_2adca60326a83a78 = function(arg0, arg1) {
19600
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19601
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_7504);
19602
+ return addHeapObject(ret);
19603
+ };
19599
19604
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
19600
19605
  // Cast intrinsic for `I128 -> Externref`.
19601
19606
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
@@ -19606,14 +19611,9 @@ function __wbg_get_imports(memory) {
19606
19611
  const ret = BigInt.asUintN(64, arg0);
19607
19612
  return addHeapObject(ret);
19608
19613
  };
19609
- imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19610
- // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19611
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7392, __wasm_bindgen_func_elem_8766);
19612
- return addHeapObject(ret);
19613
- };
19614
- imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19615
- // 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`.
19616
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7392, __wasm_bindgen_func_elem_8766);
19614
+ imports.wbg.__wbindgen_cast_805ada4c4be963fc = function(arg0, arg1) {
19615
+ // 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`.
19616
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8948);
19617
19617
  return addHeapObject(ret);
19618
19618
  };
19619
19619
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19621,9 +19621,9 @@ function __wbg_get_imports(memory) {
19621
19621
  const ret = arg0;
19622
19622
  return addHeapObject(ret);
19623
19623
  };
19624
- imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19625
- // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19626
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7392, __wasm_bindgen_func_elem_7393);
19624
+ imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
19625
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19626
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8948);
19627
19627
  return addHeapObject(ret);
19628
19628
  };
19629
19629
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {