@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.
@@ -9,6 +9,18 @@ export function runRayonThread(receiver: number): void;
9
9
  */
10
10
  export function setWasmLogLevel(level: number): void;
11
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;
12
24
  /**
13
25
  * Verify an execution. Executions with multiple transitions must have the program source code and
14
26
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -35,18 +47,19 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
35
47
  * @returns {boolean} True if the batch proof is valid, false otherwise
36
48
  */
37
49
  export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
50
+ export function stringToField(string: string): Field;
38
51
  /**
39
- * Verify a SNARK proof against a verifying key and public inputs.
52
+ * Set test consensus version heights for testing.
40
53
  *
41
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
42
- * It directly invokes the Varuna proof verification from snarkVM.
54
+ * @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.
43
55
  *
44
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
45
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
46
- * @param {Proof} proof The proof to verify
47
- * @returns {boolean} True if the proof is valid, false otherwise
56
+ * @example
57
+ * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
58
+ *
59
+ * Set the consensus version heights.
60
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
48
61
  */
49
- export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
62
+ export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
50
63
  /**
51
64
  * Returns the maximum number of imports allowed in a program by the
52
65
  * snarkVM network implementation this SDK was built against.
@@ -59,19 +72,6 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
59
72
  * const maxImports = getMaxProgramImports();
60
73
  */
61
74
  export function getMaxProgramImports(): number;
62
- /**
63
- * Set test consensus version heights for testing.
64
- *
65
- * @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.
66
- *
67
- * @example
68
- * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
69
- *
70
- * Set the consensus version heights.
71
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
72
- */
73
- export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
74
- export function stringToField(string: string): Field;
75
75
  /**
76
76
  * Public address of an Aleo account
77
77
  */
@@ -2447,7 +2447,7 @@ export class Pedersen64 {
2447
2447
  *
2448
2448
  * @example
2449
2449
  * // Get the bond state of an existing address.
2450
- * const bondState = await fetch(https://api.provable.com/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
2450
+ * const bondState = await fetch(https://edge.provable.com/api/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
2451
2451
  * // Convert the bond state to a Plaintext object.
2452
2452
  * const bondStatePlaintext = Plaintext.fromString(bond_state);
2453
2453
  * // Convert the Plaintext object to a JS object.
Binary file
@@ -320,6 +320,39 @@ function addBorrowedObject(obj) {
320
320
  heap[--stack_pointer] = obj;
321
321
  return stack_pointer;
322
322
  }
323
+ /**
324
+ * Verify a SNARK proof against a verifying key and public inputs.
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.
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
334
+ * @param {Array<any>} inputs
335
+ * @param {Proof} proof
336
+ * @returns {boolean}
337
+ */
338
+ function snarkVerify(verifying_key, inputs, proof) {
339
+ try {
340
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
341
+ _assertClass(verifying_key, VerifyingKey);
342
+ _assertClass(proof, Proof);
343
+ wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
344
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
345
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
346
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
347
+ if (r2) {
348
+ throw takeObject(r1);
349
+ }
350
+ return r0 !== 0;
351
+ } finally {
352
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
353
+ }
354
+ }
355
+
323
356
  /**
324
357
  * Verify an execution. Executions with multiple transitions must have the program source code and
325
358
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -401,55 +434,27 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
401
434
  }
402
435
 
403
436
  /**
404
- * Verify a SNARK proof against a verifying key and public inputs.
405
- *
406
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
407
- * It directly invokes the Varuna proof verification from snarkVM.
408
- *
409
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
410
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
411
- * @param {Proof} proof The proof to verify
412
- * @returns {boolean} True if the proof is valid, false otherwise
413
- * @param {VerifyingKey} verifying_key
414
- * @param {Array<any>} inputs
415
- * @param {Proof} proof
416
- * @returns {boolean}
437
+ * @param {string} string
438
+ * @returns {Field}
417
439
  */
418
- function snarkVerify(verifying_key, inputs, proof) {
440
+ function stringToField(string) {
419
441
  try {
420
442
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
421
- _assertClass(verifying_key, VerifyingKey);
422
- _assertClass(proof, Proof);
423
- wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
443
+ const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
444
+ const len0 = WASM_VECTOR_LEN;
445
+ wasm$1.stringToField(retptr, ptr0, len0);
424
446
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
425
447
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
426
448
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
427
449
  if (r2) {
428
450
  throw takeObject(r1);
429
451
  }
430
- return r0 !== 0;
452
+ return Field.__wrap(r0);
431
453
  } finally {
432
454
  wasm$1.__wbindgen_add_to_stack_pointer(16);
433
455
  }
434
456
  }
435
457
 
436
- /**
437
- * Returns the maximum number of imports allowed in a program by the
438
- * snarkVM network implementation this SDK was built against.
439
- *
440
- * @returns {number} The maximum number of program imports.
441
- *
442
- * @example
443
- * import { getMaxProgramImports } from '@provablehq/sdk';
444
- *
445
- * const maxImports = getMaxProgramImports();
446
- * @returns {number}
447
- */
448
- function getMaxProgramImports() {
449
- const ret = wasm$1.getMaxProgramImports();
450
- return ret >>> 0;
451
- }
452
-
453
458
  /**
454
459
  * Set test consensus version heights for testing.
455
460
  *
@@ -471,25 +476,20 @@ function getOrInitConsensusVersionTestHeights(heights) {
471
476
  }
472
477
 
473
478
  /**
474
- * @param {string} string
475
- * @returns {Field}
479
+ * Returns the maximum number of imports allowed in a program by the
480
+ * snarkVM network implementation this SDK was built against.
481
+ *
482
+ * @returns {number} The maximum number of program imports.
483
+ *
484
+ * @example
485
+ * import { getMaxProgramImports } from '@provablehq/sdk';
486
+ *
487
+ * const maxImports = getMaxProgramImports();
488
+ * @returns {number}
476
489
  */
477
- function stringToField(string) {
478
- try {
479
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
480
- const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
481
- const len0 = WASM_VECTOR_LEN;
482
- wasm$1.stringToField(retptr, ptr0, len0);
483
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
484
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
485
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
486
- if (r2) {
487
- throw takeObject(r1);
488
- }
489
- return Field.__wrap(r0);
490
- } finally {
491
- wasm$1.__wbindgen_add_to_stack_pointer(16);
492
- }
490
+ function getMaxProgramImports() {
491
+ const ret = wasm$1.getMaxProgramImports();
492
+ return ret >>> 0;
493
493
  }
494
494
 
495
495
  function passArrayJsValueToWasm0(array, malloc) {
@@ -511,12 +511,12 @@ function getArrayJsValueFromWasm0(ptr, len) {
511
511
  }
512
512
  return result;
513
513
  }
514
- function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
515
- wasm$1.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
514
+ function __wasm_bindgen_func_elem_8946(arg0, arg1, arg2) {
515
+ wasm$1.__wasm_bindgen_func_elem_8946(arg0, arg1, addHeapObject(arg2));
516
516
  }
517
517
 
518
- function __wasm_bindgen_func_elem_7505(arg0, arg1) {
519
- wasm$1.__wasm_bindgen_func_elem_7505(arg0, arg1);
518
+ function __wasm_bindgen_func_elem_7504(arg0, arg1) {
519
+ wasm$1.__wasm_bindgen_func_elem_7504(arg0, arg1);
520
520
  }
521
521
 
522
522
  function __wasm_bindgen_func_elem_7777(arg0, arg1, arg2, arg3) {
@@ -8593,7 +8593,7 @@ const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
8593
8593
  *
8594
8594
  * @example
8595
8595
  * // Get the bond state of an existing address.
8596
- * const bondState = await fetch(https://api.provable.com/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
8596
+ * const bondState = await fetch(https://edge.provable.com/api/v2/mainnet/program/credits.aleo/mapping/bond_state/aleo12zlythl7htjdtjjjz3ahdj4vl6wk3zuzm37s80l86qpx8fyx95fqnxcn2f);
8597
8597
  * // Convert the bond state to a Plaintext object.
8598
8598
  * const bondStatePlaintext = Plaintext.fromString(bond_state);
8599
8599
  * // Convert the Plaintext object to a JS object.
@@ -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_7ab0c7ccba2f0588 = function(arg0, arg1) {
19328
+ imports.wbg.__wbg_log_6a7c7e39dc2b85ff = function(arg0, arg1) {
19329
19329
  console.log(getStringFromWasm0(arg0, arg1));
19330
19330
  };
19331
19331
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -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_69898deb011084cf = function(arg0, arg1, arg2, arg3) {
19518
+ imports.wbg.__wbg_spawnWorker_ea93f1cb9997e793 = 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
  };
@@ -19604,7 +19604,7 @@ function __wbg_get_imports(memory) {
19604
19604
  };
19605
19605
  imports.wbg.__wbindgen_cast_2adca60326a83a78 = function(arg0, arg1) {
19606
19606
  // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19607
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_7505);
19607
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_7504);
19608
19608
  return addHeapObject(ret);
19609
19609
  };
19610
19610
  imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
@@ -19619,7 +19619,7 @@ function __wbg_get_imports(memory) {
19619
19619
  };
19620
19620
  imports.wbg.__wbindgen_cast_805ada4c4be963fc = function(arg0, arg1) {
19621
19621
  // 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`.
19622
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_8948);
19622
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8946);
19623
19623
  return addHeapObject(ret);
19624
19624
  };
19625
19625
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19629,7 +19629,7 @@ function __wbg_get_imports(memory) {
19629
19629
  };
19630
19630
  imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
19631
19631
  // Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19632
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7504, __wasm_bindgen_func_elem_8948);
19632
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8946);
19633
19633
  return addHeapObject(ret);
19634
19634
  };
19635
19635
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {