@provablehq/wasm 0.10.6-rc.1 → 0.11.1

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.
@@ -2,6 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export function runRayonThread(receiver: number): void;
4
4
  export function initThreadPool(url: URL, num_threads: number): Promise<void>;
5
+ /**
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.
10
+ */
11
+ export function setWasmLogLevel(level: number): void;
5
12
  /**
6
13
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
7
14
  *
@@ -40,7 +47,6 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
40
47
  * @returns {boolean} True if the execution is valid, false otherwise
41
48
  */
42
49
  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;
43
- export function stringToField(string: string): Field;
44
50
  /**
45
51
  * Set test consensus version heights for testing.
46
52
  *
@@ -50,9 +56,10 @@ export function stringToField(string: string): Field;
50
56
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
51
57
  *
52
58
  * Set the consensus version heights.
53
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
59
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
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