@provablehq/wasm 0.10.6-rc.1 → 0.11.0

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,6 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export function runRayonThread(receiver: number): void;
4
+ /**
5
+ * Set the WASM log level from JS. Called automatically by the SDK's
6
+ * `setLogLevel(level)` to keep TS and WASM logging in sync.
7
+ * Levels: 0=silent, 1=error, 2=warn, 3=info (default), 4=debug.
8
+ * Values above 4 are clamped to debug.
9
+ */
10
+ export function setWasmLogLevel(level: number): void;
4
11
  export function initThreadPool(url: URL, num_threads: number): Promise<void>;
5
12
  /**
6
13
  * Verify an execution. Executions with multiple transitions must have the program source code and
@@ -16,18 +23,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
16
23
  * @returns {boolean} True if the execution is valid, false otherwise
17
24
  */
18
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;
19
- /**
20
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
21
- *
22
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
23
- * Each verifying key is paired with one or more sets of public inputs (instances).
24
- *
25
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
26
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
27
- * @param {Proof} proof The batch proof to verify
28
- * @returns {boolean} True if the batch proof is valid, false otherwise
29
- */
30
- export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
31
26
  /**
32
27
  * Verify a SNARK proof against a verifying key and public inputs.
33
28
  *
@@ -40,7 +35,18 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
40
35
  * @returns {boolean} True if the proof is valid, false otherwise
41
36
  */
42
37
  export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
43
- export function stringToField(string: string): Field;
38
+ /**
39
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
40
+ *
41
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
42
+ * Each verifying key is paired with one or more sets of public inputs (instances).
43
+ *
44
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
45
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
46
+ * @param {Proof} proof The batch proof to verify
47
+ * @returns {boolean} True if the batch proof is valid, false otherwise
48
+ */
49
+ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
44
50
  /**
45
51
  * Set test consensus version heights for testing.
46
52
  *
@@ -53,6 +59,7 @@ export function stringToField(string: string): Field;
53
59
  * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
54
60
  */
55
61
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
62
+ export function stringToField(string: string): Field;
56
63
  /**
57
64
  * Public address of an Aleo account
58
65
  */
@@ -3841,53 +3848,125 @@ export class ProvingKey {
3841
3848
  }
3842
3849
  /**
3843
3850
  * Represents a proving request to a prover.
3851
+ *
3852
+ * Carries one of two variants:
3853
+ * - `Authorization` — a fully-constructed snarkVM `Authorization` (plus optional
3854
+ * fee authorization). Submitted to `/prove/authorization` (encrypted-only).
3855
+ * - `Request` — a single signed snarkVM `Request` (plus optional fee `Request`)
3856
+ * that the prover authorizes server-side. Submitted to `/prove/request`
3857
+ * (encrypted-only).
3858
+ *
3859
+ * Use {@link ProvingRequest#kind} when handling a `ProvingRequest` of unknown
3860
+ * variant (e.g. after deserialization). Variant-specific accessors throw if
3861
+ * called on the wrong variant.
3844
3862
  */
3845
3863
  export class ProvingRequest {
3846
3864
  private constructor();
3847
3865
  free(): void;
3848
3866
  [Symbol.dispose](): void;
3849
3867
  /**
3850
- * Creates a ProvingRequest from a string representation.
3868
+ * Returns the signed fee `ExecutionRequest` in the Request variant, or
3869
+ * `undefined` when no fee request is set or this is an Authorization variant.
3870
+ */
3871
+ feeRequest(): ExecutionRequest | undefined;
3872
+ /**
3873
+ * Creates a `ProvingRequest` from a JSON string representation.
3874
+ *
3875
+ * The variant is determined automatically by the JSON shape:
3876
+ * `{ authorization, ... }` → Authorization variant; `{ request, ... }` →
3877
+ * Request variant. Use {@link ProvingRequest#kind} to inspect the
3878
+ * resulting variant.
3851
3879
  *
3852
- * @param {Uint8Array} request String representation of the ProvingRequest.
3880
+ * @param {string} request JSON string representation of the ProvingRequest.
3853
3881
  */
3854
3882
  static fromString(request: string): ProvingRequest;
3855
3883
  /**
3856
- * Creates a left-endian byte representation of the ProvingRequest.
3884
+ * Creates a left-endian byte representation of the ProvingRequest,
3885
+ * dispatching on the variant. The bytes are wire-compatible with the
3886
+ * matching DPS route (`/prove[/encrypted]` for Authorization,
3887
+ * `/prove/request` for Request).
3857
3888
  */
3858
3889
  toBytesLe(): Uint8Array;
3859
3890
  /**
3860
- * Get the Authorization of the main function in the ProvingRequest.
3891
+ * Creates a new Request-variant `ProvingRequest` from a single signed
3892
+ * `ExecutionRequest` and an optional signed fee `ExecutionRequest`.
3893
+ *
3894
+ * The Request variant is processed by the DPS at the `/prove/request`
3895
+ * endpoint, which is encrypted-only. The server runs
3896
+ * `Process::authorize_request` to turn each `Request` into an
3897
+ * `Authorization` before proving.
3898
+ *
3899
+ * Only valid for single-public-request executions. Layered / nested
3900
+ * calls are not supported by `/prove/request` at this time.
3901
+ *
3902
+ * @param {ExecutionRequest} request The signed request for the function.
3903
+ * @param {ExecutionRequest} fee_request Optional signed request for the fee function. When omitted, the prover generates and pays the fee.
3904
+ * @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
3905
+ */
3906
+ static fromRequest(request: ExecutionRequest, fee_request: ExecutionRequest | null | undefined, broadcast: boolean): ProvingRequest;
3907
+ /**
3908
+ * Returns the Authorization of the main function in the ProvingRequest.
3909
+ *
3910
+ * @throws If this `ProvingRequest` is a Request variant. Check
3911
+ * {@link ProvingRequest#kind} or use {@link ProvingRequest#request} instead.
3861
3912
  */
3862
3913
  authorization(): Authorization;
3863
3914
  /**
3864
- * Creates a ProvingRequest from a left-endian byte representation of the ProvingRequest.
3915
+ * Reads bytes as an Authorization-variant `ProvingRequest`. For the
3916
+ * Request variant, use {@link ProvingRequest.fromBytesLeRequest}
3917
+ * explicitly — byte layout carries no variant discriminator.
3865
3918
  *
3866
- * @param {Uint8Array} bytes Left-endian bytes representing the proving request.
3919
+ * @param {Uint8Array} bytes Left-endian bytes representing an Authorization-variant proving request.
3867
3920
  */
3868
3921
  static fromBytesLe(bytes: Uint8Array): ProvingRequest;
3869
3922
  /**
3870
- * Get the fee Authorization in the ProvingRequest.
3923
+ * Returns the fee Authorization in the ProvingRequest, or `undefined`
3924
+ * when no fee is set or this is a Request variant.
3871
3925
  */
3872
3926
  feeAuthorization(): Authorization | undefined;
3873
3927
  /**
3874
- * Creates a new ProvingRequest from a function Authorization and an optional fee Authorization.
3928
+ * Reads bytes as a Request-variant `ProvingRequest`. Byte layout is
3929
+ * disjoint from the Authorization variant; callers must pick the right
3930
+ * reader for the bytes they hold.
3931
+ *
3932
+ * @param {Uint8Array} bytes Left-endian bytes representing a Request-variant proving request.
3933
+ */
3934
+ static fromBytesLeRequest(bytes: Uint8Array): ProvingRequest;
3935
+ /**
3936
+ * Creates a new Authorization-variant `ProvingRequest` from a function
3937
+ * `Authorization` and an optional fee `Authorization`.
3875
3938
  *
3876
3939
  * @param {Authorization} authorization An Authorization for a function.
3877
3940
  * @param {Authorization} fee_authorization The authorization for the `credits.aleo/fee_public` or `credits.aleo/fee_private` function that pays the fee for the execution of the main function.
3878
3941
  * @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
3879
3942
  */
3880
3943
  static new(authorization: Authorization, fee_authorization: Authorization | null | undefined, broadcast: boolean): ProvingRequest;
3944
+ /**
3945
+ * Returns the variant of this `ProvingRequest`: `"authorization"` or
3946
+ * `"request"`. Useful when handling a `ProvingRequest` whose variant
3947
+ * was determined at deserialization time.
3948
+ */
3949
+ kind(): string;
3881
3950
  /**
3882
3951
  * Check if a ProvingRequest is the same as another ProvingRequest.
3883
3952
  */
3884
3953
  equals(other: ProvingRequest): boolean;
3954
+ /**
3955
+ * Returns the signed `ExecutionRequest` carried by the Request variant.
3956
+ *
3957
+ * @throws If this `ProvingRequest` is an Authorization variant. Check
3958
+ * {@link ProvingRequest#kind} or use {@link ProvingRequest#authorization}
3959
+ * instead.
3960
+ */
3961
+ request(): ExecutionRequest;
3885
3962
  /**
3886
3963
  * Get the broadcast flag set in the ProvingRequest.
3887
3964
  */
3888
3965
  broadcast(): boolean;
3889
3966
  /**
3890
- * Creates a string representation of the ProvingRequest.
3967
+ * Creates a JSON string representation of the ProvingRequest.
3968
+ * The shape carries enough information to recover the variant via
3969
+ * {@link ProvingRequest.fromString}.
3891
3970
  */
3892
3971
  toString(): string;
3893
3972
  }
Binary file
@@ -292,6 +292,17 @@ function runRayonThread(receiver) {
292
292
  wasm$1.runRayonThread(receiver);
293
293
  }
294
294
 
295
+ /**
296
+ * Set the WASM log level from JS. Called automatically by the SDK's
297
+ * `setLogLevel(level)` to keep TS and WASM logging in sync.
298
+ * Levels: 0=silent, 1=error, 2=warn, 3=info (default), 4=debug.
299
+ * Values above 4 are clamped to debug.
300
+ * @param {number} level
301
+ */
302
+ function setWasmLogLevel(level) {
303
+ wasm$1.setWasmLogLevel(level);
304
+ }
305
+
295
306
  /**
296
307
  * @param {URL} url
297
308
  * @param {number} num_threads
@@ -357,38 +368,6 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
357
368
  }
358
369
  }
359
370
 
360
- /**
361
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
362
- *
363
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
364
- * Each verifying key is paired with one or more sets of public inputs (instances).
365
- *
366
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
367
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
368
- * @param {Proof} proof The batch proof to verify
369
- * @returns {boolean} True if the batch proof is valid, false otherwise
370
- * @param {Array<any>} verifying_keys
371
- * @param {Array<any>} inputs
372
- * @param {Proof} proof
373
- * @returns {boolean}
374
- */
375
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
376
- try {
377
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
378
- _assertClass(proof, Proof);
379
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
380
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
381
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
382
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
383
- if (r2) {
384
- throw takeObject(r1);
385
- }
386
- return r0 !== 0;
387
- } finally {
388
- wasm$1.__wbindgen_add_to_stack_pointer(16);
389
- }
390
- }
391
-
392
371
  /**
393
372
  * Verify a SNARK proof against a verifying key and public inputs.
394
373
  *
@@ -423,22 +402,32 @@ function snarkVerify(verifying_key, inputs, proof) {
423
402
  }
424
403
 
425
404
  /**
426
- * @param {string} string
427
- * @returns {Field}
405
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
406
+ *
407
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
408
+ * Each verifying key is paired with one or more sets of public inputs (instances).
409
+ *
410
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
411
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
412
+ * @param {Proof} proof The batch proof to verify
413
+ * @returns {boolean} True if the batch proof is valid, false otherwise
414
+ * @param {Array<any>} verifying_keys
415
+ * @param {Array<any>} inputs
416
+ * @param {Proof} proof
417
+ * @returns {boolean}
428
418
  */
429
- function stringToField(string) {
419
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
430
420
  try {
431
421
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
432
- const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
433
- const len0 = WASM_VECTOR_LEN;
434
- wasm$1.stringToField(retptr, ptr0, len0);
422
+ _assertClass(proof, Proof);
423
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
435
424
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
436
425
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
437
426
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
438
427
  if (r2) {
439
428
  throw takeObject(r1);
440
429
  }
441
- return Field.__wrap(r0);
430
+ return r0 !== 0;
442
431
  } finally {
443
432
  wasm$1.__wbindgen_add_to_stack_pointer(16);
444
433
  }
@@ -464,6 +453,28 @@ function getOrInitConsensusVersionTestHeights(heights) {
464
453
  return takeObject(ret);
465
454
  }
466
455
 
456
+ /**
457
+ * @param {string} string
458
+ * @returns {Field}
459
+ */
460
+ function stringToField(string) {
461
+ try {
462
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
463
+ const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
464
+ const len0 = WASM_VECTOR_LEN;
465
+ wasm$1.stringToField(retptr, ptr0, len0);
466
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
467
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
468
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
469
+ if (r2) {
470
+ throw takeObject(r1);
471
+ }
472
+ return Field.__wrap(r0);
473
+ } finally {
474
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
475
+ }
476
+ }
477
+
467
478
  function passArrayJsValueToWasm0(array, malloc) {
468
479
  const ptr = malloc(array.length * 4, 4) >>> 0;
469
480
  const mem = getDataViewMemory0();
@@ -483,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
483
494
  }
484
495
  return result;
485
496
  }
486
- function __wasm_bindgen_func_elem_8618(arg0, arg1, arg2) {
487
- wasm$1.__wasm_bindgen_func_elem_8618(arg0, arg1, addHeapObject(arg2));
497
+ function __wasm_bindgen_func_elem_7287(arg0, arg1) {
498
+ wasm$1.__wasm_bindgen_func_elem_7287(arg0, arg1);
488
499
  }
489
500
 
490
- function __wasm_bindgen_func_elem_7256(arg0, arg1) {
491
- wasm$1.__wasm_bindgen_func_elem_7256(arg0, arg1);
501
+ function __wasm_bindgen_func_elem_8655(arg0, arg1, arg2) {
502
+ wasm$1.__wasm_bindgen_func_elem_8655(arg0, arg1, addHeapObject(arg2));
492
503
  }
493
504
 
494
- function __wasm_bindgen_func_elem_7529(arg0, arg1, arg2, arg3) {
495
- wasm$1.__wasm_bindgen_func_elem_7529(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
505
+ function __wasm_bindgen_func_elem_7560(arg0, arg1, arg2, arg3) {
506
+ wasm$1.__wasm_bindgen_func_elem_7560(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
496
507
  }
497
508
 
498
509
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -12397,6 +12408,17 @@ const ProvingRequestFinalization = (typeof FinalizationRegistry === 'undefined')
12397
12408
  : new FinalizationRegistry(ptr => wasm$1.__wbg_provingrequest_free(ptr >>> 0, 1));
12398
12409
  /**
12399
12410
  * Represents a proving request to a prover.
12411
+ *
12412
+ * Carries one of two variants:
12413
+ * - `Authorization` — a fully-constructed snarkVM `Authorization` (plus optional
12414
+ * fee authorization). Submitted to `/prove/authorization` (encrypted-only).
12415
+ * - `Request` — a single signed snarkVM `Request` (plus optional fee `Request`)
12416
+ * that the prover authorizes server-side. Submitted to `/prove/request`
12417
+ * (encrypted-only).
12418
+ *
12419
+ * Use {@link ProvingRequest#kind} when handling a `ProvingRequest` of unknown
12420
+ * variant (e.g. after deserialization). Variant-specific accessors throw if
12421
+ * called on the wrong variant.
12400
12422
  */
12401
12423
  class ProvingRequest {
12402
12424
 
@@ -12420,9 +12442,23 @@ class ProvingRequest {
12420
12442
  wasm$1.__wbg_provingrequest_free(ptr, 0);
12421
12443
  }
12422
12444
  /**
12423
- * Creates a ProvingRequest from a string representation.
12445
+ * Returns the signed fee `ExecutionRequest` in the Request variant, or
12446
+ * `undefined` when no fee request is set or this is an Authorization variant.
12447
+ * @returns {ExecutionRequest | undefined}
12448
+ */
12449
+ feeRequest() {
12450
+ const ret = wasm$1.provingrequest_feeRequest(this.__wbg_ptr);
12451
+ return ret === 0 ? undefined : ExecutionRequest.__wrap(ret);
12452
+ }
12453
+ /**
12454
+ * Creates a `ProvingRequest` from a JSON string representation.
12424
12455
  *
12425
- * @param {Uint8Array} request String representation of the ProvingRequest.
12456
+ * The variant is determined automatically by the JSON shape:
12457
+ * `{ authorization, ... }` → Authorization variant; `{ request, ... }` →
12458
+ * Request variant. Use {@link ProvingRequest#kind} to inspect the
12459
+ * resulting variant.
12460
+ *
12461
+ * @param {string} request JSON string representation of the ProvingRequest.
12426
12462
  * @param {string} request
12427
12463
  * @returns {ProvingRequest}
12428
12464
  */
@@ -12444,7 +12480,10 @@ class ProvingRequest {
12444
12480
  }
12445
12481
  }
12446
12482
  /**
12447
- * Creates a left-endian byte representation of the ProvingRequest.
12483
+ * Creates a left-endian byte representation of the ProvingRequest,
12484
+ * dispatching on the variant. The bytes are wire-compatible with the
12485
+ * matching DPS route (`/prove[/encrypted]` for Authorization,
12486
+ * `/prove/request` for Request).
12448
12487
  * @returns {Uint8Array}
12449
12488
  */
12450
12489
  toBytesLe() {
@@ -12463,17 +12502,64 @@ class ProvingRequest {
12463
12502
  }
12464
12503
  }
12465
12504
  /**
12466
- * Get the Authorization of the main function in the ProvingRequest.
12505
+ * Creates a new Request-variant `ProvingRequest` from a single signed
12506
+ * `ExecutionRequest` and an optional signed fee `ExecutionRequest`.
12507
+ *
12508
+ * The Request variant is processed by the DPS at the `/prove/request`
12509
+ * endpoint, which is encrypted-only. The server runs
12510
+ * `Process::authorize_request` to turn each `Request` into an
12511
+ * `Authorization` before proving.
12512
+ *
12513
+ * Only valid for single-public-request executions. Layered / nested
12514
+ * calls are not supported by `/prove/request` at this time.
12515
+ *
12516
+ * @param {ExecutionRequest} request The signed request for the function.
12517
+ * @param {ExecutionRequest} fee_request Optional signed request for the fee function. When omitted, the prover generates and pays the fee.
12518
+ * @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
12519
+ * @param {ExecutionRequest} request
12520
+ * @param {ExecutionRequest | null | undefined} fee_request
12521
+ * @param {boolean} broadcast
12522
+ * @returns {ProvingRequest}
12523
+ */
12524
+ static fromRequest(request, fee_request, broadcast) {
12525
+ _assertClass(request, ExecutionRequest);
12526
+ var ptr0 = request.__destroy_into_raw();
12527
+ let ptr1 = 0;
12528
+ if (!isLikeNone(fee_request)) {
12529
+ _assertClass(fee_request, ExecutionRequest);
12530
+ ptr1 = fee_request.__destroy_into_raw();
12531
+ }
12532
+ const ret = wasm$1.provingrequest_fromRequest(ptr0, ptr1, broadcast);
12533
+ return ProvingRequest.__wrap(ret);
12534
+ }
12535
+ /**
12536
+ * Returns the Authorization of the main function in the ProvingRequest.
12537
+ *
12538
+ * @throws If this `ProvingRequest` is a Request variant. Check
12539
+ * {@link ProvingRequest#kind} or use {@link ProvingRequest#request} instead.
12467
12540
  * @returns {Authorization}
12468
12541
  */
12469
12542
  authorization() {
12470
- const ret = wasm$1.provingrequest_authorization(this.__wbg_ptr);
12471
- return Authorization.__wrap(ret);
12543
+ try {
12544
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
12545
+ wasm$1.provingrequest_authorization(retptr, this.__wbg_ptr);
12546
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12547
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12548
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
12549
+ if (r2) {
12550
+ throw takeObject(r1);
12551
+ }
12552
+ return Authorization.__wrap(r0);
12553
+ } finally {
12554
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
12555
+ }
12472
12556
  }
12473
12557
  /**
12474
- * Creates a ProvingRequest from a left-endian byte representation of the ProvingRequest.
12558
+ * Reads bytes as an Authorization-variant `ProvingRequest`. For the
12559
+ * Request variant, use {@link ProvingRequest.fromBytesLeRequest}
12560
+ * explicitly — byte layout carries no variant discriminator.
12475
12561
  *
12476
- * @param {Uint8Array} bytes Left-endian bytes representing the proving request.
12562
+ * @param {Uint8Array} bytes Left-endian bytes representing an Authorization-variant proving request.
12477
12563
  * @param {Uint8Array} bytes
12478
12564
  * @returns {ProvingRequest}
12479
12565
  */
@@ -12493,7 +12579,8 @@ class ProvingRequest {
12493
12579
  }
12494
12580
  }
12495
12581
  /**
12496
- * Get the fee Authorization in the ProvingRequest.
12582
+ * Returns the fee Authorization in the ProvingRequest, or `undefined`
12583
+ * when no fee is set or this is a Request variant.
12497
12584
  * @returns {Authorization | undefined}
12498
12585
  */
12499
12586
  feeAuthorization() {
@@ -12501,7 +12588,32 @@ class ProvingRequest {
12501
12588
  return ret === 0 ? undefined : Authorization.__wrap(ret);
12502
12589
  }
12503
12590
  /**
12504
- * Creates a new ProvingRequest from a function Authorization and an optional fee Authorization.
12591
+ * Reads bytes as a Request-variant `ProvingRequest`. Byte layout is
12592
+ * disjoint from the Authorization variant; callers must pick the right
12593
+ * reader for the bytes they hold.
12594
+ *
12595
+ * @param {Uint8Array} bytes Left-endian bytes representing a Request-variant proving request.
12596
+ * @param {Uint8Array} bytes
12597
+ * @returns {ProvingRequest}
12598
+ */
12599
+ static fromBytesLeRequest(bytes) {
12600
+ try {
12601
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
12602
+ wasm$1.provingrequest_fromBytesLeRequest(retptr, addHeapObject(bytes));
12603
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12604
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12605
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
12606
+ if (r2) {
12607
+ throw takeObject(r1);
12608
+ }
12609
+ return ProvingRequest.__wrap(r0);
12610
+ } finally {
12611
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
12612
+ }
12613
+ }
12614
+ /**
12615
+ * Creates a new Authorization-variant `ProvingRequest` from a function
12616
+ * `Authorization` and an optional fee `Authorization`.
12505
12617
  *
12506
12618
  * @param {Authorization} authorization An Authorization for a function.
12507
12619
  * @param {Authorization} fee_authorization The authorization for the `credits.aleo/fee_public` or `credits.aleo/fee_private` function that pays the fee for the execution of the main function.
@@ -12522,6 +12634,28 @@ class ProvingRequest {
12522
12634
  const ret = wasm$1.provingrequest_new(ptr0, ptr1, broadcast);
12523
12635
  return ProvingRequest.__wrap(ret);
12524
12636
  }
12637
+ /**
12638
+ * Returns the variant of this `ProvingRequest`: `"authorization"` or
12639
+ * `"request"`. Useful when handling a `ProvingRequest` whose variant
12640
+ * was determined at deserialization time.
12641
+ * @returns {string}
12642
+ */
12643
+ kind() {
12644
+ let deferred1_0;
12645
+ let deferred1_1;
12646
+ try {
12647
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
12648
+ wasm$1.provingrequest_kind(retptr, this.__wbg_ptr);
12649
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12650
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12651
+ deferred1_0 = r0;
12652
+ deferred1_1 = r1;
12653
+ return getStringFromWasm0(r0, r1);
12654
+ } finally {
12655
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
12656
+ wasm$1.__wbindgen_export4(deferred1_0, deferred1_1, 1);
12657
+ }
12658
+ }
12525
12659
  /**
12526
12660
  * Check if a ProvingRequest is the same as another ProvingRequest.
12527
12661
  * @param {ProvingRequest} other
@@ -12532,6 +12666,29 @@ class ProvingRequest {
12532
12666
  const ret = wasm$1.provingrequest_equals(this.__wbg_ptr, other.__wbg_ptr);
12533
12667
  return ret !== 0;
12534
12668
  }
12669
+ /**
12670
+ * Returns the signed `ExecutionRequest` carried by the Request variant.
12671
+ *
12672
+ * @throws If this `ProvingRequest` is an Authorization variant. Check
12673
+ * {@link ProvingRequest#kind} or use {@link ProvingRequest#authorization}
12674
+ * instead.
12675
+ * @returns {ExecutionRequest}
12676
+ */
12677
+ request() {
12678
+ try {
12679
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
12680
+ wasm$1.provingrequest_request(retptr, this.__wbg_ptr);
12681
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12682
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12683
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
12684
+ if (r2) {
12685
+ throw takeObject(r1);
12686
+ }
12687
+ return ExecutionRequest.__wrap(r0);
12688
+ } finally {
12689
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
12690
+ }
12691
+ }
12535
12692
  /**
12536
12693
  * Get the broadcast flag set in the ProvingRequest.
12537
12694
  * @returns {boolean}
@@ -12541,7 +12698,9 @@ class ProvingRequest {
12541
12698
  return ret !== 0;
12542
12699
  }
12543
12700
  /**
12544
- * Creates a string representation of the ProvingRequest.
12701
+ * Creates a JSON string representation of the ProvingRequest.
12702
+ * The shape carries enough information to recover the variant via
12703
+ * {@link ProvingRequest.fromString}.
12545
12704
  * @returns {string}
12546
12705
  */
12547
12706
  toString() {
@@ -19087,7 +19246,7 @@ function __wbg_get_imports(memory) {
19087
19246
  const ret = getObject(arg0).length;
19088
19247
  return ret;
19089
19248
  };
19090
- imports.wbg.__wbg_log_2c81ec274d38c9bb = function(arg0, arg1) {
19249
+ imports.wbg.__wbg_log_b88efcc0ed7757a6 = function(arg0, arg1) {
19091
19250
  console.log(getStringFromWasm0(arg0, arg1));
19092
19251
  };
19093
19252
  imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
@@ -19109,7 +19268,7 @@ function __wbg_get_imports(memory) {
19109
19268
  const a = state0.a;
19110
19269
  state0.a = 0;
19111
19270
  try {
19112
- return __wasm_bindgen_func_elem_7529(a, state0.b, arg0, arg1);
19271
+ return __wasm_bindgen_func_elem_7560(a, state0.b, arg0, arg1);
19113
19272
  } finally {
19114
19273
  state0.a = a;
19115
19274
  }
@@ -19296,7 +19455,7 @@ function __wbg_get_imports(memory) {
19296
19455
  const ret = Signature.__wrap(arg0);
19297
19456
  return addHeapObject(ret);
19298
19457
  };
19299
- imports.wbg.__wbg_spawnWorker_c5c00ae0c7b9fe56 = function(arg0, arg1, arg2, arg3) {
19458
+ imports.wbg.__wbg_spawnWorker_6ede797d507e374c = function(arg0, arg1, arg2, arg3) {
19300
19459
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19301
19460
  return addHeapObject(ret);
19302
19461
  };
@@ -19398,7 +19557,7 @@ function __wbg_get_imports(memory) {
19398
19557
  };
19399
19558
  imports.wbg.__wbindgen_cast_3ebebf8ee554379e = function(arg0, arg1) {
19400
19559
  // 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`.
19401
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7255, __wasm_bindgen_func_elem_8618);
19560
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
19402
19561
  return addHeapObject(ret);
19403
19562
  };
19404
19563
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
@@ -19408,12 +19567,12 @@ function __wbg_get_imports(memory) {
19408
19567
  };
19409
19568
  imports.wbg.__wbindgen_cast_5e9bcb6388942484 = function(arg0, arg1) {
19410
19569
  // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [], shim_idx: 462, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19411
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7255, __wasm_bindgen_func_elem_7256);
19570
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_7287);
19412
19571
  return addHeapObject(ret);
19413
19572
  };
19414
19573
  imports.wbg.__wbindgen_cast_74f3a90a349943d1 = function(arg0, arg1) {
19415
19574
  // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [Externref], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19416
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7255, __wasm_bindgen_func_elem_8618);
19575
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
19417
19576
  return addHeapObject(ret);
19418
19577
  };
19419
19578
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19582,6 +19741,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
19582
19741
  initSync: initSync$1,
19583
19742
  initThreadPool: initThreadPool,
19584
19743
  runRayonThread: runRayonThread,
19744
+ setWasmLogLevel: setWasmLogLevel,
19585
19745
  snarkVerify: snarkVerify,
19586
19746
  snarkVerifyBatch: snarkVerifyBatch,
19587
19747
  stringToField: stringToField,