@provablehq/wasm 0.11.0 → 0.11.1

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.
@@ -362,6 +362,38 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
362
362
  }
363
363
  }
364
364
 
365
+ /**
366
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
367
+ *
368
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
369
+ * Each verifying key is paired with one or more sets of public inputs (instances).
370
+ *
371
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
372
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
373
+ * @param {Proof} proof The batch proof to verify
374
+ * @returns {boolean} True if the batch proof is valid, false otherwise
375
+ * @param {Array<any>} verifying_keys
376
+ * @param {Array<any>} inputs
377
+ * @param {Proof} proof
378
+ * @returns {boolean}
379
+ */
380
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
381
+ try {
382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ _assertClass(proof, Proof);
384
+ wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
385
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
386
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
387
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
388
+ if (r2) {
389
+ throw takeObject(r1);
390
+ }
391
+ return r0 !== 0;
392
+ } finally {
393
+ wasm.__wbindgen_add_to_stack_pointer(16);
394
+ }
395
+ }
396
+
365
397
  /**
366
398
  * Verify a SNARK proof against a verifying key and public inputs.
367
399
  *
@@ -396,32 +428,22 @@ function snarkVerify(verifying_key, inputs, proof) {
396
428
  }
397
429
 
398
430
  /**
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}
431
+ * @param {string} string
432
+ * @returns {Field}
412
433
  */
413
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
434
+ function stringToField(string) {
414
435
  try {
415
436
  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);
437
+ const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
438
+ const len0 = WASM_VECTOR_LEN;
439
+ wasm.stringToField(retptr, ptr0, len0);
418
440
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
419
441
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
420
442
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
421
443
  if (r2) {
422
444
  throw takeObject(r1);
423
445
  }
424
- return r0 !== 0;
446
+ return Field.__wrap(r0);
425
447
  } finally {
426
448
  wasm.__wbindgen_add_to_stack_pointer(16);
427
449
  }
@@ -436,7 +458,7 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
436
458
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
437
459
  *
438
460
  * Set the consensus version heights.
439
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
461
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
440
462
  * @param {string | null} [heights]
441
463
  * @returns {Array<any>}
442
464
  */
@@ -447,28 +469,6 @@ function getOrInitConsensusVersionTestHeights(heights) {
447
469
  return takeObject(ret);
448
470
  }
449
471
 
450
- /**
451
- * @param {string} string
452
- * @returns {Field}
453
- */
454
- function stringToField(string) {
455
- try {
456
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
457
- const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
458
- const len0 = WASM_VECTOR_LEN;
459
- wasm.stringToField(retptr, ptr0, len0);
460
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
461
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
462
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
463
- if (r2) {
464
- throw takeObject(r1);
465
- }
466
- return Field.__wrap(r0);
467
- } finally {
468
- wasm.__wbindgen_add_to_stack_pointer(16);
469
- }
470
- }
471
-
472
472
  function passArrayJsValueToWasm0(array, malloc) {
473
473
  const ptr = malloc(array.length * 4, 4) >>> 0;
474
474
  const mem = getDataViewMemory0();
@@ -488,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
488
488
  }
489
489
  return result;
490
490
  }
491
- function __wasm_bindgen_func_elem_7287(arg0, arg1) {
492
- wasm.__wasm_bindgen_func_elem_7287(arg0, arg1);
491
+ function __wasm_bindgen_func_elem_8740(arg0, arg1, arg2) {
492
+ wasm.__wasm_bindgen_func_elem_8740(arg0, arg1, addHeapObject(arg2));
493
493
  }
494
494
 
495
- function __wasm_bindgen_func_elem_8655(arg0, arg1, arg2) {
496
- wasm.__wasm_bindgen_func_elem_8655(arg0, arg1, addHeapObject(arg2));
495
+ function __wasm_bindgen_func_elem_7369(arg0, arg1) {
496
+ wasm.__wasm_bindgen_func_elem_7369(arg0, arg1);
497
497
  }
498
498
 
499
- function __wasm_bindgen_func_elem_7560(arg0, arg1, arg2, arg3) {
500
- wasm.__wasm_bindgen_func_elem_7560(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
499
+ function __wasm_bindgen_func_elem_7641(arg0, arg1, arg2, arg3) {
500
+ wasm.__wasm_bindgen_func_elem_7641(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
501
501
  }
502
502
 
503
503
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19017,10 +19017,6 @@ function __wbg_get_imports(memory) {
19017
19017
  const ret = typeof(val) === 'object' && val !== null;
19018
19018
  return ret;
19019
19019
  };
19020
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
19021
- const ret = typeof(getObject(arg0)) === 'string';
19022
- return ret;
19023
- };
19024
19020
  imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
19025
19021
  const ret = getObject(arg0) === undefined;
19026
19022
  return ret;
@@ -19102,10 +19098,6 @@ function __wbg_get_imports(memory) {
19102
19098
  const ret = clearTimeout(takeObject(arg0));
19103
19099
  return addHeapObject(ret);
19104
19100
  };
19105
- imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
19106
- const ret = getObject(arg0).crypto;
19107
- return addHeapObject(ret);
19108
- };
19109
19101
  imports.wbg.__wbg_data_ee4306d069f24f2d = function(arg0) {
19110
19102
  const ret = getObject(arg0).data;
19111
19103
  return addHeapObject(ret);
@@ -19149,8 +19141,8 @@ function __wbg_get_imports(memory) {
19149
19141
  const ret = Array.from(getObject(arg0));
19150
19142
  return addHeapObject(ret);
19151
19143
  };
19152
- imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
19153
- getObject(arg0).getRandomValues(getObject(arg1));
19144
+ imports.wbg.__wbg_getRandomValues_90e56bff4f3b89fb = function() { return handleError(function (arg0) {
19145
+ globalThis.crypto.getRandomValues(getObject(arg0));
19154
19146
  }, arguments) };
19155
19147
  imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
19156
19148
  const ret = getObject(arg0)[arg1 >>> 0];
@@ -19240,13 +19232,9 @@ function __wbg_get_imports(memory) {
19240
19232
  const ret = getObject(arg0).length;
19241
19233
  return ret;
19242
19234
  };
19243
- imports.wbg.__wbg_log_b88efcc0ed7757a6 = function(arg0, arg1) {
19235
+ imports.wbg.__wbg_log_e77f2654b14580d9 = function(arg0, arg1) {
19244
19236
  console.log(getStringFromWasm0(arg0, arg1));
19245
19237
  };
19246
- imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
19247
- const ret = getObject(arg0).msCrypto;
19248
- return addHeapObject(ret);
19249
- };
19250
19238
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
19251
19239
  const ret = new Object();
19252
19240
  return addHeapObject(ret);
@@ -19262,7 +19250,7 @@ function __wbg_get_imports(memory) {
19262
19250
  const a = state0.a;
19263
19251
  state0.a = 0;
19264
19252
  try {
19265
- return __wasm_bindgen_func_elem_7560(a, state0.b, arg0, arg1);
19253
+ return __wasm_bindgen_func_elem_7641(a, state0.b, arg0, arg1);
19266
19254
  } finally {
19267
19255
  state0.a = a;
19268
19256
  }
@@ -19329,10 +19317,6 @@ function __wbg_get_imports(memory) {
19329
19317
  const ret = getObject(arg0).next;
19330
19318
  return addHeapObject(ret);
19331
19319
  };
19332
- imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
19333
- const ret = getObject(arg0).node;
19334
- return addHeapObject(ret);
19335
- };
19336
19320
  imports.wbg.__wbg_of_3192b3b018b8f660 = function(arg0, arg1, arg2) {
19337
19321
  const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
19338
19322
  return addHeapObject(ret);
@@ -19350,10 +19334,6 @@ function __wbg_get_imports(memory) {
19350
19334
  imports.wbg.__wbg_postMessage_f34857ca078c8536 = function() { return handleError(function (arg0, arg1) {
19351
19335
  getObject(arg0).postMessage(getObject(arg1));
19352
19336
  }, arguments) };
19353
- imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
19354
- const ret = getObject(arg0).process;
19355
- return addHeapObject(ret);
19356
- };
19357
19337
  imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
19358
19338
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
19359
19339
  };
@@ -19372,9 +19352,6 @@ function __wbg_get_imports(memory) {
19372
19352
  imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
19373
19353
  queueMicrotask(getObject(arg0));
19374
19354
  };
19375
- imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
19376
- getObject(arg0).randomFillSync(takeObject(arg1));
19377
- }, arguments) };
19378
19355
  imports.wbg.__wbg_recordciphertext_new = function(arg0) {
19379
19356
  const ret = RecordCiphertext.__wrap(arg0);
19380
19357
  return addHeapObject(ret);
@@ -19387,10 +19364,6 @@ function __wbg_get_imports(memory) {
19387
19364
  const ret = RecordPlaintext.__wrap(arg0);
19388
19365
  return addHeapObject(ret);
19389
19366
  };
19390
- imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
19391
- const ret = module.require;
19392
- return addHeapObject(ret);
19393
- }, arguments) };
19394
19367
  imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
19395
19368
  const ret = Promise.resolve(getObject(arg0));
19396
19369
  return addHeapObject(ret);
@@ -19449,7 +19422,7 @@ function __wbg_get_imports(memory) {
19449
19422
  const ret = Signature.__wrap(arg0);
19450
19423
  return addHeapObject(ret);
19451
19424
  };
19452
- imports.wbg.__wbg_spawnWorker_6ede797d507e374c = function(arg0, arg1, arg2, arg3) {
19425
+ imports.wbg.__wbg_spawnWorker_77887968658d2179 = function(arg0, arg1, arg2, arg3) {
19453
19426
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19454
19427
  return addHeapObject(ret);
19455
19428
  };
@@ -19488,10 +19461,6 @@ function __wbg_get_imports(memory) {
19488
19461
  const ret = JSON.stringify(getObject(arg0));
19489
19462
  return addHeapObject(ret);
19490
19463
  }, arguments) };
19491
- imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
19492
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
19493
- return addHeapObject(ret);
19494
- };
19495
19464
  imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
19496
19465
  const ret = getObject(arg0).then(getObject(arg1));
19497
19466
  return addHeapObject(ret);
@@ -19527,10 +19496,6 @@ function __wbg_get_imports(memory) {
19527
19496
  const ret = VerifyingKey.__wrap(arg0);
19528
19497
  return addHeapObject(ret);
19529
19498
  };
19530
- imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
19531
- const ret = getObject(arg0).versions;
19532
- return addHeapObject(ret);
19533
- };
19534
19499
  imports.wbg.__wbg_waitAsync_2c4b633ebb554615 = function() {
19535
19500
  const ret = Atomics.waitAsync;
19536
19501
  return addHeapObject(ret);
@@ -19549,24 +19514,19 @@ function __wbg_get_imports(memory) {
19549
19514
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
19550
19515
  return addHeapObject(ret);
19551
19516
  };
19552
- imports.wbg.__wbindgen_cast_3ebebf8ee554379e = function(arg0, arg1) {
19553
- // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19554
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
19555
- return addHeapObject(ret);
19556
- };
19557
19517
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
19558
19518
  // Cast intrinsic for `U64 -> Externref`.
19559
19519
  const ret = BigInt.asUintN(64, arg0);
19560
19520
  return addHeapObject(ret);
19561
19521
  };
19562
- imports.wbg.__wbindgen_cast_5e9bcb6388942484 = function(arg0, arg1) {
19563
- // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [], shim_idx: 462, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19564
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_7287);
19522
+ imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19523
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19524
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19565
19525
  return addHeapObject(ret);
19566
19526
  };
19567
- imports.wbg.__wbindgen_cast_74f3a90a349943d1 = function(arg0, arg1) {
19568
- // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [Externref], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19569
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
19527
+ imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19528
+ // 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`.
19529
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19570
19530
  return addHeapObject(ret);
19571
19531
  };
19572
19532
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19574,9 +19534,9 @@ function __wbg_get_imports(memory) {
19574
19534
  const ret = arg0;
19575
19535
  return addHeapObject(ret);
19576
19536
  };
19577
- imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
19578
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
19579
- const ret = getArrayU8FromWasm0(arg0, arg1);
19537
+ imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19538
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19539
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_7369);
19580
19540
  return addHeapObject(ret);
19581
19541
  };
19582
19542
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {