@provablehq/wasm 0.11.8 → 0.11.10

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.
@@ -314,6 +314,39 @@ function addBorrowedObject(obj) {
314
314
  heap[--stack_pointer] = obj;
315
315
  return stack_pointer;
316
316
  }
317
+ /**
318
+ * Verify a SNARK proof against a verifying key and public inputs.
319
+ *
320
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
321
+ * It directly invokes the Varuna proof verification from snarkVM.
322
+ *
323
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
324
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
325
+ * @param {Proof} proof The proof to verify
326
+ * @returns {boolean} True if the proof is valid, false otherwise
327
+ * @param {VerifyingKey} verifying_key
328
+ * @param {Array<any>} inputs
329
+ * @param {Proof} proof
330
+ * @returns {boolean}
331
+ */
332
+ function snarkVerify(verifying_key, inputs, proof) {
333
+ try {
334
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
335
+ _assertClass(verifying_key, VerifyingKey);
336
+ _assertClass(proof, Proof);
337
+ wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
338
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
339
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
340
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
341
+ if (r2) {
342
+ throw takeObject(r1);
343
+ }
344
+ return r0 !== 0;
345
+ } finally {
346
+ wasm.__wbindgen_add_to_stack_pointer(16);
347
+ }
348
+ }
349
+
317
350
  /**
318
351
  * Verify an execution. Executions with multiple transitions must have the program source code and
319
352
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -395,55 +428,27 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
395
428
  }
396
429
 
397
430
  /**
398
- * Verify a SNARK proof against a verifying key and public inputs.
399
- *
400
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
401
- * It directly invokes the Varuna proof verification from snarkVM.
402
- *
403
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
404
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
405
- * @param {Proof} proof The proof to verify
406
- * @returns {boolean} True if the proof is valid, false otherwise
407
- * @param {VerifyingKey} verifying_key
408
- * @param {Array<any>} inputs
409
- * @param {Proof} proof
410
- * @returns {boolean}
431
+ * @param {string} string
432
+ * @returns {Field}
411
433
  */
412
- function snarkVerify(verifying_key, inputs, proof) {
434
+ function stringToField(string) {
413
435
  try {
414
436
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
415
- _assertClass(verifying_key, VerifyingKey);
416
- _assertClass(proof, Proof);
417
- wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, 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
  }
428
450
  }
429
451
 
430
- /**
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.
435
- *
436
- * @example
437
- * import { getMaxProgramImports } from '@provablehq/sdk';
438
- *
439
- * const maxImports = getMaxProgramImports();
440
- * @returns {number}
441
- */
442
- function getMaxProgramImports() {
443
- const ret = wasm.getMaxProgramImports();
444
- return ret >>> 0;
445
- }
446
-
447
452
  /**
448
453
  * Set test consensus version heights for testing.
449
454
  *
@@ -465,25 +470,20 @@ function getOrInitConsensusVersionTestHeights(heights) {
465
470
  }
466
471
 
467
472
  /**
468
- * @param {string} string
469
- * @returns {Field}
473
+ * Returns the maximum number of imports allowed in a program by the
474
+ * snarkVM network implementation this SDK was built against.
475
+ *
476
+ * @returns {number} The maximum number of program imports.
477
+ *
478
+ * @example
479
+ * import { getMaxProgramImports } from '@provablehq/sdk';
480
+ *
481
+ * const maxImports = getMaxProgramImports();
482
+ * @returns {number}
470
483
  */
471
- function stringToField(string) {
472
- try {
473
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
474
- const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
475
- const len0 = WASM_VECTOR_LEN;
476
- wasm.stringToField(retptr, ptr0, len0);
477
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
478
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
479
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
480
- if (r2) {
481
- throw takeObject(r1);
482
- }
483
- return Field.__wrap(r0);
484
- } finally {
485
- wasm.__wbindgen_add_to_stack_pointer(16);
486
- }
484
+ function getMaxProgramImports() {
485
+ const ret = wasm.getMaxProgramImports();
486
+ return ret >>> 0;
487
487
  }
488
488
 
489
489
  function passArrayJsValueToWasm0(array, malloc) {
@@ -505,12 +505,12 @@ function getArrayJsValueFromWasm0(ptr, len) {
505
505
  }
506
506
  return result;
507
507
  }
508
- function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
509
- wasm.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
508
+ function __wasm_bindgen_func_elem_8946(arg0, arg1, arg2) {
509
+ wasm.__wasm_bindgen_func_elem_8946(arg0, arg1, addHeapObject(arg2));
510
510
  }
511
511
 
512
- function __wasm_bindgen_func_elem_7505(arg0, arg1) {
513
- wasm.__wasm_bindgen_func_elem_7505(arg0, arg1);
512
+ function __wasm_bindgen_func_elem_7504(arg0, arg1) {
513
+ wasm.__wasm_bindgen_func_elem_7504(arg0, arg1);
514
514
  }
515
515
 
516
516
  function __wasm_bindgen_func_elem_7777(arg0, arg1, arg2, arg3) {
@@ -8587,7 +8587,7 @@ const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
8587
8587
  *
8588
8588
  * @example
8589
8589
  * // Get the bond state of an existing address.
8590
- * const bondState = await fetch(https://api.provable.com/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
8590
+ * const bondState = await fetch(https://edge.provable.com/api/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
8591
8591
  * // Convert the bond state to a Plaintext object.
8592
8592
  * const bondStatePlaintext = Plaintext.fromString(bond_state);
8593
8593
  * // Convert the Plaintext object to a JS object.
@@ -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_7ab0c7ccba2f0588 = function(arg0, arg1) {
19322
+ imports.wbg.__wbg_log_6a7c7e39dc2b85ff = function(arg0, arg1) {
19323
19323
  console.log(getStringFromWasm0(arg0, arg1));
19324
19324
  };
19325
19325
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -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_69898deb011084cf = function(arg0, arg1, arg2, arg3) {
19512
+ imports.wbg.__wbg_spawnWorker_ea93f1cb9997e793 = 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
  };
@@ -19598,7 +19598,7 @@ function __wbg_get_imports(memory) {
19598
19598
  };
19599
19599
  imports.wbg.__wbindgen_cast_2adca60326a83a78 = function(arg0, arg1) {
19600
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_7504, __wasm_bindgen_func_elem_7505);
19601
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_7504);
19602
19602
  return addHeapObject(ret);
19603
19603
  };
19604
19604
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
@@ -19613,7 +19613,7 @@ function __wbg_get_imports(memory) {
19613
19613
  };
19614
19614
  imports.wbg.__wbindgen_cast_805ada4c4be963fc = function(arg0, arg1) {
19615
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_7504, __wasm_bindgen_func_elem_8948);
19616
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8946);
19617
19617
  return addHeapObject(ret);
19618
19618
  };
19619
19619
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19623,7 +19623,7 @@ function __wbg_get_imports(memory) {
19623
19623
  };
19624
19624
  imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
19625
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_7504, __wasm_bindgen_func_elem_8948);
19626
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8946);
19627
19627
  return addHeapObject(ret);
19628
19628
  };
19629
19629
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {