@provablehq/wasm 0.9.18 → 0.10.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 +356 -1
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +1075 -32
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +1079 -31
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +4658 -4299
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +10664 -9284
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +10669 -9283
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/mainnet/index.js
CHANGED
|
@@ -2227,6 +2227,58 @@ class ExecutionRequest {
|
|
|
2227
2227
|
const ptr = this.__destroy_into_raw();
|
|
2228
2228
|
wasm.__wbg_executionrequest_free(ptr, 0);
|
|
2229
2229
|
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Computes the function ID and serialized input data for a program function call.
|
|
2232
|
+
* This is a helper for external signing wallets and other applications that need to compute
|
|
2233
|
+
* publicly computable inputs for the `Request::sign` function.
|
|
2234
|
+
*
|
|
2235
|
+
* @param {string} program_id The id of the program.
|
|
2236
|
+
* @param {string} function_name The function name.
|
|
2237
|
+
* @param {string[]} input_types The input types of the function as strings.
|
|
2238
|
+
* @param {string[]} inputs The inputs to the function as strings.
|
|
2239
|
+
* @param {boolean} is_root Flag to indicate if this is the top level function in the call graph.
|
|
2240
|
+
* @param {Field | undefined} program_checksum The program checksum (required if the program has a constructor).
|
|
2241
|
+
* @param {ViewKey | undefined} view_key The view key of the signer to compute a record's tag and h values.
|
|
2242
|
+
*
|
|
2243
|
+
* @returns {ExternalSigningInput}
|
|
2244
|
+
* @param {string} program_id
|
|
2245
|
+
* @param {string} function_name
|
|
2246
|
+
* @param {Array<any>} inputs
|
|
2247
|
+
* @param {Array<any>} input_types
|
|
2248
|
+
* @param {boolean} is_root
|
|
2249
|
+
* @param {Field | null} [program_checksum]
|
|
2250
|
+
* @param {ViewKey | null} [view_key]
|
|
2251
|
+
* @returns {object}
|
|
2252
|
+
*/
|
|
2253
|
+
static computeExternalSigningInputs(program_id, function_name, inputs, input_types, is_root, program_checksum, view_key) {
|
|
2254
|
+
try {
|
|
2255
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2256
|
+
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2257
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2258
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2259
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2260
|
+
let ptr2 = 0;
|
|
2261
|
+
if (!isLikeNone(program_checksum)) {
|
|
2262
|
+
_assertClass(program_checksum, Field);
|
|
2263
|
+
ptr2 = program_checksum.__destroy_into_raw();
|
|
2264
|
+
}
|
|
2265
|
+
let ptr3 = 0;
|
|
2266
|
+
if (!isLikeNone(view_key)) {
|
|
2267
|
+
_assertClass(view_key, ViewKey);
|
|
2268
|
+
ptr3 = view_key.__destroy_into_raw();
|
|
2269
|
+
}
|
|
2270
|
+
wasm.executionrequest_computeExternalSigningInputs(retptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), addHeapObject(input_types), is_root, ptr2, ptr3);
|
|
2271
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2272
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2273
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2274
|
+
if (r2) {
|
|
2275
|
+
throw takeObject(r1);
|
|
2276
|
+
}
|
|
2277
|
+
return takeObject(r0);
|
|
2278
|
+
} finally {
|
|
2279
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2230
2282
|
/**
|
|
2231
2283
|
* Creates an request object from a bytes representation of an request.
|
|
2232
2284
|
* @param {Uint8Array} bytes
|
|
@@ -2247,6 +2299,176 @@ class ExecutionRequest {
|
|
|
2247
2299
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2248
2300
|
}
|
|
2249
2301
|
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Builds a request from externally-signed data using externally-supplied record view keys.
|
|
2304
|
+
*
|
|
2305
|
+
* For record inputs, the caller provides `record_view_keys` and `gammas` directly.
|
|
2306
|
+
* The method uses these to compute commitment, serial number, tag, and InputID for each record.
|
|
2307
|
+
*
|
|
2308
|
+
* @param {string} program_id The id of the program.
|
|
2309
|
+
* @param {string} function_name The function name.
|
|
2310
|
+
* @param {string[]} inputs The inputs to the function.
|
|
2311
|
+
* @param {string[]} input_types The input types of the function.
|
|
2312
|
+
* @param {Signature} signature The externally-computed signature.
|
|
2313
|
+
* @param {Field} tvk The transition view key.
|
|
2314
|
+
* @param {Address} signer The signer address.
|
|
2315
|
+
* @param {Field} sk_tag The tag secret key.
|
|
2316
|
+
* @param {Field[] | undefined} record_view_keys Pre-computed record view keys (required when there are record inputs).
|
|
2317
|
+
* @param {Group[] | undefined} gammas An array of gammas (required when there are record inputs).
|
|
2318
|
+
* @param {string} program_id
|
|
2319
|
+
* @param {string} function_name
|
|
2320
|
+
* @param {Array<any>} inputs
|
|
2321
|
+
* @param {Array<any>} input_types
|
|
2322
|
+
* @param {Signature} signature
|
|
2323
|
+
* @param {Field} tvk
|
|
2324
|
+
* @param {Address} signer
|
|
2325
|
+
* @param {Field} sk_tag
|
|
2326
|
+
* @param {Array<any> | null} [record_view_keys]
|
|
2327
|
+
* @param {Array<any> | null} [gammas]
|
|
2328
|
+
* @returns {ExecutionRequest}
|
|
2329
|
+
*/
|
|
2330
|
+
static fromExternallySignedData(program_id, function_name, inputs, input_types, signature, tvk, signer, sk_tag, record_view_keys, gammas) {
|
|
2331
|
+
try {
|
|
2332
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2333
|
+
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2334
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2335
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2336
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2337
|
+
_assertClass(signature, Signature);
|
|
2338
|
+
var ptr2 = signature.__destroy_into_raw();
|
|
2339
|
+
_assertClass(tvk, Field);
|
|
2340
|
+
var ptr3 = tvk.__destroy_into_raw();
|
|
2341
|
+
_assertClass(signer, Address);
|
|
2342
|
+
var ptr4 = signer.__destroy_into_raw();
|
|
2343
|
+
_assertClass(sk_tag, Field);
|
|
2344
|
+
var ptr5 = sk_tag.__destroy_into_raw();
|
|
2345
|
+
wasm.executionrequest_fromExternallySignedData(retptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), addHeapObject(input_types), ptr2, ptr3, ptr4, ptr5, isLikeNone(record_view_keys) ? 0 : addHeapObject(record_view_keys), isLikeNone(gammas) ? 0 : addHeapObject(gammas));
|
|
2346
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2347
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2348
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2349
|
+
if (r2) {
|
|
2350
|
+
throw takeObject(r1);
|
|
2351
|
+
}
|
|
2352
|
+
return ExecutionRequest.__wrap(r0);
|
|
2353
|
+
} finally {
|
|
2354
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Builds a request from externally-signed data with pre-computed input IDs.
|
|
2359
|
+
*
|
|
2360
|
+
* Each element of `input_ids` is either:
|
|
2361
|
+
* - A `Field` for constant, public, or private inputs (the input hash).
|
|
2362
|
+
* - A JS Array `[Field, Group, Field, Field, Field]` for record inputs
|
|
2363
|
+
* (commitment, gamma, record_view_key, serial_number, tag).
|
|
2364
|
+
*
|
|
2365
|
+
* The `input_types` array is used to determine the InputID variant for scalar fields.
|
|
2366
|
+
*
|
|
2367
|
+
* @param {string} program_id The id of the program.
|
|
2368
|
+
* @param {string} function_name The function name.
|
|
2369
|
+
* @param {string[]} inputs The inputs to the function.
|
|
2370
|
+
* @param {string[]} input_types The input types of the function.
|
|
2371
|
+
* @param {Signature} signature The externally-computed signature.
|
|
2372
|
+
* @param {Field} tvk The transition view key.
|
|
2373
|
+
* @param {Address} signer The signer address.
|
|
2374
|
+
* @param {Field} sk_tag The tag secret key.
|
|
2375
|
+
* @param {(Field | [Field, Group, Field, Field, Field])[]} input_ids Pre-computed input IDs.
|
|
2376
|
+
* @param {string} program_id
|
|
2377
|
+
* @param {string} function_name
|
|
2378
|
+
* @param {Array<any>} inputs
|
|
2379
|
+
* @param {Array<any>} input_types
|
|
2380
|
+
* @param {Signature} signature
|
|
2381
|
+
* @param {Field} tvk
|
|
2382
|
+
* @param {Address} signer
|
|
2383
|
+
* @param {Field} sk_tag
|
|
2384
|
+
* @param {Array<any>} input_ids
|
|
2385
|
+
* @returns {ExecutionRequest}
|
|
2386
|
+
*/
|
|
2387
|
+
static fromExternallySignedDataWithInputIds(program_id, function_name, inputs, input_types, signature, tvk, signer, sk_tag, input_ids) {
|
|
2388
|
+
try {
|
|
2389
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2390
|
+
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2391
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2392
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2393
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2394
|
+
_assertClass(signature, Signature);
|
|
2395
|
+
var ptr2 = signature.__destroy_into_raw();
|
|
2396
|
+
_assertClass(tvk, Field);
|
|
2397
|
+
var ptr3 = tvk.__destroy_into_raw();
|
|
2398
|
+
_assertClass(signer, Address);
|
|
2399
|
+
var ptr4 = signer.__destroy_into_raw();
|
|
2400
|
+
_assertClass(sk_tag, Field);
|
|
2401
|
+
var ptr5 = sk_tag.__destroy_into_raw();
|
|
2402
|
+
wasm.executionrequest_fromExternallySignedDataWithInputIds(retptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), addHeapObject(input_types), ptr2, ptr3, ptr4, ptr5, addHeapObject(input_ids));
|
|
2403
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2404
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2405
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2406
|
+
if (r2) {
|
|
2407
|
+
throw takeObject(r1);
|
|
2408
|
+
}
|
|
2409
|
+
return ExecutionRequest.__wrap(r0);
|
|
2410
|
+
} finally {
|
|
2411
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
/**
|
|
2415
|
+
* Builds a request from externally-signed data using a view key to derive record view keys.
|
|
2416
|
+
*
|
|
2417
|
+
* For record inputs, the method computes `record_view_key = (nonce * view_key).to_x_coordinate()`
|
|
2418
|
+
* for each record, then uses it with the supplied `gammas` to compute commitment, serial number,
|
|
2419
|
+
* tag, and InputID.
|
|
2420
|
+
*
|
|
2421
|
+
* @param {string} program_id The id of the program.
|
|
2422
|
+
* @param {string} function_name The function name.
|
|
2423
|
+
* @param {string[]} inputs The inputs to the function.
|
|
2424
|
+
* @param {string[]} input_types The input types of the function.
|
|
2425
|
+
* @param {Signature} signature The externally-computed signature.
|
|
2426
|
+
* @param {Field} tvk The transition view key.
|
|
2427
|
+
* @param {Address} signer The signer address.
|
|
2428
|
+
* @param {Field} sk_tag The tag secret key.
|
|
2429
|
+
* @param {ViewKey} view_key The view key of the signer.
|
|
2430
|
+
* @param {Group[] | undefined} gammas An array of gammas (required when there are record inputs).
|
|
2431
|
+
* @param {string} program_id
|
|
2432
|
+
* @param {string} function_name
|
|
2433
|
+
* @param {Array<any>} inputs
|
|
2434
|
+
* @param {Array<any>} input_types
|
|
2435
|
+
* @param {Signature} signature
|
|
2436
|
+
* @param {Field} tvk
|
|
2437
|
+
* @param {Address} signer
|
|
2438
|
+
* @param {Field} sk_tag
|
|
2439
|
+
* @param {ViewKey} view_key
|
|
2440
|
+
* @param {Array<any> | null} [gammas]
|
|
2441
|
+
* @returns {ExecutionRequest}
|
|
2442
|
+
*/
|
|
2443
|
+
static fromExternallySignedDataWithViewKey(program_id, function_name, inputs, input_types, signature, tvk, signer, sk_tag, view_key, gammas) {
|
|
2444
|
+
try {
|
|
2445
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2446
|
+
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2447
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2448
|
+
const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2449
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2450
|
+
_assertClass(signature, Signature);
|
|
2451
|
+
var ptr2 = signature.__destroy_into_raw();
|
|
2452
|
+
_assertClass(tvk, Field);
|
|
2453
|
+
var ptr3 = tvk.__destroy_into_raw();
|
|
2454
|
+
_assertClass(signer, Address);
|
|
2455
|
+
var ptr4 = signer.__destroy_into_raw();
|
|
2456
|
+
_assertClass(sk_tag, Field);
|
|
2457
|
+
var ptr5 = sk_tag.__destroy_into_raw();
|
|
2458
|
+
_assertClass(view_key, ViewKey);
|
|
2459
|
+
var ptr6 = view_key.__destroy_into_raw();
|
|
2460
|
+
wasm.executionrequest_fromExternallySignedDataWithViewKey(retptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), addHeapObject(input_types), ptr2, ptr3, ptr4, ptr5, ptr6, isLikeNone(gammas) ? 0 : addHeapObject(gammas));
|
|
2461
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2462
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2463
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2464
|
+
if (r2) {
|
|
2465
|
+
throw takeObject(r1);
|
|
2466
|
+
}
|
|
2467
|
+
return ExecutionRequest.__wrap(r0);
|
|
2468
|
+
} finally {
|
|
2469
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2250
2472
|
/**
|
|
2251
2473
|
* Builds a request object from a string representation of a request.
|
|
2252
2474
|
*
|
|
@@ -2271,6 +2493,26 @@ class ExecutionRequest {
|
|
|
2271
2493
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2272
2494
|
}
|
|
2273
2495
|
}
|
|
2496
|
+
/**
|
|
2497
|
+
* Alias for `function_name` (camelCase).
|
|
2498
|
+
* @returns {string}
|
|
2499
|
+
*/
|
|
2500
|
+
functionName() {
|
|
2501
|
+
let deferred1_0;
|
|
2502
|
+
let deferred1_1;
|
|
2503
|
+
try {
|
|
2504
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2505
|
+
wasm.executionrequest_functionName(retptr, this.__wbg_ptr);
|
|
2506
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2507
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2508
|
+
deferred1_0 = r0;
|
|
2509
|
+
deferred1_1 = r1;
|
|
2510
|
+
return getStringFromWasm0(r0, r1);
|
|
2511
|
+
} finally {
|
|
2512
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2513
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2274
2516
|
/**
|
|
2275
2517
|
* Returns the function name.
|
|
2276
2518
|
* @returns {string}
|
|
@@ -2291,8 +2533,20 @@ class ExecutionRequest {
|
|
|
2291
2533
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2292
2534
|
}
|
|
2293
2535
|
}
|
|
2536
|
+
/**
|
|
2537
|
+
* Alias for `input_ids` (camelCase).
|
|
2538
|
+
* @returns {Array<any>}
|
|
2539
|
+
*/
|
|
2540
|
+
inputIds() {
|
|
2541
|
+
const ret = wasm.executionrequest_inputIds(this.__wbg_ptr);
|
|
2542
|
+
return takeObject(ret);
|
|
2543
|
+
}
|
|
2294
2544
|
/**
|
|
2295
2545
|
* Returns the input IDs for the transition.
|
|
2546
|
+
*
|
|
2547
|
+
* Each element is either a WASM `Field` (for constant/public/private/external_record inputs)
|
|
2548
|
+
* or a JS Array `[Field, Group, Field, Field, Field]` (for record inputs: commitment, gamma,
|
|
2549
|
+
* record_view_key, serial_number, tag).
|
|
2296
2550
|
* @returns {Array<any>}
|
|
2297
2551
|
*/
|
|
2298
2552
|
input_ids() {
|
|
@@ -2307,6 +2561,14 @@ class ExecutionRequest {
|
|
|
2307
2561
|
const ret = wasm.executionrequest_inputs(this.__wbg_ptr);
|
|
2308
2562
|
return takeObject(ret);
|
|
2309
2563
|
}
|
|
2564
|
+
/**
|
|
2565
|
+
* Alias for `network_id` (camelCase).
|
|
2566
|
+
* @returns {number}
|
|
2567
|
+
*/
|
|
2568
|
+
networkId() {
|
|
2569
|
+
const ret = wasm.executionrequest_networkId(this.__wbg_ptr);
|
|
2570
|
+
return ret;
|
|
2571
|
+
}
|
|
2310
2572
|
/**
|
|
2311
2573
|
* Returns the network ID.
|
|
2312
2574
|
* @returns {number}
|
|
@@ -2315,6 +2577,26 @@ class ExecutionRequest {
|
|
|
2315
2577
|
const ret = wasm.executionrequest_network_id(this.__wbg_ptr);
|
|
2316
2578
|
return ret;
|
|
2317
2579
|
}
|
|
2580
|
+
/**
|
|
2581
|
+
* Alias for `program_id` (camelCase).
|
|
2582
|
+
* @returns {string}
|
|
2583
|
+
*/
|
|
2584
|
+
programId() {
|
|
2585
|
+
let deferred1_0;
|
|
2586
|
+
let deferred1_1;
|
|
2587
|
+
try {
|
|
2588
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2589
|
+
wasm.executionrequest_programId(retptr, this.__wbg_ptr);
|
|
2590
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2591
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2592
|
+
deferred1_0 = r0;
|
|
2593
|
+
deferred1_1 = r1;
|
|
2594
|
+
return getStringFromWasm0(r0, r1);
|
|
2595
|
+
} finally {
|
|
2596
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2597
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2318
2600
|
/**
|
|
2319
2601
|
* Returns the program ID.
|
|
2320
2602
|
* @returns {string}
|
|
@@ -2410,6 +2692,14 @@ class ExecutionRequest {
|
|
|
2410
2692
|
const ret = wasm.executionrequest_signer(this.__wbg_ptr);
|
|
2411
2693
|
return Address.__wrap(ret);
|
|
2412
2694
|
}
|
|
2695
|
+
/**
|
|
2696
|
+
* Alias for `sk_tag` (camelCase).
|
|
2697
|
+
* @returns {Field}
|
|
2698
|
+
*/
|
|
2699
|
+
skTag() {
|
|
2700
|
+
const ret = wasm.executionrequest_skTag(this.__wbg_ptr);
|
|
2701
|
+
return Field.__wrap(ret);
|
|
2702
|
+
}
|
|
2413
2703
|
/**
|
|
2414
2704
|
* Returns the tag secret key `sk_tag`.
|
|
2415
2705
|
* @returns {Field}
|
|
@@ -2467,6 +2757,14 @@ class ExecutionRequest {
|
|
|
2467
2757
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2468
2758
|
}
|
|
2469
2759
|
}
|
|
2760
|
+
/**
|
|
2761
|
+
* Alias for `to_tpk` (camelCase).
|
|
2762
|
+
* @returns {Group}
|
|
2763
|
+
*/
|
|
2764
|
+
toTpk() {
|
|
2765
|
+
const ret = wasm.executionrequest_toTpk(this.__wbg_ptr);
|
|
2766
|
+
return Group.__wrap(ret);
|
|
2767
|
+
}
|
|
2470
2768
|
/**
|
|
2471
2769
|
* Returns the transition public key `tpk`.
|
|
2472
2770
|
* @returns {Group}
|
|
@@ -3000,6 +3298,12 @@ class Group {
|
|
|
3000
3298
|
GroupFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3001
3299
|
return obj;
|
|
3002
3300
|
}
|
|
3301
|
+
static __unwrap(jsValue) {
|
|
3302
|
+
if (!(jsValue instanceof Group)) {
|
|
3303
|
+
return 0;
|
|
3304
|
+
}
|
|
3305
|
+
return jsValue.__destroy_into_raw();
|
|
3306
|
+
}
|
|
3003
3307
|
__destroy_into_raw() {
|
|
3004
3308
|
const ptr = this.__wbg_ptr;
|
|
3005
3309
|
this.__wbg_ptr = 0;
|
|
@@ -3088,6 +3392,49 @@ class Group {
|
|
|
3088
3392
|
heap[stack_pointer++] = undefined;
|
|
3089
3393
|
}
|
|
3090
3394
|
}
|
|
3395
|
+
/**
|
|
3396
|
+
* Generate the group element from the x coordinate of the group.
|
|
3397
|
+
* @param {Field} field
|
|
3398
|
+
* @returns {Group}
|
|
3399
|
+
*/
|
|
3400
|
+
static fromField(field) {
|
|
3401
|
+
try {
|
|
3402
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3403
|
+
_assertClass(field, Field);
|
|
3404
|
+
wasm.group_fromField(retptr, field.__wbg_ptr);
|
|
3405
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3406
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3407
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3408
|
+
if (r2) {
|
|
3409
|
+
throw takeObject(r1);
|
|
3410
|
+
}
|
|
3411
|
+
return Group.__wrap(r0);
|
|
3412
|
+
} finally {
|
|
3413
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
/**
|
|
3417
|
+
* Generate the group element from a string representation of the x coordinate of the group.
|
|
3418
|
+
* @param {string} field
|
|
3419
|
+
* @returns {Group}
|
|
3420
|
+
*/
|
|
3421
|
+
static fromFieldString(field) {
|
|
3422
|
+
try {
|
|
3423
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3424
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3425
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3426
|
+
wasm.group_fromFieldString(retptr, ptr0, len0);
|
|
3427
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3428
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3429
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3430
|
+
if (r2) {
|
|
3431
|
+
throw takeObject(r1);
|
|
3432
|
+
}
|
|
3433
|
+
return Group.__wrap(r0);
|
|
3434
|
+
} finally {
|
|
3435
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3091
3438
|
/**
|
|
3092
3439
|
* Creates a group object from a string representation of a group element.
|
|
3093
3440
|
* @param {string} group
|
|
@@ -7298,6 +7645,35 @@ class ProgramManager {
|
|
|
7298
7645
|
const ret = wasm.programmanager_authorizeFee(private_key.__wbg_ptr, ptr0, len0, base_fee_credits, priority_fee_credits, ptr1);
|
|
7299
7646
|
return takeObject(ret);
|
|
7300
7647
|
}
|
|
7648
|
+
/**
|
|
7649
|
+
* Build an authorization from a `Request` object.
|
|
7650
|
+
*
|
|
7651
|
+
* @param {ExecutionRequest} request The execution request to build the authorization from.
|
|
7652
|
+
* @param {string} program The program source code containing the function to authorize.
|
|
7653
|
+
* @param {boolean} unchecked Whether or not to generate an unchecked authorization.
|
|
7654
|
+
* @param {number | undefined} edition The edition of the program.
|
|
7655
|
+
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
7656
|
+
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
7657
|
+
* @param {ExecutionRequest} request
|
|
7658
|
+
* @param {string} program
|
|
7659
|
+
* @param {boolean} unchecked
|
|
7660
|
+
* @param {number | null} [edition]
|
|
7661
|
+
* @param {object | null} [imports]
|
|
7662
|
+
* @param {PrivateKey | null} [private_key]
|
|
7663
|
+
* @returns {Promise<Authorization>}
|
|
7664
|
+
*/
|
|
7665
|
+
static buildAuthorizationFromExecutionRequest(request, program, unchecked, edition, imports, private_key) {
|
|
7666
|
+
_assertClass(request, ExecutionRequest);
|
|
7667
|
+
const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
7668
|
+
const len0 = WASM_VECTOR_LEN;
|
|
7669
|
+
let ptr1 = 0;
|
|
7670
|
+
if (!isLikeNone(private_key)) {
|
|
7671
|
+
_assertClass(private_key, PrivateKey);
|
|
7672
|
+
ptr1 = private_key.__destroy_into_raw();
|
|
7673
|
+
}
|
|
7674
|
+
const ret = wasm.programmanager_buildAuthorizationFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
|
|
7675
|
+
return takeObject(ret);
|
|
7676
|
+
}
|
|
7301
7677
|
/**
|
|
7302
7678
|
* Create an execution `Authorization` without generating a circuit. Use this function when
|
|
7303
7679
|
* fast delegated proving is needed.
|
|
@@ -7711,19 +8087,50 @@ class ProgramManager {
|
|
|
7711
8087
|
return takeObject(ret);
|
|
7712
8088
|
}
|
|
7713
8089
|
/**
|
|
7714
|
-
*
|
|
8090
|
+
* Build a proving request from a `Request` object. By default this method currently uses the feemaster.
|
|
7715
8091
|
*
|
|
7716
|
-
* @param
|
|
7717
|
-
* @param
|
|
7718
|
-
*
|
|
7719
|
-
* @param
|
|
7720
|
-
* @param
|
|
7721
|
-
* @param
|
|
7722
|
-
* @param
|
|
7723
|
-
* @
|
|
7724
|
-
* @param {
|
|
7725
|
-
* @param {
|
|
7726
|
-
* @param {
|
|
8092
|
+
* @param {ExecutionRequest} request The execution request to build the authorization from.
|
|
8093
|
+
* @param {string} program The program source code containing the function to authorize.
|
|
8094
|
+
* @param {boolean} unchecked Whether or not to generate an unchecked authorization.
|
|
8095
|
+
* @param {boolean} broadcast Whether or not to broadcast the transaction.
|
|
8096
|
+
* @param {number | undefined} edition The edition of the program.
|
|
8097
|
+
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
8098
|
+
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
8099
|
+
* @param {ExecutionRequest} request
|
|
8100
|
+
* @param {string} program
|
|
8101
|
+
* @param {boolean} unchecked
|
|
8102
|
+
* @param {boolean} broadcast
|
|
8103
|
+
* @param {number | null} [edition]
|
|
8104
|
+
* @param {object | null} [imports]
|
|
8105
|
+
* @param {PrivateKey | null} [private_key]
|
|
8106
|
+
* @returns {Promise<ProvingRequest>}
|
|
8107
|
+
*/
|
|
8108
|
+
static buildProvingRequestFromExecutionRequest(request, program, unchecked, broadcast, edition, imports, private_key) {
|
|
8109
|
+
_assertClass(request, ExecutionRequest);
|
|
8110
|
+
const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
8111
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8112
|
+
let ptr1 = 0;
|
|
8113
|
+
if (!isLikeNone(private_key)) {
|
|
8114
|
+
_assertClass(private_key, PrivateKey);
|
|
8115
|
+
ptr1 = private_key.__destroy_into_raw();
|
|
8116
|
+
}
|
|
8117
|
+
const ret = wasm.programmanager_buildProvingRequestFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, broadcast, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
|
|
8118
|
+
return takeObject(ret);
|
|
8119
|
+
}
|
|
8120
|
+
/**
|
|
8121
|
+
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
8122
|
+
*
|
|
8123
|
+
* @param private_key The private key of the sender
|
|
8124
|
+
* @param split_amount The amount of the credit split. This amount will be subtracted from the
|
|
8125
|
+
* value of the record and two new records will be created with the split amount and the remainder
|
|
8126
|
+
* @param amount_record The record to split
|
|
8127
|
+
* @param url The url of the Aleo network node to send the transaction to
|
|
8128
|
+
* @param split_proving_key (optional) Provide a proving key to use for the split function
|
|
8129
|
+
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
8130
|
+
* @returns {Transaction} Transaction object
|
|
8131
|
+
* @param {PrivateKey} private_key
|
|
8132
|
+
* @param {number} split_amount
|
|
8133
|
+
* @param {RecordPlaintext} amount_record
|
|
7727
8134
|
* @param {string | null} [url]
|
|
7728
8135
|
* @param {ProvingKey | null} [split_proving_key]
|
|
7729
8136
|
* @param {VerifyingKey | null} [split_verifying_key]
|
|
@@ -8197,6 +8604,126 @@ class ProgramManager {
|
|
|
8197
8604
|
}
|
|
8198
8605
|
if (Symbol.dispose) ProgramManager.prototype[Symbol.dispose] = ProgramManager.prototype.free;
|
|
8199
8606
|
|
|
8607
|
+
/**
|
|
8608
|
+
* SNARK proof for verification of program execution
|
|
8609
|
+
*/
|
|
8610
|
+
class Proof {
|
|
8611
|
+
static __wrap(ptr) {
|
|
8612
|
+
ptr = ptr >>> 0;
|
|
8613
|
+
const obj = Object.create(Proof.prototype);
|
|
8614
|
+
obj.__wbg_ptr = ptr;
|
|
8615
|
+
ProofFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
8616
|
+
return obj;
|
|
8617
|
+
}
|
|
8618
|
+
__destroy_into_raw() {
|
|
8619
|
+
const ptr = this.__wbg_ptr;
|
|
8620
|
+
this.__wbg_ptr = 0;
|
|
8621
|
+
ProofFinalization.unregister(this);
|
|
8622
|
+
return ptr;
|
|
8623
|
+
}
|
|
8624
|
+
free() {
|
|
8625
|
+
const ptr = this.__destroy_into_raw();
|
|
8626
|
+
wasm.__wbg_proof_free(ptr, 0);
|
|
8627
|
+
}
|
|
8628
|
+
/**
|
|
8629
|
+
* Construct a new proof from a byte array
|
|
8630
|
+
*
|
|
8631
|
+
* @param {Uint8Array} bytes Byte array representation of a proof
|
|
8632
|
+
* @returns {Proof}
|
|
8633
|
+
* @param {Uint8Array} bytes
|
|
8634
|
+
* @returns {Proof}
|
|
8635
|
+
*/
|
|
8636
|
+
static fromBytes(bytes) {
|
|
8637
|
+
try {
|
|
8638
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8639
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
8640
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8641
|
+
wasm.proof_fromBytes(retptr, ptr0, len0);
|
|
8642
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8643
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8644
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
8645
|
+
if (r2) {
|
|
8646
|
+
throw takeObject(r1);
|
|
8647
|
+
}
|
|
8648
|
+
return Proof.__wrap(r0);
|
|
8649
|
+
} finally {
|
|
8650
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
8651
|
+
}
|
|
8652
|
+
}
|
|
8653
|
+
/**
|
|
8654
|
+
* Create a proof from string
|
|
8655
|
+
*
|
|
8656
|
+
* @param {string} string String representation of the proof
|
|
8657
|
+
* @returns {Proof}
|
|
8658
|
+
* @param {string} string
|
|
8659
|
+
* @returns {Proof}
|
|
8660
|
+
*/
|
|
8661
|
+
static fromString(string) {
|
|
8662
|
+
try {
|
|
8663
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8664
|
+
const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
8665
|
+
const len0 = WASM_VECTOR_LEN;
|
|
8666
|
+
wasm.proof_fromString(retptr, ptr0, len0);
|
|
8667
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8668
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8669
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
8670
|
+
if (r2) {
|
|
8671
|
+
throw takeObject(r1);
|
|
8672
|
+
}
|
|
8673
|
+
return Proof.__wrap(r0);
|
|
8674
|
+
} finally {
|
|
8675
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
/**
|
|
8679
|
+
* Return the byte representation of a proof
|
|
8680
|
+
*
|
|
8681
|
+
* @returns {Uint8Array} Byte array representation of a proof
|
|
8682
|
+
* @returns {Uint8Array}
|
|
8683
|
+
*/
|
|
8684
|
+
toBytes() {
|
|
8685
|
+
try {
|
|
8686
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8687
|
+
wasm.proof_toBytes(retptr, this.__wbg_ptr);
|
|
8688
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8689
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8690
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
8691
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
8692
|
+
if (r3) {
|
|
8693
|
+
throw takeObject(r2);
|
|
8694
|
+
}
|
|
8695
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
8696
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
8697
|
+
return v1;
|
|
8698
|
+
} finally {
|
|
8699
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
8700
|
+
}
|
|
8701
|
+
}
|
|
8702
|
+
/**
|
|
8703
|
+
* Get a string representation of the proof
|
|
8704
|
+
*
|
|
8705
|
+
* @returns {string} String representation of the proof
|
|
8706
|
+
* @returns {string}
|
|
8707
|
+
*/
|
|
8708
|
+
toString() {
|
|
8709
|
+
let deferred1_0;
|
|
8710
|
+
let deferred1_1;
|
|
8711
|
+
try {
|
|
8712
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
8713
|
+
wasm.proof_toString(retptr, this.__wbg_ptr);
|
|
8714
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
8715
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
8716
|
+
deferred1_0 = r0;
|
|
8717
|
+
deferred1_1 = r1;
|
|
8718
|
+
return getStringFromWasm0(r0, r1);
|
|
8719
|
+
} finally {
|
|
8720
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
8721
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
8722
|
+
}
|
|
8723
|
+
}
|
|
8724
|
+
}
|
|
8725
|
+
if (Symbol.dispose) Proof.prototype[Symbol.dispose] = Proof.prototype.free;
|
|
8726
|
+
|
|
8200
8727
|
/**
|
|
8201
8728
|
* Proving key for a function within an Aleo program
|
|
8202
8729
|
*/
|
|
@@ -9140,6 +9667,38 @@ class RecordPlaintext {
|
|
|
9140
9667
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
9141
9668
|
}
|
|
9142
9669
|
}
|
|
9670
|
+
/**
|
|
9671
|
+
* Compute the record's gamma value.
|
|
9672
|
+
*
|
|
9673
|
+
* @param {string} program_id The program id that produced the record.
|
|
9674
|
+
* @param {string} record_name The name of the record within the program.
|
|
9675
|
+
* @param {PrivateKey} private_key The private key that created the record.
|
|
9676
|
+
* @returns {Group} The computed value of gamma.
|
|
9677
|
+
* @param {string} program_id
|
|
9678
|
+
* @param {string} record_name
|
|
9679
|
+
* @param {PrivateKey} private_key
|
|
9680
|
+
* @returns {Group}
|
|
9681
|
+
*/
|
|
9682
|
+
gamma(program_id, record_name, private_key) {
|
|
9683
|
+
try {
|
|
9684
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
9685
|
+
const ptr0 = passStringToWasm0(program_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
9686
|
+
const len0 = WASM_VECTOR_LEN;
|
|
9687
|
+
const ptr1 = passStringToWasm0(record_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
9688
|
+
const len1 = WASM_VECTOR_LEN;
|
|
9689
|
+
_assertClass(private_key, PrivateKey);
|
|
9690
|
+
wasm.recordplaintext_gamma(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, private_key.__wbg_ptr);
|
|
9691
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
9692
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
9693
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
9694
|
+
if (r2) {
|
|
9695
|
+
throw takeObject(r1);
|
|
9696
|
+
}
|
|
9697
|
+
return Group.__wrap(r0);
|
|
9698
|
+
} finally {
|
|
9699
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
9700
|
+
}
|
|
9701
|
+
}
|
|
9143
9702
|
/**
|
|
9144
9703
|
* Get the record entry matching a key.
|
|
9145
9704
|
*
|
|
@@ -12295,6 +12854,331 @@ class U8 {
|
|
|
12295
12854
|
}
|
|
12296
12855
|
if (Symbol.dispose) U8.prototype[Symbol.dispose] = U8.prototype.free;
|
|
12297
12856
|
|
|
12857
|
+
/**
|
|
12858
|
+
* Aleo Value type. Value is the fundamental type representing program function inputs and outputs
|
|
12859
|
+
* in Aleo. It wraps three variants: Plaintext, Record, and Future.
|
|
12860
|
+
*
|
|
12861
|
+
* @example
|
|
12862
|
+
* // Parse a plaintext value from a string.
|
|
12863
|
+
* const value = Value.fromString("100u64");
|
|
12864
|
+
* console.log(value.valueType()); // "plaintext"
|
|
12865
|
+
* console.log(value.isPlaintext()); // true
|
|
12866
|
+
*
|
|
12867
|
+
* // Extract the inner Plaintext.
|
|
12868
|
+
* const plaintext = value.toPlaintext();
|
|
12869
|
+
* console.log(plaintext.toString()); // "100u64"
|
|
12870
|
+
*/
|
|
12871
|
+
class Value {
|
|
12872
|
+
static __wrap(ptr) {
|
|
12873
|
+
ptr = ptr >>> 0;
|
|
12874
|
+
const obj = Object.create(Value.prototype);
|
|
12875
|
+
obj.__wbg_ptr = ptr;
|
|
12876
|
+
ValueFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
12877
|
+
return obj;
|
|
12878
|
+
}
|
|
12879
|
+
__destroy_into_raw() {
|
|
12880
|
+
const ptr = this.__wbg_ptr;
|
|
12881
|
+
this.__wbg_ptr = 0;
|
|
12882
|
+
ValueFinalization.unregister(this);
|
|
12883
|
+
return ptr;
|
|
12884
|
+
}
|
|
12885
|
+
free() {
|
|
12886
|
+
const ptr = this.__destroy_into_raw();
|
|
12887
|
+
wasm.__wbg_value_free(ptr, 0);
|
|
12888
|
+
}
|
|
12889
|
+
/**
|
|
12890
|
+
* Creates a Value from a little-endian byte array.
|
|
12891
|
+
*
|
|
12892
|
+
* @param {Uint8Array} bytes A little-endian byte array.
|
|
12893
|
+
* @returns {Value} The Value object.
|
|
12894
|
+
* @param {Uint8Array} bytes
|
|
12895
|
+
* @returns {Value}
|
|
12896
|
+
*/
|
|
12897
|
+
static fromBytesLe(bytes) {
|
|
12898
|
+
try {
|
|
12899
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
12900
|
+
wasm.value_fromBytesLe(retptr, addHeapObject(bytes));
|
|
12901
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
12902
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
12903
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
12904
|
+
if (r2) {
|
|
12905
|
+
throw takeObject(r1);
|
|
12906
|
+
}
|
|
12907
|
+
return Value.__wrap(r0);
|
|
12908
|
+
} finally {
|
|
12909
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
12910
|
+
}
|
|
12911
|
+
}
|
|
12912
|
+
/**
|
|
12913
|
+
* Creates a Value from a Plaintext object.
|
|
12914
|
+
*
|
|
12915
|
+
* @param {Plaintext} plaintext The Plaintext to wrap.
|
|
12916
|
+
* @returns {Value} A Value wrapping the Plaintext.
|
|
12917
|
+
* @param {Plaintext} plaintext
|
|
12918
|
+
* @returns {Value}
|
|
12919
|
+
*/
|
|
12920
|
+
static fromPlaintext(plaintext) {
|
|
12921
|
+
_assertClass(plaintext, Plaintext);
|
|
12922
|
+
const ret = wasm.value_fromPlaintext(plaintext.__wbg_ptr);
|
|
12923
|
+
return Value.__wrap(ret);
|
|
12924
|
+
}
|
|
12925
|
+
/**
|
|
12926
|
+
* Creates a Value from a RecordPlaintext object.
|
|
12927
|
+
*
|
|
12928
|
+
* @param {RecordPlaintext} record The RecordPlaintext to wrap.
|
|
12929
|
+
* @returns {Value} A Value wrapping the Record.
|
|
12930
|
+
* @param {RecordPlaintext} record
|
|
12931
|
+
* @returns {Value}
|
|
12932
|
+
*/
|
|
12933
|
+
static fromRecordPlaintext(record) {
|
|
12934
|
+
_assertClass(record, RecordPlaintext);
|
|
12935
|
+
const ret = wasm.value_fromRecordPlaintext(record.__wbg_ptr);
|
|
12936
|
+
return Value.__wrap(ret);
|
|
12937
|
+
}
|
|
12938
|
+
/**
|
|
12939
|
+
* Creates a Value from its string representation.
|
|
12940
|
+
*
|
|
12941
|
+
* @param {string} value The string representation of the value.
|
|
12942
|
+
* @returns {Value} The Value object.
|
|
12943
|
+
* @param {string} value
|
|
12944
|
+
* @returns {Value}
|
|
12945
|
+
*/
|
|
12946
|
+
static fromString(value) {
|
|
12947
|
+
try {
|
|
12948
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
12949
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
12950
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12951
|
+
wasm.value_fromString(retptr, ptr0, len0);
|
|
12952
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
12953
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
12954
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
12955
|
+
if (r2) {
|
|
12956
|
+
throw takeObject(r1);
|
|
12957
|
+
}
|
|
12958
|
+
return Value.__wrap(r0);
|
|
12959
|
+
} finally {
|
|
12960
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
12961
|
+
}
|
|
12962
|
+
}
|
|
12963
|
+
/**
|
|
12964
|
+
* Returns true if the value is a Future variant.
|
|
12965
|
+
*
|
|
12966
|
+
* Note: There is no `toFuture()` method because the Future type does not have a WASM wrapper.
|
|
12967
|
+
* Use `toString()` or `toBytesLe()` to serialize a Future value.
|
|
12968
|
+
*
|
|
12969
|
+
* @returns {boolean}
|
|
12970
|
+
* @returns {boolean}
|
|
12971
|
+
*/
|
|
12972
|
+
isFuture() {
|
|
12973
|
+
const ret = wasm.value_isFuture(this.__wbg_ptr);
|
|
12974
|
+
return ret !== 0;
|
|
12975
|
+
}
|
|
12976
|
+
/**
|
|
12977
|
+
* Returns true if the value is a Plaintext variant.
|
|
12978
|
+
*
|
|
12979
|
+
* @returns {boolean}
|
|
12980
|
+
* @returns {boolean}
|
|
12981
|
+
*/
|
|
12982
|
+
isPlaintext() {
|
|
12983
|
+
const ret = wasm.value_isPlaintext(this.__wbg_ptr);
|
|
12984
|
+
return ret !== 0;
|
|
12985
|
+
}
|
|
12986
|
+
/**
|
|
12987
|
+
* Returns true if the value is a Record variant.
|
|
12988
|
+
*
|
|
12989
|
+
* @returns {boolean}
|
|
12990
|
+
* @returns {boolean}
|
|
12991
|
+
*/
|
|
12992
|
+
isRecord() {
|
|
12993
|
+
const ret = wasm.value_isRecord(this.__wbg_ptr);
|
|
12994
|
+
return ret !== 0;
|
|
12995
|
+
}
|
|
12996
|
+
/**
|
|
12997
|
+
* Returns the little-endian boolean array representation of the bits.
|
|
12998
|
+
*
|
|
12999
|
+
* @returns {Array} Boolean array of bits in little-endian order.
|
|
13000
|
+
* @returns {Array<any>}
|
|
13001
|
+
*/
|
|
13002
|
+
toBitsLe() {
|
|
13003
|
+
const ret = wasm.value_toBitsLe(this.__wbg_ptr);
|
|
13004
|
+
return takeObject(ret);
|
|
13005
|
+
}
|
|
13006
|
+
/**
|
|
13007
|
+
* Returns the raw big-endian boolean array representation of the bits.
|
|
13008
|
+
*
|
|
13009
|
+
* @returns {Array} Raw boolean array of bits in big-endian order.
|
|
13010
|
+
* @returns {Array<any>}
|
|
13011
|
+
*/
|
|
13012
|
+
toBitsRawBe() {
|
|
13013
|
+
const ret = wasm.value_toBitsRawBe(this.__wbg_ptr);
|
|
13014
|
+
return takeObject(ret);
|
|
13015
|
+
}
|
|
13016
|
+
/**
|
|
13017
|
+
* Returns the raw little-endian boolean array representation of the bits.
|
|
13018
|
+
*
|
|
13019
|
+
* @returns {Array} Raw boolean array of bits in little-endian order.
|
|
13020
|
+
* @returns {Array<any>}
|
|
13021
|
+
*/
|
|
13022
|
+
toBitsRawLe() {
|
|
13023
|
+
const ret = wasm.value_toBitsRawLe(this.__wbg_ptr);
|
|
13024
|
+
return takeObject(ret);
|
|
13025
|
+
}
|
|
13026
|
+
/**
|
|
13027
|
+
* Returns the little-endian byte array representation of the value.
|
|
13028
|
+
*
|
|
13029
|
+
* @returns {Uint8Array} The little-endian byte array.
|
|
13030
|
+
* @returns {Uint8Array}
|
|
13031
|
+
*/
|
|
13032
|
+
toBytesLe() {
|
|
13033
|
+
try {
|
|
13034
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13035
|
+
wasm.value_toBytesLe(retptr, this.__wbg_ptr);
|
|
13036
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13037
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13038
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13039
|
+
if (r2) {
|
|
13040
|
+
throw takeObject(r1);
|
|
13041
|
+
}
|
|
13042
|
+
return takeObject(r0);
|
|
13043
|
+
} finally {
|
|
13044
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13045
|
+
}
|
|
13046
|
+
}
|
|
13047
|
+
/**
|
|
13048
|
+
* Returns the field array representation of the value.
|
|
13049
|
+
*
|
|
13050
|
+
* @returns {Array} Array of Field elements.
|
|
13051
|
+
* @returns {Array<any>}
|
|
13052
|
+
*/
|
|
13053
|
+
toFields() {
|
|
13054
|
+
try {
|
|
13055
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13056
|
+
wasm.value_toFields(retptr, this.__wbg_ptr);
|
|
13057
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13058
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13059
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13060
|
+
if (r2) {
|
|
13061
|
+
throw takeObject(r1);
|
|
13062
|
+
}
|
|
13063
|
+
return takeObject(r0);
|
|
13064
|
+
} finally {
|
|
13065
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13066
|
+
}
|
|
13067
|
+
}
|
|
13068
|
+
/**
|
|
13069
|
+
* Returns the raw field array representation of the value.
|
|
13070
|
+
*
|
|
13071
|
+
* @returns {Array} Array of raw Field elements.
|
|
13072
|
+
* @returns {Array<any>}
|
|
13073
|
+
*/
|
|
13074
|
+
toFieldsRaw() {
|
|
13075
|
+
try {
|
|
13076
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13077
|
+
wasm.value_toFieldsRaw(retptr, this.__wbg_ptr);
|
|
13078
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13079
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13080
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13081
|
+
if (r2) {
|
|
13082
|
+
throw takeObject(r1);
|
|
13083
|
+
}
|
|
13084
|
+
return takeObject(r0);
|
|
13085
|
+
} finally {
|
|
13086
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13087
|
+
}
|
|
13088
|
+
}
|
|
13089
|
+
/**
|
|
13090
|
+
* Extracts the inner Plaintext from a Plaintext variant.
|
|
13091
|
+
*
|
|
13092
|
+
* @returns {Plaintext} The inner Plaintext value.
|
|
13093
|
+
* @throws If the value is not a Plaintext variant.
|
|
13094
|
+
* @returns {Plaintext}
|
|
13095
|
+
*/
|
|
13096
|
+
toPlaintext() {
|
|
13097
|
+
try {
|
|
13098
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13099
|
+
wasm.value_toPlaintext(retptr, this.__wbg_ptr);
|
|
13100
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13101
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13102
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13103
|
+
if (r2) {
|
|
13104
|
+
throw takeObject(r1);
|
|
13105
|
+
}
|
|
13106
|
+
return Plaintext.__wrap(r0);
|
|
13107
|
+
} finally {
|
|
13108
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13109
|
+
}
|
|
13110
|
+
}
|
|
13111
|
+
/**
|
|
13112
|
+
* Extracts the inner Record from a Record variant as a RecordPlaintext.
|
|
13113
|
+
*
|
|
13114
|
+
* @returns {RecordPlaintext} The inner record.
|
|
13115
|
+
* @throws If the value is not a Record variant.
|
|
13116
|
+
* @returns {RecordPlaintext}
|
|
13117
|
+
*/
|
|
13118
|
+
toRecordPlaintext() {
|
|
13119
|
+
try {
|
|
13120
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13121
|
+
wasm.value_toRecordPlaintext(retptr, this.__wbg_ptr);
|
|
13122
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13123
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13124
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13125
|
+
if (r2) {
|
|
13126
|
+
throw takeObject(r1);
|
|
13127
|
+
}
|
|
13128
|
+
return RecordPlaintext.__wrap(r0);
|
|
13129
|
+
} finally {
|
|
13130
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13131
|
+
}
|
|
13132
|
+
}
|
|
13133
|
+
/**
|
|
13134
|
+
* Returns the string representation of the value.
|
|
13135
|
+
*
|
|
13136
|
+
* @returns {string} The string representation of the value.
|
|
13137
|
+
* @returns {string}
|
|
13138
|
+
*/
|
|
13139
|
+
toString() {
|
|
13140
|
+
let deferred1_0;
|
|
13141
|
+
let deferred1_1;
|
|
13142
|
+
try {
|
|
13143
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13144
|
+
wasm.value_toString(retptr, this.__wbg_ptr);
|
|
13145
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13146
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13147
|
+
deferred1_0 = r0;
|
|
13148
|
+
deferred1_1 = r1;
|
|
13149
|
+
return getStringFromWasm0(r0, r1);
|
|
13150
|
+
} finally {
|
|
13151
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13152
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
13153
|
+
}
|
|
13154
|
+
}
|
|
13155
|
+
/**
|
|
13156
|
+
* Returns the type of the value variant as a string.
|
|
13157
|
+
*
|
|
13158
|
+
* Possible values: "plaintext", "record", "future".
|
|
13159
|
+
*
|
|
13160
|
+
* @returns {string} The variant type name.
|
|
13161
|
+
* @returns {string}
|
|
13162
|
+
*/
|
|
13163
|
+
valueType() {
|
|
13164
|
+
let deferred1_0;
|
|
13165
|
+
let deferred1_1;
|
|
13166
|
+
try {
|
|
13167
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13168
|
+
wasm.value_valueType(retptr, this.__wbg_ptr);
|
|
13169
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13170
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13171
|
+
deferred1_0 = r0;
|
|
13172
|
+
deferred1_1 = r1;
|
|
13173
|
+
return getStringFromWasm0(r0, r1);
|
|
13174
|
+
} finally {
|
|
13175
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13176
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
13177
|
+
}
|
|
13178
|
+
}
|
|
13179
|
+
}
|
|
13180
|
+
if (Symbol.dispose) Value.prototype[Symbol.dispose] = Value.prototype.free;
|
|
13181
|
+
|
|
12298
13182
|
/**
|
|
12299
13183
|
* Verifying key for a function within an Aleo program
|
|
12300
13184
|
*/
|
|
@@ -12754,6 +13638,60 @@ class VerifyingKey {
|
|
|
12754
13638
|
const ret = wasm.verifyingkey_unbondPublicVerifier();
|
|
12755
13639
|
return VerifyingKey.__wrap(ret);
|
|
12756
13640
|
}
|
|
13641
|
+
/**
|
|
13642
|
+
* Verify a SNARK proof against this verifying key and public inputs.
|
|
13643
|
+
*
|
|
13644
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
13645
|
+
* @param {Proof} proof The proof to verify
|
|
13646
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
13647
|
+
* @param {Array<any>} inputs
|
|
13648
|
+
* @param {Proof} proof
|
|
13649
|
+
* @returns {boolean}
|
|
13650
|
+
*/
|
|
13651
|
+
verify(inputs, proof) {
|
|
13652
|
+
try {
|
|
13653
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13654
|
+
_assertClass(proof, Proof);
|
|
13655
|
+
wasm.verifyingkey_verify(retptr, this.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
13656
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13657
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13658
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13659
|
+
if (r2) {
|
|
13660
|
+
throw takeObject(r1);
|
|
13661
|
+
}
|
|
13662
|
+
return r0 !== 0;
|
|
13663
|
+
} finally {
|
|
13664
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13665
|
+
}
|
|
13666
|
+
}
|
|
13667
|
+
/**
|
|
13668
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
13669
|
+
*
|
|
13670
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
13671
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
13672
|
+
* @param {Proof} proof The batch proof to verify
|
|
13673
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
13674
|
+
* @param {Array<any>} verifying_keys
|
|
13675
|
+
* @param {Array<any>} inputs
|
|
13676
|
+
* @param {Proof} proof
|
|
13677
|
+
* @returns {boolean}
|
|
13678
|
+
*/
|
|
13679
|
+
static verifyBatch(verifying_keys, inputs, proof) {
|
|
13680
|
+
try {
|
|
13681
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13682
|
+
_assertClass(proof, Proof);
|
|
13683
|
+
wasm.verifyingkey_verifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
13684
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13685
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13686
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13687
|
+
if (r2) {
|
|
13688
|
+
throw takeObject(r1);
|
|
13689
|
+
}
|
|
13690
|
+
return r0 !== 0;
|
|
13691
|
+
} finally {
|
|
13692
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13693
|
+
}
|
|
13694
|
+
}
|
|
12757
13695
|
}
|
|
12758
13696
|
if (Symbol.dispose) VerifyingKey.prototype[Symbol.dispose] = VerifyingKey.prototype.free;
|
|
12759
13697
|
|
|
@@ -12976,7 +13914,7 @@ if (Symbol.dispose) ViewKey.prototype[Symbol.dispose] = ViewKey.prototype.free;
|
|
|
12976
13914
|
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
12977
13915
|
*
|
|
12978
13916
|
* @example
|
|
12979
|
-
* import {
|
|
13917
|
+
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
12980
13918
|
*
|
|
12981
13919
|
* Set the consensus version heights.
|
|
12982
13920
|
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12");
|
|
@@ -13007,6 +13945,93 @@ function runRayonThread(receiver) {
|
|
|
13007
13945
|
wasm.runRayonThread(receiver);
|
|
13008
13946
|
}
|
|
13009
13947
|
|
|
13948
|
+
/**
|
|
13949
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
13950
|
+
*
|
|
13951
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
13952
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
13953
|
+
*
|
|
13954
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
13955
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
13956
|
+
* @param {Proof} proof The proof to verify
|
|
13957
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
13958
|
+
* @param {VerifyingKey} verifying_key
|
|
13959
|
+
* @param {Array<any>} inputs
|
|
13960
|
+
* @param {Proof} proof
|
|
13961
|
+
* @returns {boolean}
|
|
13962
|
+
*/
|
|
13963
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
13964
|
+
try {
|
|
13965
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13966
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
13967
|
+
_assertClass(proof, Proof);
|
|
13968
|
+
wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
13969
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13970
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13971
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
13972
|
+
if (r2) {
|
|
13973
|
+
throw takeObject(r1);
|
|
13974
|
+
}
|
|
13975
|
+
return r0 !== 0;
|
|
13976
|
+
} finally {
|
|
13977
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
13978
|
+
}
|
|
13979
|
+
}
|
|
13980
|
+
|
|
13981
|
+
/**
|
|
13982
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
13983
|
+
*
|
|
13984
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
13985
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
13986
|
+
*
|
|
13987
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
13988
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
13989
|
+
* @param {Proof} proof The batch proof to verify
|
|
13990
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
13991
|
+
* @param {Array<any>} verifying_keys
|
|
13992
|
+
* @param {Array<any>} inputs
|
|
13993
|
+
* @param {Proof} proof
|
|
13994
|
+
* @returns {boolean}
|
|
13995
|
+
*/
|
|
13996
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
13997
|
+
try {
|
|
13998
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13999
|
+
_assertClass(proof, Proof);
|
|
14000
|
+
wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
14001
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
14002
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
14003
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
14004
|
+
if (r2) {
|
|
14005
|
+
throw takeObject(r1);
|
|
14006
|
+
}
|
|
14007
|
+
return r0 !== 0;
|
|
14008
|
+
} finally {
|
|
14009
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
14010
|
+
}
|
|
14011
|
+
}
|
|
14012
|
+
|
|
14013
|
+
/**
|
|
14014
|
+
* @param {string} string
|
|
14015
|
+
* @returns {Field}
|
|
14016
|
+
*/
|
|
14017
|
+
function stringToField(string) {
|
|
14018
|
+
try {
|
|
14019
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
14020
|
+
const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
14021
|
+
const len0 = WASM_VECTOR_LEN;
|
|
14022
|
+
wasm.stringToField(retptr, ptr0, len0);
|
|
14023
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
14024
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
14025
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
14026
|
+
if (r2) {
|
|
14027
|
+
throw takeObject(r1);
|
|
14028
|
+
}
|
|
14029
|
+
return Field.__wrap(r0);
|
|
14030
|
+
} finally {
|
|
14031
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
14032
|
+
}
|
|
14033
|
+
}
|
|
14034
|
+
|
|
13010
14035
|
/**
|
|
13011
14036
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
13012
14037
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -13191,6 +14216,10 @@ function __wbg_get_imports(memory) {
|
|
|
13191
14216
|
const ret = Field.__unwrap(getObject(arg0));
|
|
13192
14217
|
return ret;
|
|
13193
14218
|
},
|
|
14219
|
+
__wbg_from_291708c278f9eb83: function(arg0) {
|
|
14220
|
+
const ret = Array.from(getObject(arg0));
|
|
14221
|
+
return addHeapObject(ret);
|
|
14222
|
+
},
|
|
13194
14223
|
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
13195
14224
|
getObject(arg0).getRandomValues(getObject(arg1));
|
|
13196
14225
|
}, arguments); },
|
|
@@ -13214,6 +14243,10 @@ function __wbg_get_imports(memory) {
|
|
|
13214
14243
|
const ret = Group.__wrap(arg0);
|
|
13215
14244
|
return addHeapObject(ret);
|
|
13216
14245
|
},
|
|
14246
|
+
__wbg_group_unwrap: function(arg0) {
|
|
14247
|
+
const ret = Group.__unwrap(getObject(arg0));
|
|
14248
|
+
return ret;
|
|
14249
|
+
},
|
|
13217
14250
|
__wbg_has_393943c179c58bfe: function() { return handleError(function (arg0, arg1) {
|
|
13218
14251
|
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
13219
14252
|
return ret;
|
|
@@ -13242,6 +14275,10 @@ function __wbg_get_imports(memory) {
|
|
|
13242
14275
|
const ret = result;
|
|
13243
14276
|
return ret;
|
|
13244
14277
|
},
|
|
14278
|
+
__wbg_isArray_2efa5973cef6ec32: function(arg0) {
|
|
14279
|
+
const ret = Array.isArray(getObject(arg0));
|
|
14280
|
+
return ret;
|
|
14281
|
+
},
|
|
13245
14282
|
__wbg_iterator_e77d2b7575cca5a7: function() {
|
|
13246
14283
|
const ret = Symbol.iterator;
|
|
13247
14284
|
return addHeapObject(ret);
|
|
@@ -13262,7 +14299,7 @@ function __wbg_get_imports(memory) {
|
|
|
13262
14299
|
const ret = getObject(arg0).length;
|
|
13263
14300
|
return ret;
|
|
13264
14301
|
},
|
|
13265
|
-
|
|
14302
|
+
__wbg_log_50a68fe5eae22785: function(arg0, arg1) {
|
|
13266
14303
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
13267
14304
|
},
|
|
13268
14305
|
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
@@ -13312,7 +14349,7 @@ function __wbg_get_imports(memory) {
|
|
|
13312
14349
|
const a = state0.a;
|
|
13313
14350
|
state0.a = 0;
|
|
13314
14351
|
try {
|
|
13315
|
-
return
|
|
14352
|
+
return __wasm_bindgen_func_elem_7051(a, state0.b, arg0, arg1);
|
|
13316
14353
|
} finally {
|
|
13317
14354
|
state0.a = a;
|
|
13318
14355
|
}
|
|
@@ -13334,7 +14371,7 @@ function __wbg_get_imports(memory) {
|
|
|
13334
14371
|
const a = state0.a;
|
|
13335
14372
|
state0.a = 0;
|
|
13336
14373
|
try {
|
|
13337
|
-
return
|
|
14374
|
+
return __wasm_bindgen_func_elem_7051(a, state0.b, arg0, arg1);
|
|
13338
14375
|
} finally {
|
|
13339
14376
|
state0.a = a;
|
|
13340
14377
|
}
|
|
@@ -13496,7 +14533,7 @@ function __wbg_get_imports(memory) {
|
|
|
13496
14533
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
13497
14534
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
13498
14535
|
},
|
|
13499
|
-
|
|
14536
|
+
__wbg_spawnWorker_b6845553df24e4a0: function(arg0, arg1, arg2, arg3) {
|
|
13500
14537
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
13501
14538
|
return addHeapObject(ret);
|
|
13502
14539
|
},
|
|
@@ -13592,22 +14629,22 @@ function __wbg_get_imports(memory) {
|
|
|
13592
14629
|
},
|
|
13593
14630
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
13594
14631
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 311, function: Function { arguments: [Externref], shim_idx: 312, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
13595
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
14632
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1528, __wasm_bindgen_func_elem_7057);
|
|
13596
14633
|
return addHeapObject(ret);
|
|
13597
14634
|
},
|
|
13598
14635
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
13599
14636
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 311, function: Function { arguments: [Externref], shim_idx: 325, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
13600
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
14637
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1528, __wasm_bindgen_func_elem_1529);
|
|
13601
14638
|
return addHeapObject(ret);
|
|
13602
14639
|
},
|
|
13603
14640
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
13604
14641
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 311, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 325, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
13605
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
14642
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1528, __wasm_bindgen_func_elem_1529_2);
|
|
13606
14643
|
return addHeapObject(ret);
|
|
13607
14644
|
},
|
|
13608
14645
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
13609
14646
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 311, function: Function { arguments: [], shim_idx: 445, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
13610
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
14647
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1528, __wasm_bindgen_func_elem_6706);
|
|
13611
14648
|
return addHeapObject(ret);
|
|
13612
14649
|
},
|
|
13613
14650
|
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
@@ -13674,22 +14711,22 @@ function __wbg_get_imports(memory) {
|
|
|
13674
14711
|
};
|
|
13675
14712
|
}
|
|
13676
14713
|
|
|
13677
|
-
function
|
|
13678
|
-
wasm.
|
|
14714
|
+
function __wasm_bindgen_func_elem_6706(arg0, arg1) {
|
|
14715
|
+
wasm.__wasm_bindgen_func_elem_6706(arg0, arg1);
|
|
13679
14716
|
}
|
|
13680
14717
|
|
|
13681
|
-
function
|
|
13682
|
-
wasm.
|
|
14718
|
+
function __wasm_bindgen_func_elem_1529(arg0, arg1, arg2) {
|
|
14719
|
+
wasm.__wasm_bindgen_func_elem_1529(arg0, arg1, addHeapObject(arg2));
|
|
13683
14720
|
}
|
|
13684
14721
|
|
|
13685
|
-
function
|
|
13686
|
-
wasm.
|
|
14722
|
+
function __wasm_bindgen_func_elem_1529_2(arg0, arg1, arg2) {
|
|
14723
|
+
wasm.__wasm_bindgen_func_elem_1529_2(arg0, arg1, addHeapObject(arg2));
|
|
13687
14724
|
}
|
|
13688
14725
|
|
|
13689
|
-
function
|
|
14726
|
+
function __wasm_bindgen_func_elem_7057(arg0, arg1, arg2) {
|
|
13690
14727
|
try {
|
|
13691
14728
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
13692
|
-
wasm.
|
|
14729
|
+
wasm.__wasm_bindgen_func_elem_7057(retptr, arg0, arg1, addHeapObject(arg2));
|
|
13693
14730
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
13694
14731
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
13695
14732
|
if (r1) {
|
|
@@ -13700,8 +14737,8 @@ function __wasm_bindgen_func_elem_6940(arg0, arg1, arg2) {
|
|
|
13700
14737
|
}
|
|
13701
14738
|
}
|
|
13702
14739
|
|
|
13703
|
-
function
|
|
13704
|
-
wasm.
|
|
14740
|
+
function __wasm_bindgen_func_elem_7051(arg0, arg1, arg2, arg3) {
|
|
14741
|
+
wasm.__wasm_bindgen_func_elem_7051(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
13705
14742
|
}
|
|
13706
14743
|
|
|
13707
14744
|
|
|
@@ -13811,6 +14848,9 @@ const ProgramFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
13811
14848
|
const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
13812
14849
|
? { register: () => {}, unregister: () => {} }
|
|
13813
14850
|
: new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0, 1));
|
|
14851
|
+
const ProofFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
14852
|
+
? { register: () => {}, unregister: () => {} }
|
|
14853
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_proof_free(ptr >>> 0, 1));
|
|
13814
14854
|
const ProvingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
13815
14855
|
? { register: () => {}, unregister: () => {} }
|
|
13816
14856
|
: new FinalizationRegistry(ptr => wasm.__wbg_provingkey_free(ptr >>> 0, 1));
|
|
@@ -13850,6 +14890,9 @@ const U64Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
13850
14890
|
const U8Finalization = (typeof FinalizationRegistry === 'undefined')
|
|
13851
14891
|
? { register: () => {}, unregister: () => {} }
|
|
13852
14892
|
: new FinalizationRegistry(ptr => wasm.__wbg_u8_free(ptr >>> 0, 1));
|
|
14893
|
+
const ValueFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
14894
|
+
? { register: () => {}, unregister: () => {} }
|
|
14895
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_value_free(ptr >>> 0, 1));
|
|
13853
14896
|
const VerifyingKeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
13854
14897
|
? { register: () => {}, unregister: () => {} }
|
|
13855
14898
|
: new FinalizationRegistry(ptr => wasm.__wbg_verifyingkey_free(ptr >>> 0, 1));
|
|
@@ -14235,5 +15278,5 @@ async function initThreadPool(threads) {
|
|
|
14235
15278
|
await initThreadPool$1(new URL("worker.js", import.meta.url), threads);
|
|
14236
15279
|
}
|
|
14237
15280
|
|
|
14238
|
-
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, I128, I16, I32, I64, I8, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, VerifyingKey, ViewKey, getOrInitConsensusVersionTestHeights, initSync, initThreadPool, runRayonThread, verifyFunctionExecution };
|
|
15281
|
+
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, I128, I16, I32, I64, I8, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, Proof, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, Value, VerifyingKey, ViewKey, getOrInitConsensusVersionTestHeights, initSync, initThreadPool, runRayonThread, snarkVerify, snarkVerifyBatch, stringToField, verifyFunctionExecution };
|
|
14239
15282
|
//# sourceMappingURL=index.js.map
|