@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.
@@ -3,17 +3,12 @@
3
3
  export function runRayonThread(receiver: number): void;
4
4
  export function initThreadPool(url: URL, num_threads: number): Promise<void>;
5
5
  /**
6
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
7
- *
8
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
9
- * Each verifying key is paired with one or more sets of public inputs (instances).
10
- *
11
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
12
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
13
- * @param {Proof} proof The batch proof to verify
14
- * @returns {boolean} True if the batch proof is valid, false otherwise
6
+ * Set the WASM log level from JS. Called automatically by the SDK's
7
+ * `setLogLevel(level)` to keep TS and WASM logging in sync.
8
+ * Levels: 0=silent, 1=error, 2=warn, 3=info (default), 4=debug.
9
+ * Values above 4 are clamped to debug.
15
10
  */
16
- export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
11
+ export function setWasmLogLevel(level: number): void;
17
12
  /**
18
13
  * Verify a SNARK proof against a verifying key and public inputs.
19
14
  *
@@ -26,6 +21,18 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
26
21
  * @returns {boolean} True if the proof is valid, false otherwise
27
22
  */
28
23
  export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
24
+ /**
25
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
26
+ *
27
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
28
+ * Each verifying key is paired with one or more sets of public inputs (instances).
29
+ *
30
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
31
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
32
+ * @param {Proof} proof The batch proof to verify
33
+ * @returns {boolean} True if the batch proof is valid, false otherwise
34
+ */
35
+ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
29
36
  /**
30
37
  * Verify an execution. Executions with multiple transitions must have the program source code and
31
38
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -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
@@ -302,6 +302,17 @@ function initThreadPool(url, num_threads) {
302
302
  return takeObject(ret);
303
303
  }
304
304
 
305
+ /**
306
+ * Set the WASM log level from JS. Called automatically by the SDK's
307
+ * `setLogLevel(level)` to keep TS and WASM logging in sync.
308
+ * Levels: 0=silent, 1=error, 2=warn, 3=info (default), 4=debug.
309
+ * Values above 4 are clamped to debug.
310
+ * @param {number} level
311
+ */
312
+ function setWasmLogLevel(level) {
313
+ wasm$1.setWasmLogLevel(level);
314
+ }
315
+
305
316
  let stack_pointer = 128;
306
317
 
307
318
  function addBorrowedObject(obj) {
@@ -310,25 +321,26 @@ function addBorrowedObject(obj) {
310
321
  return stack_pointer;
311
322
  }
312
323
  /**
313
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
324
+ * Verify a SNARK proof against a verifying key and public inputs.
314
325
  *
315
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
316
- * Each verifying key is paired with one or more sets of public inputs (instances).
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.
317
328
  *
318
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
319
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
320
- * @param {Proof} proof The batch proof to verify
321
- * @returns {boolean} True if the batch proof is valid, false otherwise
322
- * @param {Array<any>} verifying_keys
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
323
334
  * @param {Array<any>} inputs
324
335
  * @param {Proof} proof
325
336
  * @returns {boolean}
326
337
  */
327
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
338
+ function snarkVerify(verifying_key, inputs, proof) {
328
339
  try {
329
340
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
341
+ _assertClass(verifying_key, VerifyingKey);
330
342
  _assertClass(proof, Proof);
331
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
343
+ wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
332
344
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
333
345
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
334
346
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -342,26 +354,25 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
342
354
  }
343
355
 
344
356
  /**
345
- * Verify a SNARK proof against a verifying key and public inputs.
357
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
346
358
  *
347
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
348
- * It directly invokes the Varuna proof verification from snarkVM.
359
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
360
+ * Each verifying key is paired with one or more sets of public inputs (instances).
349
361
  *
350
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
351
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
352
- * @param {Proof} proof The proof to verify
353
- * @returns {boolean} True if the proof is valid, false otherwise
354
- * @param {VerifyingKey} verifying_key
362
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
363
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
364
+ * @param {Proof} proof The batch proof to verify
365
+ * @returns {boolean} True if the batch proof is valid, false otherwise
366
+ * @param {Array<any>} verifying_keys
355
367
  * @param {Array<any>} inputs
356
368
  * @param {Proof} proof
357
369
  * @returns {boolean}
358
370
  */
359
- function snarkVerify(verifying_key, inputs, proof) {
371
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
360
372
  try {
361
373
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
362
- _assertClass(verifying_key, VerifyingKey);
363
374
  _assertClass(proof, Proof);
364
- wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
375
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
365
376
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
366
377
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
367
378
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -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_8655(arg0, arg1, arg2) {
498
+ wasm$1.__wasm_bindgen_func_elem_8655(arg0, arg1, addHeapObject(arg2));
488
499
  }
489
500
 
490
- function __wasm_bindgen_func_elem_7257(arg0, arg1) {
491
- wasm$1.__wasm_bindgen_func_elem_7257(arg0, arg1);
501
+ function __wasm_bindgen_func_elem_7286(arg0, arg1) {
502
+ wasm$1.__wasm_bindgen_func_elem_7286(arg0, arg1);
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_7558(arg0, arg1, arg2, arg3) {
506
+ wasm$1.__wasm_bindgen_func_elem_7558(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.
12455
+ *
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.
12424
12460
  *
12425
- * @param {Uint8Array} request String representation of the ProvingRequest.
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_7558(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
  };
@@ -19403,7 +19562,7 @@ function __wbg_get_imports(memory) {
19403
19562
  };
19404
19563
  imports.wbg.__wbindgen_cast_711d7deea8fc39ca = function(arg0, arg1) {
19405
19564
  // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [Externref], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19406
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7256, __wasm_bindgen_func_elem_8618);
19565
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7285, __wasm_bindgen_func_elem_8655);
19407
19566
  return addHeapObject(ret);
19408
19567
  };
19409
19568
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19413,7 +19572,7 @@ function __wbg_get_imports(memory) {
19413
19572
  };
19414
19573
  imports.wbg.__wbindgen_cast_cada7727142cd213 = function(arg0, arg1) {
19415
19574
  // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19416
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7256, __wasm_bindgen_func_elem_8618);
19575
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7285, __wasm_bindgen_func_elem_8655);
19417
19576
  return addHeapObject(ret);
19418
19577
  };
19419
19578
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
@@ -19423,7 +19582,7 @@ function __wbg_get_imports(memory) {
19423
19582
  };
19424
19583
  imports.wbg.__wbindgen_cast_cdf07f87b2615f8c = function(arg0, arg1) {
19425
19584
  // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [], shim_idx: 462, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19426
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7256, __wasm_bindgen_func_elem_7257);
19585
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7285, __wasm_bindgen_func_elem_7286);
19427
19586
  return addHeapObject(ret);
19428
19587
  };
19429
19588
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = 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,