@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.
@@ -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, offline_query?: OfflineQuery | null): Promise<Transaction>;
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, offline_query?: OfflineQuery | null): Promise<Transaction>;
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, offline_query?: OfflineQuery | null): Promise<Transaction>;
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, offline_query?: OfflineQuery | null, edition?: number | null): Promise<ExecutionResponse>;
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, offline_query?: OfflineQuery | null, edition?: number | null): Promise<Transaction>;
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, offline_query?: OfflineQuery | null): Promise<Transaction>;
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
@@ -477,16 +477,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
477
477
  }
478
478
  return result;
479
479
  }
480
- function __wasm_bindgen_func_elem_8534(arg0, arg1, arg2) {
481
- wasm$1.__wasm_bindgen_func_elem_8534(arg0, arg1, addHeapObject(arg2));
480
+ function __wasm_bindgen_func_elem_8577(arg0, arg1, arg2) {
481
+ wasm$1.__wasm_bindgen_func_elem_8577(arg0, arg1, addHeapObject(arg2));
482
482
  }
483
483
 
484
- function __wasm_bindgen_func_elem_7173(arg0, arg1) {
485
- wasm$1.__wasm_bindgen_func_elem_7173(arg0, arg1);
484
+ function __wasm_bindgen_func_elem_7220(arg0, arg1) {
485
+ wasm$1.__wasm_bindgen_func_elem_7220(arg0, arg1);
486
486
  }
487
487
 
488
- function __wasm_bindgen_func_elem_7446(arg0, arg1, arg2, arg3) {
489
- wasm$1.__wasm_bindgen_func_elem_7446(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
488
+ function __wasm_bindgen_func_elem_7492(arg0, arg1, arg2, arg3) {
489
+ wasm$1.__wasm_bindgen_func_elem_7492(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
490
490
  }
491
491
 
492
492
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -2229,6 +2229,48 @@ class Boolean {
2229
2229
  }
2230
2230
  if (Symbol.dispose) Boolean.prototype[Symbol.dispose] = Boolean.prototype.free;
2231
2231
 
2232
+ const CallbackQueryFinalization = (typeof FinalizationRegistry === 'undefined')
2233
+ ? { register: () => {}, unregister: () => {} }
2234
+ : new FinalizationRegistry(ptr => wasm$1.__wbg_callbackquery_free(ptr >>> 0, 1));
2235
+ /**
2236
+ * A query implementation that delegates state fetching to JS callback functions.
2237
+ *
2238
+ * Instead of making direct HTTP calls via reqwest, each QueryTrait method
2239
+ * calls a JS function that returns a Promise. The JS side handles the actual
2240
+ * network request through the configured transport.
2241
+ */
2242
+ class CallbackQuery {
2243
+
2244
+ __destroy_into_raw() {
2245
+ const ptr = this.__wbg_ptr;
2246
+ this.__wbg_ptr = 0;
2247
+ CallbackQueryFinalization.unregister(this);
2248
+ return ptr;
2249
+ }
2250
+
2251
+ free() {
2252
+ const ptr = this.__destroy_into_raw();
2253
+ wasm$1.__wbg_callbackquery_free(ptr, 0);
2254
+ }
2255
+ /**
2256
+ * Create a new CallbackQuery with JS callback functions.
2257
+ *
2258
+ * @param {Function} get_state_root A function that returns Promise<string> (the state root)
2259
+ * @param {Function} get_state_paths A function that takes string[] (commitments) and returns Promise<string[]> (state paths)
2260
+ * @param {Function} get_block_height A function that returns Promise<number> (the block height)
2261
+ * @param {Function} get_state_root
2262
+ * @param {Function} get_state_paths
2263
+ * @param {Function} get_block_height
2264
+ */
2265
+ constructor(get_state_root, get_state_paths, get_block_height) {
2266
+ const ret = wasm$1.callbackquery_new(addHeapObject(get_state_root), addHeapObject(get_state_paths), addHeapObject(get_block_height));
2267
+ this.__wbg_ptr = ret >>> 0;
2268
+ CallbackQueryFinalization.register(this, this.__wbg_ptr, this);
2269
+ return this;
2270
+ }
2271
+ }
2272
+ if (Symbol.dispose) CallbackQuery.prototype[Symbol.dispose] = CallbackQuery.prototype.free;
2273
+
2232
2274
  const CiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
2233
2275
  ? { register: () => {}, unregister: () => {} }
2234
2276
  : new FinalizationRegistry(ptr => wasm$1.__wbg_ciphertext_free(ptr >>> 0, 1));
@@ -9876,6 +9918,16 @@ class Program {
9876
9918
  const ret = wasm$1.program_getImports(this.__wbg_ptr);
9877
9919
  return takeObject(ret);
9878
9920
  }
9921
+ /**
9922
+ * Get the checksum of the program.
9923
+ *
9924
+ * @returns {Uint8Array} The checksum of the program as a 32-byte Uint8Array
9925
+ * @returns {Uint8Array}
9926
+ */
9927
+ toChecksum() {
9928
+ const ret = wasm$1.program_toChecksum(this.__wbg_ptr);
9929
+ return takeObject(ret);
9930
+ }
9879
9931
  /**
9880
9932
  * Get a the list of a program's mappings and the names/types of their keys and values.
9881
9933
  *
@@ -10363,10 +10415,10 @@ class ProgramManager {
10363
10415
  * @param {VerifyingKey | null} [join_verifying_key]
10364
10416
  * @param {ProvingKey | null} [fee_proving_key]
10365
10417
  * @param {VerifyingKey | null} [fee_verifying_key]
10366
- * @param {OfflineQuery | null} [offline_query]
10418
+ * @param {QueryOption | null} [query]
10367
10419
  * @returns {Promise<Transaction>}
10368
10420
  */
10369
- static buildJoinTransaction(private_key, record_1, record_2, priority_fee_credits, fee_record, url, join_proving_key, join_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
10421
+ static buildJoinTransaction(private_key, record_1, record_2, priority_fee_credits, fee_record, url, join_proving_key, join_verifying_key, fee_proving_key, fee_verifying_key, query) {
10370
10422
  _assertClass(private_key, PrivateKey);
10371
10423
  _assertClass(record_1, RecordPlaintext);
10372
10424
  var ptr0 = record_1.__destroy_into_raw();
@@ -10400,9 +10452,9 @@ class ProgramManager {
10400
10452
  ptr7 = fee_verifying_key.__destroy_into_raw();
10401
10453
  }
10402
10454
  let ptr8 = 0;
10403
- if (!isLikeNone(offline_query)) {
10404
- _assertClass(offline_query, OfflineQuery);
10405
- ptr8 = offline_query.__destroy_into_raw();
10455
+ if (!isLikeNone(query)) {
10456
+ _assertClass(query, QueryOption);
10457
+ ptr8 = query.__destroy_into_raw();
10406
10458
  }
10407
10459
  const ret = wasm$1.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, priority_fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
10408
10460
  return takeObject(ret);
@@ -10424,10 +10476,10 @@ class ProgramManager {
10424
10476
  * @param {string | null} [url]
10425
10477
  * @param {ProvingKey | null} [split_proving_key]
10426
10478
  * @param {VerifyingKey | null} [split_verifying_key]
10427
- * @param {OfflineQuery | null} [offline_query]
10479
+ * @param {QueryOption | null} [query]
10428
10480
  * @returns {Promise<Transaction>}
10429
10481
  */
10430
- static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key, offline_query) {
10482
+ static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key, query) {
10431
10483
  _assertClass(private_key, PrivateKey);
10432
10484
  _assertClass(amount_record, RecordPlaintext);
10433
10485
  var ptr0 = amount_record.__destroy_into_raw();
@@ -10444,9 +10496,9 @@ class ProgramManager {
10444
10496
  ptr3 = split_verifying_key.__destroy_into_raw();
10445
10497
  }
10446
10498
  let ptr4 = 0;
10447
- if (!isLikeNone(offline_query)) {
10448
- _assertClass(offline_query, OfflineQuery);
10449
- ptr4 = offline_query.__destroy_into_raw();
10499
+ if (!isLikeNone(query)) {
10500
+ _assertClass(query, QueryOption);
10501
+ ptr4 = query.__destroy_into_raw();
10450
10502
  }
10451
10503
  const ret = wasm$1.programmanager_buildSplitTransaction(private_key.__wbg_ptr, split_amount, ptr0, ptr1, len1, ptr2, ptr3, ptr4);
10452
10504
  return takeObject(ret);
@@ -10799,10 +10851,10 @@ class ProgramManager {
10799
10851
  * @param {VerifyingKey | null} [fee_verifying_key]
10800
10852
  * @param {object | null} [imports]
10801
10853
  * @param {string | null} [url]
10802
- * @param {OfflineQuery | null} [offline_query]
10854
+ * @param {QueryOption | null} [query]
10803
10855
  * @returns {Promise<Transaction>}
10804
10856
  */
10805
- static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, offline_query) {
10857
+ static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, query) {
10806
10858
  _assertClass(authorization, Authorization);
10807
10859
  var ptr0 = authorization.__destroy_into_raw();
10808
10860
  let ptr1 = 0;
@@ -10835,9 +10887,9 @@ class ProgramManager {
10835
10887
  var ptr7 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
10836
10888
  var len7 = WASM_VECTOR_LEN;
10837
10889
  let ptr8 = 0;
10838
- if (!isLikeNone(offline_query)) {
10839
- _assertClass(offline_query, OfflineQuery);
10840
- ptr8 = offline_query.__destroy_into_raw();
10890
+ if (!isLikeNone(query)) {
10891
+ _assertClass(query, QueryOption);
10892
+ ptr8 = query.__destroy_into_raw();
10841
10893
  }
10842
10894
  const ret = wasm$1.programmanager_executeAuthorization(ptr0, ptr1, ptr2, len2, ptr3, ptr4, ptr5, ptr6, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr7, len7, ptr8);
10843
10895
  return takeObject(ret);
@@ -10908,11 +10960,11 @@ class ProgramManager {
10908
10960
  * @param {ProvingKey | null} [proving_key]
10909
10961
  * @param {VerifyingKey | null} [verifying_key]
10910
10962
  * @param {string | null} [url]
10911
- * @param {OfflineQuery | null} [offline_query]
10963
+ * @param {QueryOption | null} [query]
10912
10964
  * @param {number | null} [edition]
10913
10965
  * @returns {Promise<ExecutionResponse>}
10914
10966
  */
10915
- static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, offline_query, edition) {
10967
+ static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, query, edition) {
10916
10968
  _assertClass(private_key, PrivateKey);
10917
10969
  const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
10918
10970
  const len0 = WASM_VECTOR_LEN;
@@ -10931,13 +10983,60 @@ class ProgramManager {
10931
10983
  var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
10932
10984
  var len4 = WASM_VECTOR_LEN;
10933
10985
  let ptr5 = 0;
10934
- if (!isLikeNone(offline_query)) {
10935
- _assertClass(offline_query, OfflineQuery);
10936
- ptr5 = offline_query.__destroy_into_raw();
10986
+ if (!isLikeNone(query)) {
10987
+ _assertClass(query, QueryOption);
10988
+ ptr5 = query.__destroy_into_raw();
10937
10989
  }
10938
10990
  const ret = wasm$1.programmanager_executeFunctionOffline(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), prove_execution, cache, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr2, ptr3, ptr4, len4, ptr5, isLikeNone(edition) ? 0xFFFFFF : edition);
10939
10991
  return takeObject(ret);
10940
10992
  }
10993
+ /**
10994
+ * Compute the query requirements for a function execution without making
10995
+ * any network calls. Returns the commitments that need state paths and
10996
+ * whether the function has dynamic record inputs.
10997
+ *
10998
+ * This enables the JS layer to pre-fetch state data via its configured
10999
+ * transport and construct an OfflineQuery, so that the subsequent WASM
11000
+ * execution call never makes its own network requests.
11001
+ *
11002
+ * @param {string} program The source code of the program
11003
+ * @param {string} function_name The name of the function to execute
11004
+ * @param {Array} inputs The inputs to the function
11005
+ * @param {PrivateKey} private_key The private key (used to derive the view key for commitment computation)
11006
+ * @param {RecordPlaintext | undefined} fee_record Optional fee record to include in commitment computation
11007
+ * @returns {Object} An object with { commitments: string[], hasDynamicInputs: boolean }
11008
+ * @param {string} program
11009
+ * @param {string} function_name
11010
+ * @param {Array<any>} inputs
11011
+ * @param {PrivateKey} private_key
11012
+ * @param {RecordPlaintext | null} [fee_record]
11013
+ * @returns {any}
11014
+ */
11015
+ static computeQueryRequirements(program, function_name, inputs, private_key, fee_record) {
11016
+ try {
11017
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
11018
+ const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
11019
+ const len0 = WASM_VECTOR_LEN;
11020
+ const ptr1 = passStringToWasm0(function_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
11021
+ const len1 = WASM_VECTOR_LEN;
11022
+ _assertClass(private_key, PrivateKey);
11023
+ let ptr2 = 0;
11024
+ if (!isLikeNone(fee_record)) {
11025
+ _assertClass(fee_record, RecordPlaintext);
11026
+ ptr2 = fee_record.__destroy_into_raw();
11027
+ }
11028
+ wasm$1.programmanager_computeQueryRequirements(retptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), private_key.__wbg_ptr, ptr2);
11029
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
11030
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
11031
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
11032
+ if (r2) {
11033
+ throw takeObject(r1);
11034
+ }
11035
+ return takeObject(r0);
11036
+ } finally {
11037
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
11038
+ }
11039
+ }
10941
11040
  /**
10942
11041
  * Estimate Fee for an Authorization.
10943
11042
  *
@@ -11010,11 +11109,11 @@ class ProgramManager {
11010
11109
  * @param {VerifyingKey | null} [verifying_key]
11011
11110
  * @param {ProvingKey | null} [fee_proving_key]
11012
11111
  * @param {VerifyingKey | null} [fee_verifying_key]
11013
- * @param {OfflineQuery | null} [offline_query]
11112
+ * @param {QueryOption | null} [query]
11014
11113
  * @param {number | null} [edition]
11015
11114
  * @returns {Promise<Transaction>}
11016
11115
  */
11017
- static buildExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key, offline_query, edition) {
11116
+ static buildExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key, query, edition) {
11018
11117
  _assertClass(private_key, PrivateKey);
11019
11118
  const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
11020
11119
  const len0 = WASM_VECTOR_LEN;
@@ -11048,9 +11147,9 @@ class ProgramManager {
11048
11147
  ptr7 = fee_verifying_key.__destroy_into_raw();
11049
11148
  }
11050
11149
  let ptr8 = 0;
11051
- if (!isLikeNone(offline_query)) {
11052
- _assertClass(offline_query, OfflineQuery);
11053
- ptr8 = offline_query.__destroy_into_raw();
11150
+ if (!isLikeNone(query)) {
11151
+ _assertClass(query, QueryOption);
11152
+ ptr8 = query.__destroy_into_raw();
11054
11153
  }
11055
11154
  const ret = wasm$1.programmanager_buildExecutionTransaction(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), priority_fee_credits, ptr2, ptr3, len3, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr4, ptr5, ptr6, ptr7, ptr8, isLikeNone(edition) ? 0xFFFFFF : edition);
11056
11155
  return takeObject(ret);
@@ -11083,10 +11182,10 @@ class ProgramManager {
11083
11182
  * @param {VerifyingKey | null} [transfer_verifying_key]
11084
11183
  * @param {ProvingKey | null} [fee_proving_key]
11085
11184
  * @param {VerifyingKey | null} [fee_verifying_key]
11086
- * @param {OfflineQuery | null} [offline_query]
11185
+ * @param {QueryOption | null} [query]
11087
11186
  * @returns {Promise<Transaction>}
11088
11187
  */
11089
- static buildTransferTransaction(private_key, amount_credits, recipient, transfer_type, amount_record, priority_fee_credits, fee_record, url, transfer_proving_key, transfer_verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
11188
+ static buildTransferTransaction(private_key, amount_credits, recipient, transfer_type, amount_record, priority_fee_credits, fee_record, url, transfer_proving_key, transfer_verifying_key, fee_proving_key, fee_verifying_key, query) {
11090
11189
  _assertClass(private_key, PrivateKey);
11091
11190
  const ptr0 = passStringToWasm0(recipient, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
11092
11191
  const len0 = WASM_VECTOR_LEN;
@@ -11125,9 +11224,9 @@ class ProgramManager {
11125
11224
  ptr8 = fee_verifying_key.__destroy_into_raw();
11126
11225
  }
11127
11226
  let ptr9 = 0;
11128
- if (!isLikeNone(offline_query)) {
11129
- _assertClass(offline_query, OfflineQuery);
11130
- ptr9 = offline_query.__destroy_into_raw();
11227
+ if (!isLikeNone(query)) {
11228
+ _assertClass(query, QueryOption);
11229
+ ptr9 = query.__destroy_into_raw();
11131
11230
  }
11132
11231
  const ret = wasm$1.programmanager_buildTransferTransaction(private_key.__wbg_ptr, amount_credits, ptr0, len0, ptr1, len1, ptr2, priority_fee_credits, ptr3, ptr4, len4, ptr5, ptr6, ptr7, ptr8, ptr9);
11133
11232
  return takeObject(ret);
@@ -11909,6 +12008,63 @@ class ProvingRequest {
11909
12008
  }
11910
12009
  if (Symbol.dispose) ProvingRequest.prototype[Symbol.dispose] = ProvingRequest.prototype.free;
11911
12010
 
12011
+ const QueryOptionFinalization = (typeof FinalizationRegistry === 'undefined')
12012
+ ? { register: () => {}, unregister: () => {} }
12013
+ : new FinalizationRegistry(ptr => wasm$1.__wbg_queryoption_free(ptr >>> 0, 1));
12014
+ /**
12015
+ * A unified query type that wraps either an OfflineQuery (pre-fetched state)
12016
+ * or a CallbackQuery (on-demand JS transport delegation).
12017
+ *
12018
+ * Construct from JavaScript using the static factory methods:
12019
+ * - `QueryOption.offlineQuery(offlineQuery)` for pre-fetched state
12020
+ * - `QueryOption.callbackQuery(callbackQuery)` for on-demand JS callbacks
12021
+ */
12022
+ class QueryOption {
12023
+
12024
+ static __wrap(ptr) {
12025
+ ptr = ptr >>> 0;
12026
+ const obj = Object.create(QueryOption.prototype);
12027
+ obj.__wbg_ptr = ptr;
12028
+ QueryOptionFinalization.register(obj, obj.__wbg_ptr, obj);
12029
+ return obj;
12030
+ }
12031
+
12032
+ __destroy_into_raw() {
12033
+ const ptr = this.__wbg_ptr;
12034
+ this.__wbg_ptr = 0;
12035
+ QueryOptionFinalization.unregister(this);
12036
+ return ptr;
12037
+ }
12038
+
12039
+ free() {
12040
+ const ptr = this.__destroy_into_raw();
12041
+ wasm$1.__wbg_queryoption_free(ptr, 0);
12042
+ }
12043
+ /**
12044
+ * Create a QueryOption from an OfflineQuery.
12045
+ * @param {OfflineQuery} query
12046
+ * @returns {QueryOption}
12047
+ */
12048
+ static offlineQuery(query) {
12049
+ _assertClass(query, OfflineQuery);
12050
+ var ptr0 = query.__destroy_into_raw();
12051
+ const ret = wasm$1.queryoption_offlineQuery(ptr0);
12052
+ return QueryOption.__wrap(ret);
12053
+ }
12054
+ /**
12055
+ * Create a QueryOption from a CallbackQuery.
12056
+ * @param {CallbackQuery} query
12057
+ * @returns {QueryOption}
12058
+ */
12059
+ static callbackQuery(query) {
12060
+ _assertClass(query, CallbackQuery);
12061
+ var ptr0 = query.__destroy_into_raw();
12062
+ const ret = wasm$1.queryoption_callbackQuery(ptr0);
12063
+ return QueryOption.__wrap(ret);
12064
+ }
12065
+ }
12066
+ if (Symbol.dispose) QueryOption.prototype[Symbol.dispose] = QueryOption.prototype.free;
12067
+
11912
12068
  const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
11913
12069
  ? { register: () => {}, unregister: () => {} }
11914
12070
  : new FinalizationRegistry(ptr => wasm$1.__wbg_recordciphertext_free(ptr >>> 0, 1));
@@ -18165,6 +18321,12 @@ function __wbg_get_imports(memory) {
18165
18321
  const ret = __wbg_init.__wbindgen_wasm_module;
18166
18322
  return addHeapObject(ret);
18167
18323
  };
18324
+ imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
18325
+ const obj = getObject(arg1);
18326
+ const ret = typeof(obj) === 'number' ? obj : undefined;
18327
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
18328
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
18329
+ };
18168
18330
  imports.wbg.__wbg___wbindgen_rethrow_ea38273dafc473e6 = function(arg0) {
18169
18331
  throw takeObject(arg0);
18170
18332
  };
@@ -18192,6 +18354,10 @@ function __wbg_get_imports(memory) {
18192
18354
  imports.wbg.__wbg_append_b577eb3a177bc0fa = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
18193
18355
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
18194
18356
  }, arguments) };
18357
+ imports.wbg.__wbg_apply_04097a755e1e4a1e = function() { return handleError(function (arg0, arg1, arg2) {
18358
+ const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
18359
+ return addHeapObject(ret);
18360
+ }, arguments) };
18195
18361
  imports.wbg.__wbg_arrayBuffer_b375eccb84b4ddf3 = function() { return handleError(function (arg0) {
18196
18362
  const ret = getObject(arg0).arrayBuffer();
18197
18363
  return addHeapObject(ret);
@@ -18298,6 +18464,16 @@ function __wbg_get_imports(memory) {
18298
18464
  const ret = getObject(arg0).headers;
18299
18465
  return addHeapObject(ret);
18300
18466
  };
18467
+ imports.wbg.__wbg_instanceof_Promise_001fdd42afa1b7ef = function(arg0) {
18468
+ let result;
18469
+ try {
18470
+ result = getObject(arg0) instanceof Promise;
18471
+ } catch (_) {
18472
+ result = false;
18473
+ }
18474
+ const ret = result;
18475
+ return ret;
18476
+ };
18301
18477
  imports.wbg.__wbg_instanceof_Response_f4f3e87e07f3135c = function(arg0) {
18302
18478
  let result;
18303
18479
  try {
@@ -18342,7 +18518,7 @@ function __wbg_get_imports(memory) {
18342
18518
  const ret = getObject(arg0).length;
18343
18519
  return ret;
18344
18520
  };
18345
- imports.wbg.__wbg_log_0b9e82a3d425c505 = function(arg0, arg1) {
18521
+ imports.wbg.__wbg_log_22dee88c33d8b7ed = function(arg0, arg1) {
18346
18522
  console.log(getStringFromWasm0(arg0, arg1));
18347
18523
  };
18348
18524
  imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
@@ -18364,7 +18540,7 @@ function __wbg_get_imports(memory) {
18364
18540
  const a = state0.a;
18365
18541
  state0.a = 0;
18366
18542
  try {
18367
- return __wasm_bindgen_func_elem_7446(a, state0.b, arg0, arg1);
18543
+ return __wasm_bindgen_func_elem_7492(a, state0.b, arg0, arg1);
18368
18544
  } finally {
18369
18545
  state0.a = a;
18370
18546
  }
@@ -18551,7 +18727,7 @@ function __wbg_get_imports(memory) {
18551
18727
  const ret = Signature.__wrap(arg0);
18552
18728
  return addHeapObject(ret);
18553
18729
  };
18554
- imports.wbg.__wbg_spawnWorker_fd8a412decad8341 = function(arg0, arg1, arg2, arg3) {
18730
+ imports.wbg.__wbg_spawnWorker_33cc8ce5f9639974 = function(arg0, arg1, arg2, arg3) {
18555
18731
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
18556
18732
  return addHeapObject(ret);
18557
18733
  };
@@ -18641,11 +18817,6 @@ function __wbg_get_imports(memory) {
18641
18817
  const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
18642
18818
  return addHeapObject(ret);
18643
18819
  };
18644
- imports.wbg.__wbindgen_cast_0eb37dec5f5def71 = function(arg0, arg1) {
18645
- // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 465, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18646
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7172, __wasm_bindgen_func_elem_7173);
18647
- return addHeapObject(ret);
18648
- };
18649
18820
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
18650
18821
  // Cast intrinsic for `Ref(String) -> Externref`.
18651
18822
  const ret = getStringFromWasm0(arg0, arg1);
@@ -18656,19 +18827,19 @@ function __wbg_get_imports(memory) {
18656
18827
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
18657
18828
  return addHeapObject(ret);
18658
18829
  };
18830
+ imports.wbg.__wbindgen_cast_32a97a33ade320ff = function(arg0, arg1) {
18831
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 359, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 360, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18832
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7219, __wasm_bindgen_func_elem_8577);
18833
+ return addHeapObject(ret);
18834
+ };
18659
18835
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
18660
18836
  // Cast intrinsic for `U64 -> Externref`.
18661
18837
  const ret = BigInt.asUintN(64, arg0);
18662
18838
  return addHeapObject(ret);
18663
18839
  };
18664
- imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
18665
- // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18666
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7172, __wasm_bindgen_func_elem_8534);
18667
- return addHeapObject(ret);
18668
- };
18669
- imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
18670
- // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18671
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7172, __wasm_bindgen_func_elem_8534);
18840
+ imports.wbg.__wbindgen_cast_54fdaf61e7a5e679 = function(arg0, arg1) {
18841
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 359, function: Function { arguments: [], shim_idx: 465, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18842
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7219, __wasm_bindgen_func_elem_7220);
18672
18843
  return addHeapObject(ret);
18673
18844
  };
18674
18845
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -18686,6 +18857,11 @@ function __wbg_get_imports(memory) {
18686
18857
  const ret = arg0;
18687
18858
  return addHeapObject(ret);
18688
18859
  };
18860
+ imports.wbg.__wbindgen_cast_e424aac48c10ba33 = function(arg0, arg1) {
18861
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 359, function: Function { arguments: [Externref], shim_idx: 360, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18862
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7219, __wasm_bindgen_func_elem_8577);
18863
+ return addHeapObject(ret);
18864
+ };
18689
18865
  imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
18690
18866
  // Cast intrinsic for `U128 -> Externref`.
18691
18867
  const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
@@ -18784,6 +18960,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
18784
18960
  BHP512: BHP512,
18785
18961
  BHP768: BHP768,
18786
18962
  Boolean: Boolean,
18963
+ CallbackQuery: CallbackQuery,
18787
18964
  Ciphertext: Ciphertext,
18788
18965
  ComputeKey: ComputeKey,
18789
18966
  DynamicRecord: DynamicRecord,
@@ -18815,6 +18992,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
18815
18992
  Proof: Proof,
18816
18993
  ProvingKey: ProvingKey,
18817
18994
  ProvingRequest: ProvingRequest,
18995
+ QueryOption: QueryOption,
18818
18996
  RecordCiphertext: RecordCiphertext,
18819
18997
  RecordPlaintext: RecordPlaintext,
18820
18998
  Scalar: Scalar,