@provablehq/wasm 0.10.5 → 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.
- package/dist/mainnet/aleo_wasm.d.ts +329 -60
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +860 -130
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +859 -131
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +860 -130
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +328 -59
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +850 -120
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +849 -121
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +850 -120
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function runRayonThread(receiver: number): void;
|
|
4
|
-
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
12
|
-
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
13
|
-
* @param {Proof} proof The proof to verify
|
|
14
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
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.
|
|
15
9
|
*/
|
|
16
|
-
export function
|
|
10
|
+
export function setWasmLogLevel(level: number): void;
|
|
11
|
+
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
17
12
|
/**
|
|
18
13
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
19
14
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -27,7 +22,19 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
|
|
|
27
22
|
* @param {Object} import_verifying_keys The verifying keys for the imports in the form of { "program_id.aleo": [["function, "verifying_key"], ...], ...}
|
|
28
23
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
29
24
|
*/
|
|
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;
|
|
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;
|
|
26
|
+
/**
|
|
27
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
28
|
+
*
|
|
29
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
30
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
31
|
+
*
|
|
32
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
33
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
34
|
+
* @param {Proof} proof The proof to verify
|
|
35
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
31
38
|
/**
|
|
32
39
|
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
33
40
|
*
|
|
@@ -40,7 +47,6 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
|
|
|
40
47
|
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
41
48
|
*/
|
|
42
49
|
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
43
|
-
export function stringToField(string: string): Field;
|
|
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
|
*/
|
|
@@ -2887,6 +2894,18 @@ export class Program {
|
|
|
2887
2894
|
* console.log(credits_functions === expected_functions); // Output should be "true"
|
|
2888
2895
|
*/
|
|
2889
2896
|
getFunctions(): Array<any>;
|
|
2897
|
+
/**
|
|
2898
|
+
* Get the external call graph reachable from a specific entry function.
|
|
2899
|
+
*
|
|
2900
|
+
* Starting from `entry_function`, traces all reachable functions and closures
|
|
2901
|
+
* within this program (via local calls) and collects external calls
|
|
2902
|
+
* (`call program.aleo/function`). Returns a JS object mapping program names
|
|
2903
|
+
* to arrays of called function names.
|
|
2904
|
+
*
|
|
2905
|
+
* @param {string} entry_function The name of the entry function to trace from
|
|
2906
|
+
* @returns {object} An object like `{ "program.aleo": ["fn1", "fn2"] }`
|
|
2907
|
+
*/
|
|
2908
|
+
getCallGraph(entry_function: string): any;
|
|
2890
2909
|
/**
|
|
2891
2910
|
* Get a javascript object representation of a program record and its types
|
|
2892
2911
|
*
|
|
@@ -3037,6 +3056,198 @@ export class Program {
|
|
|
3037
3056
|
*/
|
|
3038
3057
|
toString(): string;
|
|
3039
3058
|
}
|
|
3059
|
+
/**
|
|
3060
|
+
* Backed by `Rc<RefCell<>>` for interior mutability — cloning produces a cheap
|
|
3061
|
+
* reference-counted copy that shares the same underlying data. This allows
|
|
3062
|
+
* execution functions to clone the builder internally while the caller's
|
|
3063
|
+
* original reference automatically sees any mutations (e.g. synthesized keys).
|
|
3064
|
+
*/
|
|
3065
|
+
export class ProgramImports {
|
|
3066
|
+
free(): void;
|
|
3067
|
+
[Symbol.dispose](): void;
|
|
3068
|
+
/**
|
|
3069
|
+
* Add a program's source code to the imports.
|
|
3070
|
+
*
|
|
3071
|
+
* The source is parsed, validated, and added to the internal Process.
|
|
3072
|
+
* Static imports of the program are resolved depth-first from programs
|
|
3073
|
+
* already present in this builder.
|
|
3074
|
+
*
|
|
3075
|
+
* @param {string} name The program name (e.g., "my_program.aleo").
|
|
3076
|
+
* @param {string} source The program source code.
|
|
3077
|
+
* @param {number | undefined} edition The program edition (defaults to 1).
|
|
3078
|
+
*/
|
|
3079
|
+
addProgram(name: string, source: string, edition?: number | null): void;
|
|
3080
|
+
/**
|
|
3081
|
+
* Create a ProgramImports from a plain JavaScript object.
|
|
3082
|
+
*
|
|
3083
|
+
* Accepts three formats:
|
|
3084
|
+
* ```js
|
|
3085
|
+
* // 1. Plain string — source code only.
|
|
3086
|
+
* { "my_program.aleo": "program source..." }
|
|
3087
|
+
*
|
|
3088
|
+
* // 2. Structured — program source with optional edition.
|
|
3089
|
+
* { "my_program.aleo": { program: "program source..." } }
|
|
3090
|
+
*
|
|
3091
|
+
* // 3. Structured with keys — program source plus proving/verifying keys per function.
|
|
3092
|
+
* {
|
|
3093
|
+
* "my_program.aleo": {
|
|
3094
|
+
* program: "program source...",
|
|
3095
|
+
* keys: {
|
|
3096
|
+
* "my_function": {
|
|
3097
|
+
* provingKey: Uint8Array,
|
|
3098
|
+
* verifyingKey: Uint8Array
|
|
3099
|
+
* }
|
|
3100
|
+
* }
|
|
3101
|
+
* }
|
|
3102
|
+
* }
|
|
3103
|
+
* ```
|
|
3104
|
+
*
|
|
3105
|
+
* Programs created via this method default to edition 1.
|
|
3106
|
+
*
|
|
3107
|
+
* @param {Object} object A plain JavaScript object mapping program names to source code
|
|
3108
|
+
* and optional keys.
|
|
3109
|
+
* @returns {ProgramImports}
|
|
3110
|
+
*/
|
|
3111
|
+
static fromObject(object: object): ProgramImports;
|
|
3112
|
+
/**
|
|
3113
|
+
* Return the source code of a program by name, without serializing keys.
|
|
3114
|
+
*
|
|
3115
|
+
* @param {string} name The program name (e.g., "my_program.aleo").
|
|
3116
|
+
* @returns {string | undefined}
|
|
3117
|
+
*/
|
|
3118
|
+
getProgram(name: string): string | undefined;
|
|
3119
|
+
/**
|
|
3120
|
+
* Return the names of all programs in this builder as a JS `Array<string>`.
|
|
3121
|
+
*
|
|
3122
|
+
* This is a lightweight alternative to `toObject()` when you only need to
|
|
3123
|
+
* enumerate program names without serializing keys.
|
|
3124
|
+
*
|
|
3125
|
+
* @returns {Array<string>}
|
|
3126
|
+
*/
|
|
3127
|
+
programNames(): Array<any>;
|
|
3128
|
+
/**
|
|
3129
|
+
* Add a proving key for a function or record within an imported program.
|
|
3130
|
+
*
|
|
3131
|
+
* The key is transferred directly from the WASM `ProvingKey` type with no
|
|
3132
|
+
* serialization overhead.
|
|
3133
|
+
*
|
|
3134
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3135
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3136
|
+
* @param {ProvingKey} key The proving key.
|
|
3137
|
+
*/
|
|
3138
|
+
addProvingKey(program_name: string, identifier: string, key: ProvingKey): void;
|
|
3139
|
+
/**
|
|
3140
|
+
* Get a proving key for a specific program and identifier (function or record name).
|
|
3141
|
+
* Returns a clone of the key from the internal Process. Non-destructive — the key
|
|
3142
|
+
* remains available for future calls.
|
|
3143
|
+
*
|
|
3144
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3145
|
+
* @param {string} identifier The function or record name.
|
|
3146
|
+
* @returns {ProvingKey | undefined}
|
|
3147
|
+
*/
|
|
3148
|
+
getProvingKey(program_name: string, identifier: string): ProvingKey | undefined;
|
|
3149
|
+
/**
|
|
3150
|
+
* Add a verifying key for a function or record within an imported program.
|
|
3151
|
+
*
|
|
3152
|
+
* The key is transferred directly from the WASM `VerifyingKey` type with no
|
|
3153
|
+
* serialization overhead.
|
|
3154
|
+
*
|
|
3155
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3156
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3157
|
+
* @param {VerifyingKey} key The verifying key.
|
|
3158
|
+
*/
|
|
3159
|
+
addVerifyingKey(program_name: string, identifier: string, key: VerifyingKey): void;
|
|
3160
|
+
/**
|
|
3161
|
+
* Get a verifying key for a specific program and identifier (function or record name).
|
|
3162
|
+
* Returns a clone of the key from the internal Process. Non-destructive — the key
|
|
3163
|
+
* remains available for future calls.
|
|
3164
|
+
*
|
|
3165
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3166
|
+
* @param {string} identifier The function or record name.
|
|
3167
|
+
* @returns {VerifyingKey | undefined}
|
|
3168
|
+
*/
|
|
3169
|
+
getVerifyingKey(program_name: string, identifier: string): VerifyingKey | undefined;
|
|
3170
|
+
/**
|
|
3171
|
+
* Add a proving key from its byte representation.
|
|
3172
|
+
*
|
|
3173
|
+
* Deserializes the bytes into a native proving key and stores it. The program
|
|
3174
|
+
* must already have been added via `addProgram`.
|
|
3175
|
+
*
|
|
3176
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3177
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3178
|
+
* @param {Uint8Array} bytes The proving key bytes.
|
|
3179
|
+
*/
|
|
3180
|
+
addProvingKeyBytes(program_name: string, identifier: string, bytes: Uint8Array): void;
|
|
3181
|
+
/**
|
|
3182
|
+
* Add a verifying key from its byte representation.
|
|
3183
|
+
*
|
|
3184
|
+
* Deserializes the bytes into a native verifying key and stores it. The program
|
|
3185
|
+
* must already have been added via `addProgram`.
|
|
3186
|
+
*
|
|
3187
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3188
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
3189
|
+
* @param {Uint8Array} bytes The verifying key bytes.
|
|
3190
|
+
*/
|
|
3191
|
+
addVerifyingKeyBytes(program_name: string, identifier: string, bytes: Uint8Array): void;
|
|
3192
|
+
/**
|
|
3193
|
+
* Return the names of functions that have both a proving key and a verifying key
|
|
3194
|
+
* stored for the given program.
|
|
3195
|
+
*
|
|
3196
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
3197
|
+
* @returns {Array<string>}
|
|
3198
|
+
*/
|
|
3199
|
+
functionKeysAvailable(program_name: string): Array<any>;
|
|
3200
|
+
/**
|
|
3201
|
+
* Create a new empty ProgramImports builder.
|
|
3202
|
+
*
|
|
3203
|
+
* Initializes an internal snarkVM Process. This is the same cost as a
|
|
3204
|
+
* single execution call, but is paid once and reused across all operations.
|
|
3205
|
+
*/
|
|
3206
|
+
constructor();
|
|
3207
|
+
/**
|
|
3208
|
+
* Create a cheap clone that shares the same underlying data.
|
|
3209
|
+
*
|
|
3210
|
+
* Useful for passing to WASM execution functions which consume ownership:
|
|
3211
|
+
* the caller keeps the original, and both copies see any mutations
|
|
3212
|
+
* (e.g. synthesized keys) through the shared interior state.
|
|
3213
|
+
*/
|
|
3214
|
+
clone(): ProgramImports;
|
|
3215
|
+
/**
|
|
3216
|
+
* Check whether a specific program has been added.
|
|
3217
|
+
*
|
|
3218
|
+
* @param {string} name The program name.
|
|
3219
|
+
* @returns {boolean}
|
|
3220
|
+
*/
|
|
3221
|
+
contains(name: string): boolean;
|
|
3222
|
+
/**
|
|
3223
|
+
* Check whether any programs have been added to this builder.
|
|
3224
|
+
*
|
|
3225
|
+
* @returns {boolean}
|
|
3226
|
+
*/
|
|
3227
|
+
isEmpty(): boolean;
|
|
3228
|
+
/**
|
|
3229
|
+
* Convert this ProgramImports to a plain JavaScript object.
|
|
3230
|
+
*
|
|
3231
|
+
* Entries without keys use the simple `{ "name.aleo": "source" }` format.
|
|
3232
|
+
* Entries with keys use the structured format:
|
|
3233
|
+
* ```js
|
|
3234
|
+
* {
|
|
3235
|
+
* "name.aleo": {
|
|
3236
|
+
* program: "program source...",
|
|
3237
|
+
* keys: {
|
|
3238
|
+
* "function_name": {
|
|
3239
|
+
* provingKey: Uint8Array,
|
|
3240
|
+
* verifyingKey: Uint8Array
|
|
3241
|
+
* }
|
|
3242
|
+
* }
|
|
3243
|
+
* }
|
|
3244
|
+
* }
|
|
3245
|
+
* ```
|
|
3246
|
+
*
|
|
3247
|
+
* @returns {Object}
|
|
3248
|
+
*/
|
|
3249
|
+
toObject(): object;
|
|
3250
|
+
}
|
|
3040
3251
|
export class ProgramManager {
|
|
3041
3252
|
private constructor();
|
|
3042
3253
|
free(): void;
|
|
@@ -3049,7 +3260,7 @@ export class ProgramManager {
|
|
|
3049
3260
|
* @param {Array} inputs The inputs to the function
|
|
3050
3261
|
* @param {Object | undefined} imports The imports for the program
|
|
3051
3262
|
*/
|
|
3052
|
-
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<KeyPair>;
|
|
3263
|
+
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<KeyPair>;
|
|
3053
3264
|
static loadInclusionProver(proving_key: ProvingKey): void;
|
|
3054
3265
|
/**
|
|
3055
3266
|
* Create a `ProvingRequest` object. This object creates authorizations for the top level
|
|
@@ -3068,7 +3279,7 @@ export class ProgramManager {
|
|
|
3068
3279
|
* @param broadcast (optional) Flag to indicate if the transaction should be broadcast
|
|
3069
3280
|
* @returns {Authorization}
|
|
3070
3281
|
*/
|
|
3071
|
-
static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean, edition: number | null | undefined, use_fee_master: boolean): Promise<ProvingRequest>;
|
|
3282
|
+
static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean, edition: number | null | undefined, use_fee_master: boolean, program_imports?: ProgramImports | null): Promise<ProvingRequest>;
|
|
3072
3283
|
/**
|
|
3073
3284
|
* Build a proving request from a `Request` object. By default this method currently uses the feemaster.
|
|
3074
3285
|
*
|
|
@@ -3080,7 +3291,7 @@ export class ProgramManager {
|
|
|
3080
3291
|
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
3081
3292
|
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
3082
3293
|
*/
|
|
3083
|
-
static buildProvingRequestFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, broadcast: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null): Promise<ProvingRequest>;
|
|
3294
|
+
static buildProvingRequestFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, broadcast: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null, program_imports?: ProgramImports | null): Promise<ProvingRequest>;
|
|
3084
3295
|
/**
|
|
3085
3296
|
* Join two records together to create a new record with an amount of credits equal to the sum
|
|
3086
3297
|
* of the credits of the two original records
|
|
@@ -3131,7 +3342,7 @@ export class ProgramManager {
|
|
|
3131
3342
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3132
3343
|
* @returns {Transaction}
|
|
3133
3344
|
*/
|
|
3134
|
-
static buildDevnodeDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null): Promise<Transaction>;
|
|
3345
|
+
static buildDevnodeDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
3135
3346
|
/**
|
|
3136
3347
|
* Upgrade a deployed Aleo program without synthesizing keys and generating certificates.
|
|
3137
3348
|
* Intended for use with Leo Devnode.
|
|
@@ -3152,7 +3363,7 @@ export class ProgramManager {
|
|
|
3152
3363
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3153
3364
|
* @returns {Transaction}
|
|
3154
3365
|
*/
|
|
3155
|
-
static buildDevnodeUpgradeTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null): Promise<Transaction>;
|
|
3366
|
+
static buildDevnodeUpgradeTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
3156
3367
|
/**
|
|
3157
3368
|
* Estimate the component of the deployment cost which comes from the fee for the program name.
|
|
3158
3369
|
* Note that this cost does not represent the entire cost of deployment. It is additional to
|
|
@@ -3175,7 +3386,7 @@ export class ProgramManager {
|
|
|
3175
3386
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
3176
3387
|
* @returns {u64}
|
|
3177
3388
|
*/
|
|
3178
|
-
static estimateDeploymentFee(program: string, imports?: object | null): Promise<bigint>;
|
|
3389
|
+
static estimateDeploymentFee(program: string, imports?: object | null, program_imports?: ProgramImports | null): Promise<bigint>;
|
|
3179
3390
|
/**
|
|
3180
3391
|
* Deploy an Aleo program
|
|
3181
3392
|
*
|
|
@@ -3195,7 +3406,7 @@ export class ProgramManager {
|
|
|
3195
3406
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3196
3407
|
* @returns {Transaction}
|
|
3197
3408
|
*/
|
|
3198
|
-
static buildDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
3409
|
+
static buildDeploymentTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
3199
3410
|
/**
|
|
3200
3411
|
* Upgrade an Aleo program
|
|
3201
3412
|
*
|
|
@@ -3213,7 +3424,7 @@ export class ProgramManager {
|
|
|
3213
3424
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3214
3425
|
* @returns {Transaction}
|
|
3215
3426
|
*/
|
|
3216
|
-
static buildUpgradeTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
3427
|
+
static buildUpgradeTransaction(private_key: PrivateKey, program: string, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, offline_query?: OfflineQuery | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
3217
3428
|
/**
|
|
3218
3429
|
* Generate an execution transaction without a proof.
|
|
3219
3430
|
* Intended for use with the Leo devnode tool.
|
|
@@ -3225,22 +3436,13 @@ export class ProgramManager {
|
|
|
3225
3436
|
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
3226
3437
|
* @param fee_record The record to spend the fee from
|
|
3227
3438
|
* @param url The url of the Aleo network node to send the transaction to
|
|
3228
|
-
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
3229
|
-
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
3230
|
-
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
3231
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
3232
3439
|
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
3233
3440
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
3234
3441
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
3235
|
-
* @param
|
|
3236
|
-
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
3237
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
3238
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3239
|
-
* @param offline_query An offline query object to use if building a transaction without an internet connection.
|
|
3240
|
-
* @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.
|
|
3442
|
+
* @param edition The edition of the program to execute. Defaults to 1.
|
|
3241
3443
|
* @returns {Transaction}
|
|
3242
3444
|
*/
|
|
3243
|
-
static buildDevnodeExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, edition?: number | null): Promise<Transaction>;
|
|
3445
|
+
static buildDevnodeExecutionTransaction(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, priority_fee_credits: number, fee_record?: RecordPlaintext | null, url?: string | null, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
3244
3446
|
/**
|
|
3245
3447
|
* Estimate the finalize fee component for executing a function. This fee is additional to the
|
|
3246
3448
|
* size of the execution of the program in bytes. If the function does not have a finalize
|
|
@@ -3262,22 +3464,21 @@ export class ProgramManager {
|
|
|
3262
3464
|
* @param imports The imports of the program being executed.
|
|
3263
3465
|
* @param url The url to get the inclusion proving information from.
|
|
3264
3466
|
* @param offline_query Optional offline query object if building a Transaction offline.
|
|
3467
|
+
* @param edition The program edition (defaults to 1).
|
|
3265
3468
|
*/
|
|
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>;
|
|
3469
|
+
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, program_imports?: ProgramImports | null, edition?: number | null): Promise<Transaction>;
|
|
3267
3470
|
/**
|
|
3268
|
-
* Estimate Fee for Aleo function execution.
|
|
3269
|
-
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
3270
|
-
* program executions.
|
|
3471
|
+
* Estimate Fee for Aleo function execution.
|
|
3271
3472
|
*
|
|
3272
3473
|
* @param program The source code of the program to estimate the execution fee for.
|
|
3273
3474
|
* @param function The name of the function to estimate the execution fee for.
|
|
3274
3475
|
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
3275
3476
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
3276
3477
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
3277
|
-
* @param edition
|
|
3478
|
+
* @param edition The edition of the program. Defaults to 1.
|
|
3278
3479
|
* @returns {u64} Fee in microcredits
|
|
3279
3480
|
*/
|
|
3280
|
-
static estimateExecutionFee(program: string, _function: string, imports?: object | null, edition?: number | null): bigint;
|
|
3481
|
+
static estimateExecutionFee(program: string, _function: string, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): bigint;
|
|
3281
3482
|
/**
|
|
3282
3483
|
* Execute an arbitrary function locally
|
|
3283
3484
|
*
|
|
@@ -3295,10 +3496,10 @@ export class ProgramManager {
|
|
|
3295
3496
|
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
3296
3497
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
3297
3498
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
3298
|
-
* @param {ProvingKey | undefined} proving_key (optional) Provide a
|
|
3499
|
+
* @param {ProvingKey | undefined} proving_key (optional) Provide a proving key to use for the function execution
|
|
3299
3500
|
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
3300
3501
|
*/
|
|
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>;
|
|
3502
|
+
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, program_imports?: ProgramImports | null): Promise<ExecutionResponse>;
|
|
3302
3503
|
/**
|
|
3303
3504
|
* Compute the query requirements for a function execution without making
|
|
3304
3505
|
* any network calls. Returns the commitments that need state paths and
|
|
@@ -3329,7 +3530,7 @@ export class ProgramManager {
|
|
|
3329
3530
|
* @param edition: Optional edition to estimate the fee for.
|
|
3330
3531
|
* @returns {u64} Fee in microcredits
|
|
3331
3532
|
*/
|
|
3332
|
-
static estimateFeeForAuthorization(authorization: Authorization, program: string, imports?: object | null, edition?: number | null): bigint;
|
|
3533
|
+
static estimateFeeForAuthorization(authorization: Authorization, program: string, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): bigint;
|
|
3333
3534
|
/**
|
|
3334
3535
|
* Execute Aleo function and create an Aleo execution transaction
|
|
3335
3536
|
*
|
|
@@ -3340,22 +3541,18 @@ export class ProgramManager {
|
|
|
3340
3541
|
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
3341
3542
|
* @param fee_record The record to spend the fee from
|
|
3342
3543
|
* @param url The url of the Aleo network node to send the transaction to
|
|
3343
|
-
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
3344
|
-
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
3345
|
-
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
3346
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
3347
3544
|
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
3348
3545
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
3349
3546
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
3350
|
-
* @param proving_key (optional) Provide a
|
|
3547
|
+
* @param proving_key (optional) Provide a proving key to use for the function execution
|
|
3351
3548
|
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
3352
3549
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
3353
3550
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
3354
3551
|
* @param offline_query An offline query object to use if building a transaction without an internet connection.
|
|
3355
|
-
* @param edition The edition of the program to execute. Defaults to
|
|
3552
|
+
* @param edition The edition of the program to execute. Defaults to 1.
|
|
3356
3553
|
* @returns {Transaction}
|
|
3357
3554
|
*/
|
|
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>;
|
|
3555
|
+
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, program_imports?: ProgramImports | null): Promise<Transaction>;
|
|
3359
3556
|
/**
|
|
3360
3557
|
* Send credits from one Aleo account to another
|
|
3361
3558
|
*
|
|
@@ -3397,7 +3594,7 @@ export class ProgramManager {
|
|
|
3397
3594
|
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
3398
3595
|
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
3399
3596
|
*/
|
|
3400
|
-
static buildAuthorizationFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null): Promise<Authorization>;
|
|
3597
|
+
static buildAuthorizationFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null, program_imports?: ProgramImports | null): Promise<Authorization>;
|
|
3401
3598
|
/**
|
|
3402
3599
|
* Create an execution `Authorization` without generating a circuit. Use this function when
|
|
3403
3600
|
* fast delegated proving is needed.
|
|
@@ -3408,7 +3605,7 @@ export class ProgramManager {
|
|
|
3408
3605
|
* @param inputs A javascript array of inputs to the function.
|
|
3409
3606
|
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
3410
3607
|
*/
|
|
3411
|
-
static buildAuthorizationUnchecked(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<Authorization>;
|
|
3608
|
+
static buildAuthorizationUnchecked(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<Authorization>;
|
|
3412
3609
|
/**
|
|
3413
3610
|
* Create an execution `Authorization` for a given program:function tuple with specified inputs.
|
|
3414
3611
|
*
|
|
@@ -3418,7 +3615,7 @@ export class ProgramManager {
|
|
|
3418
3615
|
* @param inputs A javascript array of inputs to the function.
|
|
3419
3616
|
* @param imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
3420
3617
|
*/
|
|
3421
|
-
static authorize(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<Authorization>;
|
|
3618
|
+
static authorize(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, imports?: object | null, edition?: number | null, program_imports?: ProgramImports | null): Promise<Authorization>;
|
|
3422
3619
|
}
|
|
3423
3620
|
/**
|
|
3424
3621
|
* SNARK proof for verification of program execution
|
|
@@ -3651,53 +3848,125 @@ export class ProvingKey {
|
|
|
3651
3848
|
}
|
|
3652
3849
|
/**
|
|
3653
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.
|
|
3654
3862
|
*/
|
|
3655
3863
|
export class ProvingRequest {
|
|
3656
3864
|
private constructor();
|
|
3657
3865
|
free(): void;
|
|
3658
3866
|
[Symbol.dispose](): void;
|
|
3659
3867
|
/**
|
|
3660
|
-
*
|
|
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.
|
|
3661
3879
|
*
|
|
3662
|
-
* @param {
|
|
3880
|
+
* @param {string} request JSON string representation of the ProvingRequest.
|
|
3663
3881
|
*/
|
|
3664
3882
|
static fromString(request: string): ProvingRequest;
|
|
3665
3883
|
/**
|
|
3666
|
-
* 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).
|
|
3667
3888
|
*/
|
|
3668
3889
|
toBytesLe(): Uint8Array;
|
|
3669
3890
|
/**
|
|
3670
|
-
*
|
|
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.
|
|
3671
3912
|
*/
|
|
3672
3913
|
authorization(): Authorization;
|
|
3673
3914
|
/**
|
|
3674
|
-
*
|
|
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.
|
|
3675
3918
|
*
|
|
3676
|
-
* @param {Uint8Array} bytes Left-endian bytes representing
|
|
3919
|
+
* @param {Uint8Array} bytes Left-endian bytes representing an Authorization-variant proving request.
|
|
3677
3920
|
*/
|
|
3678
3921
|
static fromBytesLe(bytes: Uint8Array): ProvingRequest;
|
|
3679
3922
|
/**
|
|
3680
|
-
*
|
|
3923
|
+
* Returns the fee Authorization in the ProvingRequest, or `undefined`
|
|
3924
|
+
* when no fee is set or this is a Request variant.
|
|
3681
3925
|
*/
|
|
3682
3926
|
feeAuthorization(): Authorization | undefined;
|
|
3683
3927
|
/**
|
|
3684
|
-
*
|
|
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`.
|
|
3685
3938
|
*
|
|
3686
3939
|
* @param {Authorization} authorization An Authorization for a function.
|
|
3687
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.
|
|
3688
3941
|
* @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
|
|
3689
3942
|
*/
|
|
3690
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;
|
|
3691
3950
|
/**
|
|
3692
3951
|
* Check if a ProvingRequest is the same as another ProvingRequest.
|
|
3693
3952
|
*/
|
|
3694
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;
|
|
3695
3962
|
/**
|
|
3696
3963
|
* Get the broadcast flag set in the ProvingRequest.
|
|
3697
3964
|
*/
|
|
3698
3965
|
broadcast(): boolean;
|
|
3699
3966
|
/**
|
|
3700
|
-
* 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}.
|
|
3701
3970
|
*/
|
|
3702
3971
|
toString(): string;
|
|
3703
3972
|
}
|
|
Binary file
|