@provablehq/wasm 0.10.4 → 0.10.5
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 +63 -6
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +220 -52
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +219 -53
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +220 -52
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +75 -18
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +252 -84
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +251 -85
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +252 -84
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,18 +2,6 @@
|
|
|
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
|
-
* 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
|
|
15
|
-
*/
|
|
16
|
-
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
17
5
|
/**
|
|
18
6
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
19
7
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -40,6 +28,18 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
|
|
|
40
28
|
* @returns {boolean} True if the proof is valid, false otherwise
|
|
41
29
|
*/
|
|
42
30
|
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
33
|
+
*
|
|
34
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
35
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
36
|
+
*
|
|
37
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
38
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
39
|
+
* @param {Proof} proof The batch proof to verify
|
|
40
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
export function snarkVerifyBatch(verifying_keys: Array<any>, 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
|
|
@@ -3078,7 +3097,7 @@ export class ProgramManager {
|
|
|
3078
3097
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3079
3098
|
* @returns {Transaction} Transaction object
|
|
3080
3099
|
*/
|
|
3081
|
-
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>;
|
|
3082
3101
|
/**
|
|
3083
3102
|
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
3084
3103
|
*
|
|
@@ -3091,7 +3110,7 @@ export class ProgramManager {
|
|
|
3091
3110
|
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
3092
3111
|
* @returns {Transaction} Transaction object
|
|
3093
3112
|
*/
|
|
3094
|
-
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>;
|
|
3095
3114
|
/**
|
|
3096
3115
|
* Deploy an Aleo program without synthesizing keys and generating certificates.
|
|
3097
3116
|
* Intended for use with Leo Devnode.
|
|
@@ -3244,7 +3263,7 @@ export class ProgramManager {
|
|
|
3244
3263
|
* @param url The url to get the inclusion proving information from.
|
|
3245
3264
|
* @param offline_query Optional offline query object if building a Transaction offline.
|
|
3246
3265
|
*/
|
|
3247
|
-
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>;
|
|
3248
3267
|
/**
|
|
3249
3268
|
* Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
|
|
3250
3269
|
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
@@ -3279,7 +3298,24 @@ export class ProgramManager {
|
|
|
3279
3298
|
* @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
|
|
3280
3299
|
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
3281
3300
|
*/
|
|
3282
|
-
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;
|
|
3283
3319
|
/**
|
|
3284
3320
|
* Estimate Fee for an Authorization.
|
|
3285
3321
|
*
|
|
@@ -3319,7 +3355,7 @@ export class ProgramManager {
|
|
|
3319
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.
|
|
3320
3356
|
* @returns {Transaction}
|
|
3321
3357
|
*/
|
|
3322
|
-
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>;
|
|
3323
3359
|
/**
|
|
3324
3360
|
* Send credits from one Aleo account to another
|
|
3325
3361
|
*
|
|
@@ -3337,7 +3373,7 @@ export class ProgramManager {
|
|
|
3337
3373
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3338
3374
|
* @returns {Transaction}
|
|
3339
3375
|
*/
|
|
3340
|
-
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>;
|
|
3341
3377
|
/**
|
|
3342
3378
|
* Create an `Authorization` for `credits.aleo/fee_public` or `credits.aleo/fee_private`.
|
|
3343
3379
|
* This object requires an associated execution or deployment ID. This can be gained from
|
|
@@ -3665,6 +3701,27 @@ export class ProvingRequest {
|
|
|
3665
3701
|
*/
|
|
3666
3702
|
toString(): string;
|
|
3667
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
|
+
}
|
|
3668
3725
|
/**
|
|
3669
3726
|
* Encrypted Aleo record
|
|
3670
3727
|
*/
|
|
Binary file
|