@provablehq/wasm 0.10.3 → 0.10.5-rc.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.
- package/dist/mainnet/aleo_wasm.d.ts +81 -18
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +263 -85
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +262 -86
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +263 -85
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +69 -6
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +230 -52
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +229 -53
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +230 -52
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,18 +14,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
14
14
|
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
15
15
|
*/
|
|
16
16
|
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Verify a SNARK proof against a verifying key and public inputs.
|
|
19
|
-
*
|
|
20
|
-
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
21
|
-
* It directly invokes the Varuna proof verification from snarkVM.
|
|
22
|
-
*
|
|
23
|
-
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
24
|
-
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
25
|
-
* @param {Proof} proof The proof to verify
|
|
26
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
27
|
-
*/
|
|
28
|
-
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
29
17
|
/**
|
|
30
18
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
31
19
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -40,6 +28,18 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
|
|
|
40
28
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
41
29
|
*/
|
|
42
30
|
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): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
33
|
+
*
|
|
34
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
35
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
36
|
+
*
|
|
37
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
38
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
39
|
+
* @param {Proof} proof The proof to verify
|
|
40
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
43
43
|
export function stringToField(string: string): Field;
|
|
44
44
|
/**
|
|
45
45
|
* Set test consensus version heights for testing.
|
|
@@ -570,6 +570,25 @@ export class Boolean {
|
|
|
570
570
|
*/
|
|
571
571
|
toString(): string;
|
|
572
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* A query implementation that delegates state fetching to JS callback functions.
|
|
575
|
+
*
|
|
576
|
+
* Instead of making direct HTTP calls via reqwest, each QueryTrait method
|
|
577
|
+
* calls a JS function that returns a Promise. The JS side handles the actual
|
|
578
|
+
* network request through the configured transport.
|
|
579
|
+
*/
|
|
580
|
+
export class CallbackQuery {
|
|
581
|
+
free(): void;
|
|
582
|
+
[Symbol.dispose](): void;
|
|
583
|
+
/**
|
|
584
|
+
* Create a new CallbackQuery with JS callback functions.
|
|
585
|
+
*
|
|
586
|
+
* @param {Function} get_state_root A function that returns Promise<string> (the state root)
|
|
587
|
+
* @param {Function} get_state_paths A function that takes string[] (commitments) and returns Promise<string[]> (state paths)
|
|
588
|
+
* @param {Function} get_block_height A function that returns Promise<number> (the block height)
|
|
589
|
+
*/
|
|
590
|
+
constructor(get_state_root: Function, get_state_paths: Function, get_block_height: Function);
|
|
591
|
+
}
|
|
573
592
|
/**
|
|
574
593
|
* SnarkVM Ciphertext object. A Ciphertext represents an symmetrically encrypted plaintext. This
|
|
575
594
|
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
@@ -2813,6 +2832,12 @@ export class Program {
|
|
|
2813
2832
|
* console.log(imports === expected_imports); // Output should be "true"
|
|
2814
2833
|
*/
|
|
2815
2834
|
getImports(): Array<any>;
|
|
2835
|
+
/**
|
|
2836
|
+
* Get the checksum of the program.
|
|
2837
|
+
*
|
|
2838
|
+
* @returns {Uint8Array} The checksum of the program as a 32-byte Uint8Array
|
|
2839
|
+
*/
|
|
2840
|
+
toChecksum(): Uint8Array;
|
|
2816
2841
|
/**
|
|
2817
2842
|
* Get a the list of a program's mappings and the names/types of their keys and values.
|
|
2818
2843
|
*
|
|
@@ -3072,7 +3097,7 @@ export class ProgramManager {
|
|
|
3072
3097
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3073
3098
|
* @returns {Transaction} Transaction object
|
|
3074
3099
|
*/
|
|
3075
|
-
static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, join_proving_key?: ProvingKey | null, join_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null,
|
|
3100
|
+
static buildJoinTransaction(private_key: PrivateKey, record_1: RecordPlaintext, record_2: RecordPlaintext, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, join_proving_key?: ProvingKey | null, join_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, query?: QueryOption | null): Promise<Transaction>;
|
|
3076
3101
|
/**
|
|
3077
3102
|
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
3078
3103
|
*
|
|
@@ -3085,7 +3110,7 @@ export class ProgramManager {
|
|
|
3085
3110
|
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
3086
3111
|
* @returns {Transaction} Transaction object
|
|
3087
3112
|
*/
|
|
3088
|
-
static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url?: string | null, split_proving_key?: ProvingKey | null, split_verifying_key?: VerifyingKey | null,
|
|
3113
|
+
static buildSplitTransaction(private_key: PrivateKey, split_amount: number, amount_record: RecordPlaintext, url?: string | null, split_proving_key?: ProvingKey | null, split_verifying_key?: VerifyingKey | null, query?: QueryOption | null): Promise<Transaction>;
|
|
3089
3114
|
/**
|
|
3090
3115
|
* Deploy an Aleo program without synthesizing keys and generating certificates.
|
|
3091
3116
|
* Intended for use with Leo Devnode.
|
|
@@ -3238,7 +3263,7 @@ export class ProgramManager {
|
|
|
3238
3263
|
* @param url The url to get the inclusion proving information from.
|
|
3239
3264
|
* @param offline_query Optional offline query object if building a Transaction offline.
|
|
3240
3265
|
*/
|
|
3241
|
-
static executeAuthorization(authorization: Authorization, fee_authorization: Authorization | null | undefined, program: string, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, imports?: object | null, url?: string | null,
|
|
3266
|
+
static executeAuthorization(authorization: Authorization, fee_authorization: Authorization | null | undefined, program: string, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, imports?: object | null, url?: string | null, query?: QueryOption | null): Promise<Transaction>;
|
|
3242
3267
|
/**
|
|
3243
3268
|
* Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
|
|
3244
3269
|
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
@@ -3273,7 +3298,24 @@ export class ProgramManager {
|
|
|
3273
3298
|
* @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
|
|
3274
3299
|
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
3275
3300
|
*/
|
|
3276
|
-
static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, url?: string | null,
|
|
3301
|
+
static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, url?: string | null, query?: QueryOption | null, edition?: number | null): Promise<ExecutionResponse>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Compute the query requirements for a function execution without making
|
|
3304
|
+
* any network calls. Returns the commitments that need state paths and
|
|
3305
|
+
* whether the function has dynamic record inputs.
|
|
3306
|
+
*
|
|
3307
|
+
* This enables the JS layer to pre-fetch state data via its configured
|
|
3308
|
+
* transport and construct an OfflineQuery, so that the subsequent WASM
|
|
3309
|
+
* execution call never makes its own network requests.
|
|
3310
|
+
*
|
|
3311
|
+
* @param {string} program The source code of the program
|
|
3312
|
+
* @param {string} function_name The name of the function to execute
|
|
3313
|
+
* @param {Array} inputs The inputs to the function
|
|
3314
|
+
* @param {PrivateKey} private_key The private key (used to derive the view key for commitment computation)
|
|
3315
|
+
* @param {RecordPlaintext | undefined} fee_record Optional fee record to include in commitment computation
|
|
3316
|
+
* @returns {Object} An object with { commitments: string[], hasDynamicInputs: boolean }
|
|
3317
|
+
*/
|
|
3318
|
+
static computeQueryRequirements(program: string, function_name: string, inputs: Array<any>, private_key: PrivateKey, fee_record?: RecordPlaintext | null): any;
|
|
3277
3319
|
/**
|
|
3278
3320
|
* Estimate Fee for an Authorization.
|
|
3279
3321
|
*
|
|
@@ -3313,7 +3355,7 @@ export class ProgramManager {
|
|
|
3313
3355
|
* @param edition The edition of the program to execute. Defaults to the latest found on the network, or 1 if the program does not exist on the network.
|
|
3314
3356
|
* @returns {Transaction}
|
|
3315
3357
|
*/
|
|
3316
|
-
static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null,
|
|
3358
|
+
static buildExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, query?: QueryOption | null, edition?: number | null): Promise<Transaction>;
|
|
3317
3359
|
/**
|
|
3318
3360
|
* Send credits from one Aleo account to another
|
|
3319
3361
|
*
|
|
@@ -3331,7 +3373,7 @@ export class ProgramManager {
|
|
|
3331
3373
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3332
3374
|
* @returns {Transaction}
|
|
3333
3375
|
*/
|
|
3334
|
-
static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | null | undefined, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, transfer_proving_key?: ProvingKey | null, transfer_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null,
|
|
3376
|
+
static buildTransferTransaction(private_key: PrivateKey, amount_credits: number, recipient: string, transfer_type: string, amount_record: RecordPlaintext | null | undefined, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, transfer_proving_key?: ProvingKey | null, transfer_verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, query?: QueryOption | null): Promise<Transaction>;
|
|
3335
3377
|
/**
|
|
3336
3378
|
* Create an `Authorization` for `credits.aleo/fee_public` or `credits.aleo/fee_private`.
|
|
3337
3379
|
* This object requires an associated execution or deployment ID. This can be gained from
|
|
@@ -3659,6 +3701,27 @@ export class ProvingRequest {
|
|
|
3659
3701
|
*/
|
|
3660
3702
|
toString(): string;
|
|
3661
3703
|
}
|
|
3704
|
+
/**
|
|
3705
|
+
* A unified query type that wraps either an OfflineQuery (pre-fetched state)
|
|
3706
|
+
* or a CallbackQuery (on-demand JS transport delegation).
|
|
3707
|
+
*
|
|
3708
|
+
* Construct from JavaScript using the static factory methods:
|
|
3709
|
+
* - `QueryOption.offlineQuery(offlineQuery)` for pre-fetched state
|
|
3710
|
+
* - `QueryOption.callbackQuery(callbackQuery)` for on-demand JS callbacks
|
|
3711
|
+
*/
|
|
3712
|
+
export class QueryOption {
|
|
3713
|
+
private constructor();
|
|
3714
|
+
free(): void;
|
|
3715
|
+
[Symbol.dispose](): void;
|
|
3716
|
+
/**
|
|
3717
|
+
* Create a QueryOption from an OfflineQuery.
|
|
3718
|
+
*/
|
|
3719
|
+
static offlineQuery(query: OfflineQuery): QueryOption;
|
|
3720
|
+
/**
|
|
3721
|
+
* Create a QueryOption from a CallbackQuery.
|
|
3722
|
+
*/
|
|
3723
|
+
static callbackQuery(query: CallbackQuery): QueryOption;
|
|
3724
|
+
}
|
|
3662
3725
|
/**
|
|
3663
3726
|
* Encrypted Aleo record
|
|
3664
3727
|
*/
|
|
Binary file
|