@provablehq/wasm 0.10.4 → 0.10.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mainnet/aleo_wasm.d.ts +79 -22
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +241 -73
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +240 -74
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +241 -73
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +63 -6
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +220 -52
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +219 -53
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +220 -52
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/mainnet/index.cjs
CHANGED
|
@@ -310,26 +310,25 @@ function addBorrowedObject(obj) {
|
|
|
310
310
|
return stack_pointer;
|
|
311
311
|
}
|
|
312
312
|
/**
|
|
313
|
-
* Verify a SNARK proof against
|
|
313
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
314
314
|
*
|
|
315
|
-
* This function verifies a proof produced by
|
|
316
|
-
*
|
|
315
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
316
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
317
317
|
*
|
|
318
|
-
* @param {
|
|
319
|
-
* @param {Array<string
|
|
320
|
-
* @param {Proof} proof The proof to verify
|
|
321
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
322
|
-
* @param {
|
|
318
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
319
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
320
|
+
* @param {Proof} proof The batch proof to verify
|
|
321
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
322
|
+
* @param {Array<any>} verifying_keys
|
|
323
323
|
* @param {Array<any>} inputs
|
|
324
324
|
* @param {Proof} proof
|
|
325
325
|
* @returns {boolean}
|
|
326
326
|
*/
|
|
327
|
-
function
|
|
327
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
328
328
|
try {
|
|
329
329
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
330
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
331
330
|
_assertClass(proof, Proof);
|
|
332
|
-
wasm$1.
|
|
331
|
+
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
333
332
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
334
333
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
335
334
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -385,25 +384,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
385
384
|
}
|
|
386
385
|
|
|
387
386
|
/**
|
|
388
|
-
* Verify a
|
|
387
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
389
388
|
*
|
|
390
|
-
* This function verifies a
|
|
391
|
-
*
|
|
389
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
390
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
392
391
|
*
|
|
393
|
-
* @param {
|
|
394
|
-
* @param {Array<
|
|
395
|
-
* @param {Proof} proof The
|
|
396
|
-
* @returns {boolean} True if the
|
|
397
|
-
* @param {
|
|
392
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
393
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
394
|
+
* @param {Proof} proof The proof to verify
|
|
395
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
396
|
+
* @param {VerifyingKey} verifying_key
|
|
398
397
|
* @param {Array<any>} inputs
|
|
399
398
|
* @param {Proof} proof
|
|
400
399
|
* @returns {boolean}
|
|
401
400
|
*/
|
|
402
|
-
function
|
|
401
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
403
402
|
try {
|
|
404
403
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
404
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
405
405
|
_assertClass(proof, Proof);
|
|
406
|
-
wasm$1.
|
|
406
|
+
wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
407
407
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
408
408
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
409
409
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -477,16 +477,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
477
477
|
}
|
|
478
478
|
return result;
|
|
479
479
|
}
|
|
480
|
-
function
|
|
481
|
-
wasm$1.
|
|
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
|
|
485
|
-
wasm$1.
|
|
484
|
+
function __wasm_bindgen_func_elem_7212(arg0, arg1) {
|
|
485
|
+
wasm$1.__wasm_bindgen_func_elem_7212(arg0, arg1);
|
|
486
486
|
}
|
|
487
487
|
|
|
488
|
-
function
|
|
489
|
-
wasm$1.
|
|
488
|
+
function __wasm_bindgen_func_elem_7484(arg0, arg1, arg2, arg3) {
|
|
489
|
+
wasm$1.__wasm_bindgen_func_elem_7484(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));
|
|
@@ -10373,10 +10415,10 @@ class ProgramManager {
|
|
|
10373
10415
|
* @param {VerifyingKey | null} [join_verifying_key]
|
|
10374
10416
|
* @param {ProvingKey | null} [fee_proving_key]
|
|
10375
10417
|
* @param {VerifyingKey | null} [fee_verifying_key]
|
|
10376
|
-
* @param {
|
|
10418
|
+
* @param {QueryOption | null} [query]
|
|
10377
10419
|
* @returns {Promise<Transaction>}
|
|
10378
10420
|
*/
|
|
10379
|
-
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,
|
|
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) {
|
|
10380
10422
|
_assertClass(private_key, PrivateKey);
|
|
10381
10423
|
_assertClass(record_1, RecordPlaintext);
|
|
10382
10424
|
var ptr0 = record_1.__destroy_into_raw();
|
|
@@ -10410,9 +10452,9 @@ class ProgramManager {
|
|
|
10410
10452
|
ptr7 = fee_verifying_key.__destroy_into_raw();
|
|
10411
10453
|
}
|
|
10412
10454
|
let ptr8 = 0;
|
|
10413
|
-
if (!isLikeNone(
|
|
10414
|
-
_assertClass(
|
|
10415
|
-
ptr8 =
|
|
10455
|
+
if (!isLikeNone(query)) {
|
|
10456
|
+
_assertClass(query, QueryOption);
|
|
10457
|
+
ptr8 = query.__destroy_into_raw();
|
|
10416
10458
|
}
|
|
10417
10459
|
const ret = wasm$1.programmanager_buildJoinTransaction(private_key.__wbg_ptr, ptr0, ptr1, priority_fee_credits, ptr2, ptr3, len3, ptr4, ptr5, ptr6, ptr7, ptr8);
|
|
10418
10460
|
return takeObject(ret);
|
|
@@ -10434,10 +10476,10 @@ class ProgramManager {
|
|
|
10434
10476
|
* @param {string | null} [url]
|
|
10435
10477
|
* @param {ProvingKey | null} [split_proving_key]
|
|
10436
10478
|
* @param {VerifyingKey | null} [split_verifying_key]
|
|
10437
|
-
* @param {
|
|
10479
|
+
* @param {QueryOption | null} [query]
|
|
10438
10480
|
* @returns {Promise<Transaction>}
|
|
10439
10481
|
*/
|
|
10440
|
-
static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key,
|
|
10482
|
+
static buildSplitTransaction(private_key, split_amount, amount_record, url, split_proving_key, split_verifying_key, query) {
|
|
10441
10483
|
_assertClass(private_key, PrivateKey);
|
|
10442
10484
|
_assertClass(amount_record, RecordPlaintext);
|
|
10443
10485
|
var ptr0 = amount_record.__destroy_into_raw();
|
|
@@ -10454,9 +10496,9 @@ class ProgramManager {
|
|
|
10454
10496
|
ptr3 = split_verifying_key.__destroy_into_raw();
|
|
10455
10497
|
}
|
|
10456
10498
|
let ptr4 = 0;
|
|
10457
|
-
if (!isLikeNone(
|
|
10458
|
-
_assertClass(
|
|
10459
|
-
ptr4 =
|
|
10499
|
+
if (!isLikeNone(query)) {
|
|
10500
|
+
_assertClass(query, QueryOption);
|
|
10501
|
+
ptr4 = query.__destroy_into_raw();
|
|
10460
10502
|
}
|
|
10461
10503
|
const ret = wasm$1.programmanager_buildSplitTransaction(private_key.__wbg_ptr, split_amount, ptr0, ptr1, len1, ptr2, ptr3, ptr4);
|
|
10462
10504
|
return takeObject(ret);
|
|
@@ -10809,10 +10851,10 @@ class ProgramManager {
|
|
|
10809
10851
|
* @param {VerifyingKey | null} [fee_verifying_key]
|
|
10810
10852
|
* @param {object | null} [imports]
|
|
10811
10853
|
* @param {string | null} [url]
|
|
10812
|
-
* @param {
|
|
10854
|
+
* @param {QueryOption | null} [query]
|
|
10813
10855
|
* @returns {Promise<Transaction>}
|
|
10814
10856
|
*/
|
|
10815
|
-
static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url,
|
|
10857
|
+
static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, query) {
|
|
10816
10858
|
_assertClass(authorization, Authorization);
|
|
10817
10859
|
var ptr0 = authorization.__destroy_into_raw();
|
|
10818
10860
|
let ptr1 = 0;
|
|
@@ -10845,9 +10887,9 @@ class ProgramManager {
|
|
|
10845
10887
|
var ptr7 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10846
10888
|
var len7 = WASM_VECTOR_LEN;
|
|
10847
10889
|
let ptr8 = 0;
|
|
10848
|
-
if (!isLikeNone(
|
|
10849
|
-
_assertClass(
|
|
10850
|
-
ptr8 =
|
|
10890
|
+
if (!isLikeNone(query)) {
|
|
10891
|
+
_assertClass(query, QueryOption);
|
|
10892
|
+
ptr8 = query.__destroy_into_raw();
|
|
10851
10893
|
}
|
|
10852
10894
|
const ret = wasm$1.programmanager_executeAuthorization(ptr0, ptr1, ptr2, len2, ptr3, ptr4, ptr5, ptr6, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr7, len7, ptr8);
|
|
10853
10895
|
return takeObject(ret);
|
|
@@ -10918,11 +10960,11 @@ class ProgramManager {
|
|
|
10918
10960
|
* @param {ProvingKey | null} [proving_key]
|
|
10919
10961
|
* @param {VerifyingKey | null} [verifying_key]
|
|
10920
10962
|
* @param {string | null} [url]
|
|
10921
|
-
* @param {
|
|
10963
|
+
* @param {QueryOption | null} [query]
|
|
10922
10964
|
* @param {number | null} [edition]
|
|
10923
10965
|
* @returns {Promise<ExecutionResponse>}
|
|
10924
10966
|
*/
|
|
10925
|
-
static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url,
|
|
10967
|
+
static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, query, edition) {
|
|
10926
10968
|
_assertClass(private_key, PrivateKey);
|
|
10927
10969
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10928
10970
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10941,13 +10983,60 @@ class ProgramManager {
|
|
|
10941
10983
|
var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10942
10984
|
var len4 = WASM_VECTOR_LEN;
|
|
10943
10985
|
let ptr5 = 0;
|
|
10944
|
-
if (!isLikeNone(
|
|
10945
|
-
_assertClass(
|
|
10946
|
-
ptr5 =
|
|
10986
|
+
if (!isLikeNone(query)) {
|
|
10987
|
+
_assertClass(query, QueryOption);
|
|
10988
|
+
ptr5 = query.__destroy_into_raw();
|
|
10947
10989
|
}
|
|
10948
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);
|
|
10949
10991
|
return takeObject(ret);
|
|
10950
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
|
+
}
|
|
10951
11040
|
/**
|
|
10952
11041
|
* Estimate Fee for an Authorization.
|
|
10953
11042
|
*
|
|
@@ -11020,11 +11109,11 @@ class ProgramManager {
|
|
|
11020
11109
|
* @param {VerifyingKey | null} [verifying_key]
|
|
11021
11110
|
* @param {ProvingKey | null} [fee_proving_key]
|
|
11022
11111
|
* @param {VerifyingKey | null} [fee_verifying_key]
|
|
11023
|
-
* @param {
|
|
11112
|
+
* @param {QueryOption | null} [query]
|
|
11024
11113
|
* @param {number | null} [edition]
|
|
11025
11114
|
* @returns {Promise<Transaction>}
|
|
11026
11115
|
*/
|
|
11027
|
-
static buildExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key,
|
|
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) {
|
|
11028
11117
|
_assertClass(private_key, PrivateKey);
|
|
11029
11118
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11030
11119
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -11058,9 +11147,9 @@ class ProgramManager {
|
|
|
11058
11147
|
ptr7 = fee_verifying_key.__destroy_into_raw();
|
|
11059
11148
|
}
|
|
11060
11149
|
let ptr8 = 0;
|
|
11061
|
-
if (!isLikeNone(
|
|
11062
|
-
_assertClass(
|
|
11063
|
-
ptr8 =
|
|
11150
|
+
if (!isLikeNone(query)) {
|
|
11151
|
+
_assertClass(query, QueryOption);
|
|
11152
|
+
ptr8 = query.__destroy_into_raw();
|
|
11064
11153
|
}
|
|
11065
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);
|
|
11066
11155
|
return takeObject(ret);
|
|
@@ -11093,10 +11182,10 @@ class ProgramManager {
|
|
|
11093
11182
|
* @param {VerifyingKey | null} [transfer_verifying_key]
|
|
11094
11183
|
* @param {ProvingKey | null} [fee_proving_key]
|
|
11095
11184
|
* @param {VerifyingKey | null} [fee_verifying_key]
|
|
11096
|
-
* @param {
|
|
11185
|
+
* @param {QueryOption | null} [query]
|
|
11097
11186
|
* @returns {Promise<Transaction>}
|
|
11098
11187
|
*/
|
|
11099
|
-
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,
|
|
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) {
|
|
11100
11189
|
_assertClass(private_key, PrivateKey);
|
|
11101
11190
|
const ptr0 = passStringToWasm0(recipient, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11102
11191
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -11135,9 +11224,9 @@ class ProgramManager {
|
|
|
11135
11224
|
ptr8 = fee_verifying_key.__destroy_into_raw();
|
|
11136
11225
|
}
|
|
11137
11226
|
let ptr9 = 0;
|
|
11138
|
-
if (!isLikeNone(
|
|
11139
|
-
_assertClass(
|
|
11140
|
-
ptr9 =
|
|
11227
|
+
if (!isLikeNone(query)) {
|
|
11228
|
+
_assertClass(query, QueryOption);
|
|
11229
|
+
ptr9 = query.__destroy_into_raw();
|
|
11141
11230
|
}
|
|
11142
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);
|
|
11143
11232
|
return takeObject(ret);
|
|
@@ -11919,6 +12008,63 @@ class ProvingRequest {
|
|
|
11919
12008
|
}
|
|
11920
12009
|
if (Symbol.dispose) ProvingRequest.prototype[Symbol.dispose] = ProvingRequest.prototype.free;
|
|
11921
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
|
+
|
|
11922
12068
|
const RecordCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
11923
12069
|
? { register: () => {}, unregister: () => {} }
|
|
11924
12070
|
: new FinalizationRegistry(ptr => wasm$1.__wbg_recordciphertext_free(ptr >>> 0, 1));
|
|
@@ -18175,6 +18321,12 @@ function __wbg_get_imports(memory) {
|
|
|
18175
18321
|
const ret = __wbg_init.__wbindgen_wasm_module;
|
|
18176
18322
|
return addHeapObject(ret);
|
|
18177
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
|
+
};
|
|
18178
18330
|
imports.wbg.__wbg___wbindgen_rethrow_ea38273dafc473e6 = function(arg0) {
|
|
18179
18331
|
throw takeObject(arg0);
|
|
18180
18332
|
};
|
|
@@ -18202,6 +18354,10 @@ function __wbg_get_imports(memory) {
|
|
|
18202
18354
|
imports.wbg.__wbg_append_b577eb3a177bc0fa = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
18203
18355
|
getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
18204
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) };
|
|
18205
18361
|
imports.wbg.__wbg_arrayBuffer_b375eccb84b4ddf3 = function() { return handleError(function (arg0) {
|
|
18206
18362
|
const ret = getObject(arg0).arrayBuffer();
|
|
18207
18363
|
return addHeapObject(ret);
|
|
@@ -18308,6 +18464,16 @@ function __wbg_get_imports(memory) {
|
|
|
18308
18464
|
const ret = getObject(arg0).headers;
|
|
18309
18465
|
return addHeapObject(ret);
|
|
18310
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
|
+
};
|
|
18311
18477
|
imports.wbg.__wbg_instanceof_Response_f4f3e87e07f3135c = function(arg0) {
|
|
18312
18478
|
let result;
|
|
18313
18479
|
try {
|
|
@@ -18352,7 +18518,7 @@ function __wbg_get_imports(memory) {
|
|
|
18352
18518
|
const ret = getObject(arg0).length;
|
|
18353
18519
|
return ret;
|
|
18354
18520
|
};
|
|
18355
|
-
imports.wbg.
|
|
18521
|
+
imports.wbg.__wbg_log_22dee88c33d8b7ed = function(arg0, arg1) {
|
|
18356
18522
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
18357
18523
|
};
|
|
18358
18524
|
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
@@ -18374,7 +18540,7 @@ function __wbg_get_imports(memory) {
|
|
|
18374
18540
|
const a = state0.a;
|
|
18375
18541
|
state0.a = 0;
|
|
18376
18542
|
try {
|
|
18377
|
-
return
|
|
18543
|
+
return __wasm_bindgen_func_elem_7484(a, state0.b, arg0, arg1);
|
|
18378
18544
|
} finally {
|
|
18379
18545
|
state0.a = a;
|
|
18380
18546
|
}
|
|
@@ -18561,7 +18727,7 @@ function __wbg_get_imports(memory) {
|
|
|
18561
18727
|
const ret = Signature.__wrap(arg0);
|
|
18562
18728
|
return addHeapObject(ret);
|
|
18563
18729
|
};
|
|
18564
|
-
imports.wbg.
|
|
18730
|
+
imports.wbg.__wbg_spawnWorker_33cc8ce5f9639974 = function(arg0, arg1, arg2, arg3) {
|
|
18565
18731
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
18566
18732
|
return addHeapObject(ret);
|
|
18567
18733
|
};
|
|
@@ -18656,6 +18822,16 @@ function __wbg_get_imports(memory) {
|
|
|
18656
18822
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
18657
18823
|
return addHeapObject(ret);
|
|
18658
18824
|
};
|
|
18825
|
+
imports.wbg.__wbindgen_cast_28475d7a0f25a997 = function(arg0, arg1) {
|
|
18826
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 357, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 358, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18827
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7211, __wasm_bindgen_func_elem_8577);
|
|
18828
|
+
return addHeapObject(ret);
|
|
18829
|
+
};
|
|
18830
|
+
imports.wbg.__wbindgen_cast_2c5fc068add553f7 = function(arg0, arg1) {
|
|
18831
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 357, function: Function { arguments: [], shim_idx: 465, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18832
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7211, __wasm_bindgen_func_elem_7212);
|
|
18833
|
+
return addHeapObject(ret);
|
|
18834
|
+
};
|
|
18659
18835
|
imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
|
|
18660
18836
|
// Cast intrinsic for `I128 -> Externref`.
|
|
18661
18837
|
const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
|
|
@@ -18666,24 +18842,14 @@ function __wbg_get_imports(memory) {
|
|
|
18666
18842
|
const ret = BigInt.asUintN(64, arg0);
|
|
18667
18843
|
return addHeapObject(ret);
|
|
18668
18844
|
};
|
|
18669
|
-
imports.wbg.__wbindgen_cast_711d7deea8fc39ca = function(arg0, arg1) {
|
|
18670
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [Externref], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18671
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7169, __wasm_bindgen_func_elem_8536);
|
|
18672
|
-
return addHeapObject(ret);
|
|
18673
|
-
};
|
|
18674
18845
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
18675
18846
|
// Cast intrinsic for `I64 -> Externref`.
|
|
18676
18847
|
const ret = arg0;
|
|
18677
18848
|
return addHeapObject(ret);
|
|
18678
18849
|
};
|
|
18679
|
-
imports.wbg.
|
|
18680
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
18681
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
18682
|
-
return addHeapObject(ret);
|
|
18683
|
-
};
|
|
18684
|
-
imports.wbg.__wbindgen_cast_cada7727142cd213 = function(arg0, arg1) {
|
|
18685
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18686
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7169, __wasm_bindgen_func_elem_8536);
|
|
18850
|
+
imports.wbg.__wbindgen_cast_b1bcbba6fa3c236c = function(arg0, arg1) {
|
|
18851
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 357, function: Function { arguments: [Externref], shim_idx: 358, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18852
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7211, __wasm_bindgen_func_elem_8577);
|
|
18687
18853
|
return addHeapObject(ret);
|
|
18688
18854
|
};
|
|
18689
18855
|
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
@@ -18794,6 +18960,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
|
|
|
18794
18960
|
BHP512: BHP512,
|
|
18795
18961
|
BHP768: BHP768,
|
|
18796
18962
|
Boolean: Boolean,
|
|
18963
|
+
CallbackQuery: CallbackQuery,
|
|
18797
18964
|
Ciphertext: Ciphertext,
|
|
18798
18965
|
ComputeKey: ComputeKey,
|
|
18799
18966
|
DynamicRecord: DynamicRecord,
|
|
@@ -18825,6 +18992,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
|
|
|
18825
18992
|
Proof: Proof,
|
|
18826
18993
|
ProvingKey: ProvingKey,
|
|
18827
18994
|
ProvingRequest: ProvingRequest,
|
|
18995
|
+
QueryOption: QueryOption,
|
|
18828
18996
|
RecordCiphertext: RecordCiphertext,
|
|
18829
18997
|
RecordPlaintext: RecordPlaintext,
|
|
18830
18998
|
Scalar: Scalar,
|