@provablehq/wasm 0.11.8 → 0.11.9

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.
@@ -1,7 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export function runRayonThread(receiver: number): void;
4
- export function initThreadPool(url: URL, num_threads: number): Promise<void>;
5
4
  /**
6
5
  * Set the WASM log level from JS. Called automatically by the SDK's
7
6
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -9,18 +8,7 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
9
8
  * Values above 4 are clamped to debug.
10
9
  */
11
10
  export function setWasmLogLevel(level: number): 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;
11
+ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
24
12
  /**
25
13
  * Verify an execution. Executions with multiple transitions must have the program source code and
26
14
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -35,6 +23,18 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
35
23
  * @returns {boolean} True if the execution is valid, false otherwise
36
24
  */
37
25
  export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
26
+ /**
27
+ * Verify a SNARK proof against a verifying key and public inputs.
28
+ *
29
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
30
+ * It directly invokes the Varuna proof verification from snarkVM.
31
+ *
32
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
33
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
34
+ * @param {Proof} proof The proof to verify
35
+ * @returns {boolean} True if the proof is valid, false otherwise
36
+ */
37
+ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
38
38
  /**
39
39
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
40
40
  *
@@ -47,18 +47,6 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
47
47
  * @returns {boolean} True if the batch proof is valid, false otherwise
48
48
  */
49
49
  export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
50
- /**
51
- * Returns the maximum number of imports allowed in a program by the
52
- * snarkVM network implementation this SDK was built against.
53
- *
54
- * @returns {number} The maximum number of program imports.
55
- *
56
- * @example
57
- * import { getMaxProgramImports } from '@provablehq/sdk';
58
- *
59
- * const maxImports = getMaxProgramImports();
60
- */
61
- export function getMaxProgramImports(): number;
62
50
  /**
63
51
  * Set test consensus version heights for testing.
64
52
  *
@@ -72,6 +60,18 @@ export function getMaxProgramImports(): number;
72
60
  */
73
61
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
74
62
  export function stringToField(string: string): Field;
63
+ /**
64
+ * Returns the maximum number of imports allowed in a program by the
65
+ * snarkVM network implementation this SDK was built against.
66
+ *
67
+ * @returns {number} The maximum number of program imports.
68
+ *
69
+ * @example
70
+ * import { getMaxProgramImports } from '@provablehq/sdk';
71
+ *
72
+ * const maxImports = getMaxProgramImports();
73
+ */
74
+ export function getMaxProgramImports(): number;
75
75
  /**
76
76
  * Public address of an Aleo account
77
77
  */
Binary file
@@ -292,16 +292,6 @@ function runRayonThread(receiver) {
292
292
  wasm$1.runRayonThread(receiver);
293
293
  }
294
294
 
295
- /**
296
- * @param {URL} url
297
- * @param {number} num_threads
298
- * @returns {Promise<void>}
299
- */
300
- function initThreadPool(url, num_threads) {
301
- const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
302
- return takeObject(ret);
303
- }
304
-
305
295
  /**
306
296
  * Set the WASM log level from JS. Called automatically by the SDK's
307
297
  * `setLogLevel(level)` to keep TS and WASM logging in sync.
@@ -313,6 +303,16 @@ function setWasmLogLevel(level) {
313
303
  wasm$1.setWasmLogLevel(level);
314
304
  }
315
305
 
306
+ /**
307
+ * @param {URL} url
308
+ * @param {number} num_threads
309
+ * @returns {Promise<void>}
310
+ */
311
+ function initThreadPool(url, num_threads) {
312
+ const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
313
+ return takeObject(ret);
314
+ }
315
+
316
316
  let stack_pointer = 128;
317
317
 
318
318
  function addBorrowedObject(obj) {
@@ -320,39 +320,6 @@ 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
-
356
323
  /**
357
324
  * Verify an execution. Executions with multiple transitions must have the program source code and
358
325
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -401,6 +368,39 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
401
368
  }
402
369
  }
403
370
 
371
+ /**
372
+ * Verify a SNARK proof against a verifying key and public inputs.
373
+ *
374
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
375
+ * It directly invokes the Varuna proof verification from snarkVM.
376
+ *
377
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
378
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
379
+ * @param {Proof} proof The proof to verify
380
+ * @returns {boolean} True if the proof is valid, false otherwise
381
+ * @param {VerifyingKey} verifying_key
382
+ * @param {Array<any>} inputs
383
+ * @param {Proof} proof
384
+ * @returns {boolean}
385
+ */
386
+ function snarkVerify(verifying_key, inputs, proof) {
387
+ try {
388
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
389
+ _assertClass(verifying_key, VerifyingKey);
390
+ _assertClass(proof, Proof);
391
+ wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
392
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
393
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
394
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
395
+ if (r2) {
396
+ throw takeObject(r1);
397
+ }
398
+ return r0 !== 0;
399
+ } finally {
400
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
401
+ }
402
+ }
403
+
404
404
  /**
405
405
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
406
406
  *
@@ -433,23 +433,6 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
433
433
  }
434
434
  }
435
435
 
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
436
  /**
454
437
  * Set test consensus version heights for testing.
455
438
  *
@@ -492,6 +475,23 @@ function stringToField(string) {
492
475
  }
493
476
  }
494
477
 
478
+ /**
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}
489
+ */
490
+ function getMaxProgramImports() {
491
+ const ret = wasm$1.getMaxProgramImports();
492
+ return ret >>> 0;
493
+ }
494
+
495
495
  function passArrayJsValueToWasm0(array, malloc) {
496
496
  const ptr = malloc(array.length * 4, 4) >>> 0;
497
497
  const mem = getDataViewMemory0();
@@ -511,16 +511,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
511
511
  }
512
512
  return result;
513
513
  }
514
- function __wasm_bindgen_func_elem_7506(arg0, arg1) {
515
- wasm$1.__wasm_bindgen_func_elem_7506(arg0, arg1);
514
+ function __wasm_bindgen_func_elem_7509(arg0, arg1) {
515
+ wasm$1.__wasm_bindgen_func_elem_7509(arg0, arg1);
516
516
  }
517
517
 
518
518
  function __wasm_bindgen_func_elem_8948(arg0, arg1, arg2) {
519
519
  wasm$1.__wasm_bindgen_func_elem_8948(arg0, arg1, addHeapObject(arg2));
520
520
  }
521
521
 
522
- function __wasm_bindgen_func_elem_7779(arg0, arg1, arg2, arg3) {
523
- wasm$1.__wasm_bindgen_func_elem_7779(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
522
+ function __wasm_bindgen_func_elem_7781(arg0, arg1, arg2, arg3) {
523
+ wasm$1.__wasm_bindgen_func_elem_7781(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
524
524
  }
525
525
 
526
526
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -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_94d1dab6039baf0d = function(arg0, arg1) {
19329
19329
  console.log(getStringFromWasm0(arg0, arg1));
19330
19330
  };
19331
19331
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
@@ -19343,7 +19343,7 @@ function __wbg_get_imports(memory) {
19343
19343
  const a = state0.a;
19344
19344
  state0.a = 0;
19345
19345
  try {
19346
- return __wasm_bindgen_func_elem_7779(a, state0.b, arg0, arg1);
19346
+ return __wasm_bindgen_func_elem_7781(a, state0.b, arg0, arg1);
19347
19347
  } finally {
19348
19348
  state0.a = a;
19349
19349
  }
@@ -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_755c8ce6e1ead587 = 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
  };
@@ -19599,7 +19599,7 @@ function __wbg_get_imports(memory) {
19599
19599
  };
19600
19600
  imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
19601
19601
  // Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [Externref], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19602
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7505, __wasm_bindgen_func_elem_8948);
19602
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7508, __wasm_bindgen_func_elem_8948);
19603
19603
  return addHeapObject(ret);
19604
19604
  };
19605
19605
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
@@ -19619,7 +19619,7 @@ function __wbg_get_imports(memory) {
19619
19619
  };
19620
19620
  imports.wbg.__wbindgen_cast_601de75c058a35e1 = function(arg0, arg1) {
19621
19621
  // Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19622
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7505, __wasm_bindgen_func_elem_7506);
19622
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7508, __wasm_bindgen_func_elem_7509);
19623
19623
  return addHeapObject(ret);
19624
19624
  };
19625
19625
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19639,7 +19639,7 @@ function __wbg_get_imports(memory) {
19639
19639
  };
19640
19640
  imports.wbg.__wbindgen_cast_eb522c22a7f98ff2 = function(arg0, arg1) {
19641
19641
  // Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19642
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7505, __wasm_bindgen_func_elem_8948);
19642
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7508, __wasm_bindgen_func_elem_8948);
19643
19643
  return addHeapObject(ret);
19644
19644
  };
19645
19645
  imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {