@provablehq/wasm 0.10.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mainnet/aleo_wasm.d.ts +329 -60
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +860 -130
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +859 -131
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +860 -130
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +328 -59
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +850 -120
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +849 -121
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +850 -120
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/mainnet/index.cjs
CHANGED
|
@@ -292,6 +292,17 @@ function runRayonThread(receiver) {
|
|
|
292
292
|
wasm$1.runRayonThread(receiver);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
297
|
+
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
298
|
+
* Levels: 0=silent, 1=error, 2=warn, 3=info (default), 4=debug.
|
|
299
|
+
* Values above 4 are clamped to debug.
|
|
300
|
+
* @param {number} level
|
|
301
|
+
*/
|
|
302
|
+
function setWasmLogLevel(level) {
|
|
303
|
+
wasm$1.setWasmLogLevel(level);
|
|
304
|
+
}
|
|
305
|
+
|
|
295
306
|
/**
|
|
296
307
|
* @param {URL} url
|
|
297
308
|
* @param {number} num_threads
|
|
@@ -309,39 +320,6 @@ function addBorrowedObject(obj) {
|
|
|
309
320
|
heap[--stack_pointer] = obj;
|
|
310
321
|
return stack_pointer;
|
|
311
322
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Verify a SNARK proof against a verifying key and public inputs.
|
|
314
|
-
*
|
|
315
|
-
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
316
|
-
* It directly invokes the Varuna proof verification from snarkVM.
|
|
317
|
-
*
|
|
318
|
-
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
319
|
-
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
320
|
-
* @param {Proof} proof The proof to verify
|
|
321
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
322
|
-
* @param {VerifyingKey} verifying_key
|
|
323
|
-
* @param {Array<any>} inputs
|
|
324
|
-
* @param {Proof} proof
|
|
325
|
-
* @returns {boolean}
|
|
326
|
-
*/
|
|
327
|
-
function snarkVerify(verifying_key, inputs, proof) {
|
|
328
|
-
try {
|
|
329
|
-
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
330
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
331
|
-
_assertClass(proof, Proof);
|
|
332
|
-
wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
333
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
334
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
335
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
336
|
-
if (r2) {
|
|
337
|
-
throw takeObject(r1);
|
|
338
|
-
}
|
|
339
|
-
return r0 !== 0;
|
|
340
|
-
} finally {
|
|
341
|
-
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
323
|
/**
|
|
346
324
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
347
325
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -361,9 +339,10 @@ function snarkVerify(verifying_key, inputs, proof) {
|
|
|
361
339
|
* @param {object | null | undefined} imports
|
|
362
340
|
* @param {object | null | undefined} imported_verifying_keys
|
|
363
341
|
* @param {number} block_height
|
|
342
|
+
* @param {ProgramImports | null} [program_imports]
|
|
364
343
|
* @returns {boolean}
|
|
365
344
|
*/
|
|
366
|
-
function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height) {
|
|
345
|
+
function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height, program_imports) {
|
|
367
346
|
try {
|
|
368
347
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
369
348
|
_assertClass(execution, Execution);
|
|
@@ -371,7 +350,12 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
371
350
|
_assertClass(program, Program);
|
|
372
351
|
const ptr0 = passStringToWasm0(function_id, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
373
352
|
const len0 = WASM_VECTOR_LEN;
|
|
374
|
-
|
|
353
|
+
let ptr1 = 0;
|
|
354
|
+
if (!isLikeNone(program_imports)) {
|
|
355
|
+
_assertClass(program_imports, ProgramImports);
|
|
356
|
+
ptr1 = program_imports.__destroy_into_raw();
|
|
357
|
+
}
|
|
358
|
+
wasm$1.verifyFunctionExecution(retptr, execution.__wbg_ptr, verifying_key.__wbg_ptr, program.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(imported_verifying_keys) ? 0 : addHeapObject(imported_verifying_keys), block_height, ptr1);
|
|
375
359
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
376
360
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
377
361
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -385,25 +369,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
385
369
|
}
|
|
386
370
|
|
|
387
371
|
/**
|
|
388
|
-
* Verify a
|
|
372
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
389
373
|
*
|
|
390
|
-
* This function verifies a
|
|
391
|
-
*
|
|
374
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
375
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
392
376
|
*
|
|
393
|
-
* @param {
|
|
394
|
-
* @param {Array<
|
|
395
|
-
* @param {Proof} proof The
|
|
396
|
-
* @returns {boolean} True if the
|
|
397
|
-
* @param {
|
|
377
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
378
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
379
|
+
* @param {Proof} proof The proof to verify
|
|
380
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
381
|
+
* @param {VerifyingKey} verifying_key
|
|
398
382
|
* @param {Array<any>} inputs
|
|
399
383
|
* @param {Proof} proof
|
|
400
384
|
* @returns {boolean}
|
|
401
385
|
*/
|
|
402
|
-
function
|
|
386
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
403
387
|
try {
|
|
404
388
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
389
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
405
390
|
_assertClass(proof, Proof);
|
|
406
|
-
wasm$1.
|
|
391
|
+
wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
407
392
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
408
393
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
409
394
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -417,22 +402,32 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
417
402
|
}
|
|
418
403
|
|
|
419
404
|
/**
|
|
420
|
-
*
|
|
421
|
-
*
|
|
405
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
406
|
+
*
|
|
407
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
408
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
409
|
+
*
|
|
410
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
411
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
412
|
+
* @param {Proof} proof The batch proof to verify
|
|
413
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
414
|
+
* @param {Array<any>} verifying_keys
|
|
415
|
+
* @param {Array<any>} inputs
|
|
416
|
+
* @param {Proof} proof
|
|
417
|
+
* @returns {boolean}
|
|
422
418
|
*/
|
|
423
|
-
function
|
|
419
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
424
420
|
try {
|
|
425
421
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
wasm$1.stringToField(retptr, ptr0, len0);
|
|
422
|
+
_assertClass(proof, Proof);
|
|
423
|
+
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
429
424
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
430
425
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
431
426
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
432
427
|
if (r2) {
|
|
433
428
|
throw takeObject(r1);
|
|
434
429
|
}
|
|
435
|
-
return
|
|
430
|
+
return r0 !== 0;
|
|
436
431
|
} finally {
|
|
437
432
|
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
438
433
|
}
|
|
@@ -458,6 +453,28 @@ function getOrInitConsensusVersionTestHeights(heights) {
|
|
|
458
453
|
return takeObject(ret);
|
|
459
454
|
}
|
|
460
455
|
|
|
456
|
+
/**
|
|
457
|
+
* @param {string} string
|
|
458
|
+
* @returns {Field}
|
|
459
|
+
*/
|
|
460
|
+
function stringToField(string) {
|
|
461
|
+
try {
|
|
462
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
463
|
+
const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
464
|
+
const len0 = WASM_VECTOR_LEN;
|
|
465
|
+
wasm$1.stringToField(retptr, ptr0, len0);
|
|
466
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
467
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
468
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
469
|
+
if (r2) {
|
|
470
|
+
throw takeObject(r1);
|
|
471
|
+
}
|
|
472
|
+
return Field.__wrap(r0);
|
|
473
|
+
} finally {
|
|
474
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
461
478
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
462
479
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
463
480
|
const mem = getDataViewMemory0();
|
|
@@ -477,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
477
494
|
}
|
|
478
495
|
return result;
|
|
479
496
|
}
|
|
480
|
-
function
|
|
481
|
-
wasm$1.
|
|
497
|
+
function __wasm_bindgen_func_elem_7287(arg0, arg1) {
|
|
498
|
+
wasm$1.__wasm_bindgen_func_elem_7287(arg0, arg1);
|
|
482
499
|
}
|
|
483
500
|
|
|
484
|
-
function
|
|
485
|
-
wasm$1.
|
|
501
|
+
function __wasm_bindgen_func_elem_8655(arg0, arg1, arg2) {
|
|
502
|
+
wasm$1.__wasm_bindgen_func_elem_8655(arg0, arg1, addHeapObject(arg2));
|
|
486
503
|
}
|
|
487
504
|
|
|
488
|
-
function
|
|
489
|
-
wasm$1.
|
|
505
|
+
function __wasm_bindgen_func_elem_7560(arg0, arg1, arg2, arg3) {
|
|
506
|
+
wasm$1.__wasm_bindgen_func_elem_7560(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
490
507
|
}
|
|
491
508
|
|
|
492
509
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -10003,6 +10020,36 @@ class Program {
|
|
|
10003
10020
|
const ret = wasm$1.program_getFunctions(this.__wbg_ptr);
|
|
10004
10021
|
return takeObject(ret);
|
|
10005
10022
|
}
|
|
10023
|
+
/**
|
|
10024
|
+
* Get the external call graph reachable from a specific entry function.
|
|
10025
|
+
*
|
|
10026
|
+
* Starting from `entry_function`, traces all reachable functions and closures
|
|
10027
|
+
* within this program (via local calls) and collects external calls
|
|
10028
|
+
* (`call program.aleo/function`). Returns a JS object mapping program names
|
|
10029
|
+
* to arrays of called function names.
|
|
10030
|
+
*
|
|
10031
|
+
* @param {string} entry_function The name of the entry function to trace from
|
|
10032
|
+
* @returns {object} An object like `{ "program.aleo": ["fn1", "fn2"] }`
|
|
10033
|
+
* @param {string} entry_function
|
|
10034
|
+
* @returns {any}
|
|
10035
|
+
*/
|
|
10036
|
+
getCallGraph(entry_function) {
|
|
10037
|
+
try {
|
|
10038
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10039
|
+
const ptr0 = passStringToWasm0(entry_function, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10040
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10041
|
+
wasm$1.program_getCallGraph(retptr, this.__wbg_ptr, ptr0, len0);
|
|
10042
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10043
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10044
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
10045
|
+
if (r2) {
|
|
10046
|
+
throw takeObject(r1);
|
|
10047
|
+
}
|
|
10048
|
+
return takeObject(r0);
|
|
10049
|
+
} finally {
|
|
10050
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10051
|
+
}
|
|
10052
|
+
}
|
|
10006
10053
|
/**
|
|
10007
10054
|
* Get a javascript object representation of a program record and its types
|
|
10008
10055
|
*
|
|
@@ -10266,6 +10313,436 @@ class Program {
|
|
|
10266
10313
|
}
|
|
10267
10314
|
if (Symbol.dispose) Program.prototype[Symbol.dispose] = Program.prototype.free;
|
|
10268
10315
|
|
|
10316
|
+
const ProgramImportsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
10317
|
+
? { register: () => {}, unregister: () => {} }
|
|
10318
|
+
: new FinalizationRegistry(ptr => wasm$1.__wbg_programimports_free(ptr >>> 0, 1));
|
|
10319
|
+
/**
|
|
10320
|
+
* Backed by `Rc<RefCell<>>` for interior mutability — cloning produces a cheap
|
|
10321
|
+
* reference-counted copy that shares the same underlying data. This allows
|
|
10322
|
+
* execution functions to clone the builder internally while the caller's
|
|
10323
|
+
* original reference automatically sees any mutations (e.g. synthesized keys).
|
|
10324
|
+
*/
|
|
10325
|
+
class ProgramImports {
|
|
10326
|
+
|
|
10327
|
+
static __wrap(ptr) {
|
|
10328
|
+
ptr = ptr >>> 0;
|
|
10329
|
+
const obj = Object.create(ProgramImports.prototype);
|
|
10330
|
+
obj.__wbg_ptr = ptr;
|
|
10331
|
+
ProgramImportsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
10332
|
+
return obj;
|
|
10333
|
+
}
|
|
10334
|
+
|
|
10335
|
+
__destroy_into_raw() {
|
|
10336
|
+
const ptr = this.__wbg_ptr;
|
|
10337
|
+
this.__wbg_ptr = 0;
|
|
10338
|
+
ProgramImportsFinalization.unregister(this);
|
|
10339
|
+
return ptr;
|
|
10340
|
+
}
|
|
10341
|
+
|
|
10342
|
+
free() {
|
|
10343
|
+
const ptr = this.__destroy_into_raw();
|
|
10344
|
+
wasm$1.__wbg_programimports_free(ptr, 0);
|
|
10345
|
+
}
|
|
10346
|
+
/**
|
|
10347
|
+
* Add a program's source code to the imports.
|
|
10348
|
+
*
|
|
10349
|
+
* The source is parsed, validated, and added to the internal Process.
|
|
10350
|
+
* Static imports of the program are resolved depth-first from programs
|
|
10351
|
+
* already present in this builder.
|
|
10352
|
+
*
|
|
10353
|
+
* @param {string} name The program name (e.g., "my_program.aleo").
|
|
10354
|
+
* @param {string} source The program source code.
|
|
10355
|
+
* @param {number | undefined} edition The program edition (defaults to 1).
|
|
10356
|
+
* @param {string} name
|
|
10357
|
+
* @param {string} source
|
|
10358
|
+
* @param {number | null} [edition]
|
|
10359
|
+
*/
|
|
10360
|
+
addProgram(name, source, edition) {
|
|
10361
|
+
try {
|
|
10362
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10363
|
+
const ptr0 = passStringToWasm0(name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10364
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10365
|
+
const ptr1 = passStringToWasm0(source, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10366
|
+
const len1 = WASM_VECTOR_LEN;
|
|
10367
|
+
wasm$1.programimports_addProgram(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(edition) ? 0xFFFFFF : edition);
|
|
10368
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10369
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10370
|
+
if (r1) {
|
|
10371
|
+
throw takeObject(r0);
|
|
10372
|
+
}
|
|
10373
|
+
} finally {
|
|
10374
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10377
|
+
/**
|
|
10378
|
+
* Create a ProgramImports from a plain JavaScript object.
|
|
10379
|
+
*
|
|
10380
|
+
* Accepts three formats:
|
|
10381
|
+
* ```js
|
|
10382
|
+
* // 1. Plain string — source code only.
|
|
10383
|
+
* { "my_program.aleo": "program source..." }
|
|
10384
|
+
*
|
|
10385
|
+
* // 2. Structured — program source with optional edition.
|
|
10386
|
+
* { "my_program.aleo": { program: "program source..." } }
|
|
10387
|
+
*
|
|
10388
|
+
* // 3. Structured with keys — program source plus proving/verifying keys per function.
|
|
10389
|
+
* {
|
|
10390
|
+
* "my_program.aleo": {
|
|
10391
|
+
* program: "program source...",
|
|
10392
|
+
* keys: {
|
|
10393
|
+
* "my_function": {
|
|
10394
|
+
* provingKey: Uint8Array,
|
|
10395
|
+
* verifyingKey: Uint8Array
|
|
10396
|
+
* }
|
|
10397
|
+
* }
|
|
10398
|
+
* }
|
|
10399
|
+
* }
|
|
10400
|
+
* ```
|
|
10401
|
+
*
|
|
10402
|
+
* Programs created via this method default to edition 1.
|
|
10403
|
+
*
|
|
10404
|
+
* @param {Object} object A plain JavaScript object mapping program names to source code
|
|
10405
|
+
* and optional keys.
|
|
10406
|
+
* @returns {ProgramImports}
|
|
10407
|
+
* @param {object} object
|
|
10408
|
+
* @returns {ProgramImports}
|
|
10409
|
+
*/
|
|
10410
|
+
static fromObject(object) {
|
|
10411
|
+
try {
|
|
10412
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10413
|
+
wasm$1.programimports_fromObject(retptr, addHeapObject(object));
|
|
10414
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10415
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10416
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
10417
|
+
if (r2) {
|
|
10418
|
+
throw takeObject(r1);
|
|
10419
|
+
}
|
|
10420
|
+
return ProgramImports.__wrap(r0);
|
|
10421
|
+
} finally {
|
|
10422
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10423
|
+
}
|
|
10424
|
+
}
|
|
10425
|
+
/**
|
|
10426
|
+
* Return the source code of a program by name, without serializing keys.
|
|
10427
|
+
*
|
|
10428
|
+
* @param {string} name The program name (e.g., "my_program.aleo").
|
|
10429
|
+
* @returns {string | undefined}
|
|
10430
|
+
* @param {string} name
|
|
10431
|
+
* @returns {string | undefined}
|
|
10432
|
+
*/
|
|
10433
|
+
getProgram(name) {
|
|
10434
|
+
try {
|
|
10435
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10436
|
+
const ptr0 = passStringToWasm0(name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10437
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10438
|
+
wasm$1.programimports_getProgram(retptr, this.__wbg_ptr, ptr0, len0);
|
|
10439
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10440
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10441
|
+
let v2;
|
|
10442
|
+
if (r0 !== 0) {
|
|
10443
|
+
v2 = getStringFromWasm0(r0, r1).slice();
|
|
10444
|
+
wasm$1.__wbindgen_export4(r0, r1 * 1, 1);
|
|
10445
|
+
}
|
|
10446
|
+
return v2;
|
|
10447
|
+
} finally {
|
|
10448
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10449
|
+
}
|
|
10450
|
+
}
|
|
10451
|
+
/**
|
|
10452
|
+
* Return the names of all programs in this builder as a JS `Array<string>`.
|
|
10453
|
+
*
|
|
10454
|
+
* This is a lightweight alternative to `toObject()` when you only need to
|
|
10455
|
+
* enumerate program names without serializing keys.
|
|
10456
|
+
*
|
|
10457
|
+
* @returns {Array<string>}
|
|
10458
|
+
* @returns {Array<any>}
|
|
10459
|
+
*/
|
|
10460
|
+
programNames() {
|
|
10461
|
+
const ret = wasm$1.programimports_programNames(this.__wbg_ptr);
|
|
10462
|
+
return takeObject(ret);
|
|
10463
|
+
}
|
|
10464
|
+
/**
|
|
10465
|
+
* Add a proving key for a function or record within an imported program.
|
|
10466
|
+
*
|
|
10467
|
+
* The key is transferred directly from the WASM `ProvingKey` type with no
|
|
10468
|
+
* serialization overhead.
|
|
10469
|
+
*
|
|
10470
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
10471
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
10472
|
+
* @param {ProvingKey} key The proving key.
|
|
10473
|
+
* @param {string} program_name
|
|
10474
|
+
* @param {string} identifier
|
|
10475
|
+
* @param {ProvingKey} key
|
|
10476
|
+
*/
|
|
10477
|
+
addProvingKey(program_name, identifier, key) {
|
|
10478
|
+
try {
|
|
10479
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10480
|
+
const ptr0 = passStringToWasm0(program_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10481
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10482
|
+
const ptr1 = passStringToWasm0(identifier, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10483
|
+
const len1 = WASM_VECTOR_LEN;
|
|
10484
|
+
_assertClass(key, ProvingKey);
|
|
10485
|
+
var ptr2 = key.__destroy_into_raw();
|
|
10486
|
+
wasm$1.programimports_addProvingKey(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2);
|
|
10487
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10488
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10489
|
+
if (r1) {
|
|
10490
|
+
throw takeObject(r0);
|
|
10491
|
+
}
|
|
10492
|
+
} finally {
|
|
10493
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10494
|
+
}
|
|
10495
|
+
}
|
|
10496
|
+
/**
|
|
10497
|
+
* Get a proving key for a specific program and identifier (function or record name).
|
|
10498
|
+
* Returns a clone of the key from the internal Process. Non-destructive — the key
|
|
10499
|
+
* remains available for future calls.
|
|
10500
|
+
*
|
|
10501
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
10502
|
+
* @param {string} identifier The function or record name.
|
|
10503
|
+
* @returns {ProvingKey | undefined}
|
|
10504
|
+
* @param {string} program_name
|
|
10505
|
+
* @param {string} identifier
|
|
10506
|
+
* @returns {ProvingKey | undefined}
|
|
10507
|
+
*/
|
|
10508
|
+
getProvingKey(program_name, identifier) {
|
|
10509
|
+
const ptr0 = passStringToWasm0(program_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10510
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10511
|
+
const ptr1 = passStringToWasm0(identifier, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10512
|
+
const len1 = WASM_VECTOR_LEN;
|
|
10513
|
+
const ret = wasm$1.programimports_getProvingKey(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
10514
|
+
return ret === 0 ? undefined : ProvingKey.__wrap(ret);
|
|
10515
|
+
}
|
|
10516
|
+
/**
|
|
10517
|
+
* Add a verifying key for a function or record within an imported program.
|
|
10518
|
+
*
|
|
10519
|
+
* The key is transferred directly from the WASM `VerifyingKey` type with no
|
|
10520
|
+
* serialization overhead.
|
|
10521
|
+
*
|
|
10522
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
10523
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
10524
|
+
* @param {VerifyingKey} key The verifying key.
|
|
10525
|
+
* @param {string} program_name
|
|
10526
|
+
* @param {string} identifier
|
|
10527
|
+
* @param {VerifyingKey} key
|
|
10528
|
+
*/
|
|
10529
|
+
addVerifyingKey(program_name, identifier, key) {
|
|
10530
|
+
try {
|
|
10531
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10532
|
+
const ptr0 = passStringToWasm0(program_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10533
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10534
|
+
const ptr1 = passStringToWasm0(identifier, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10535
|
+
const len1 = WASM_VECTOR_LEN;
|
|
10536
|
+
_assertClass(key, VerifyingKey);
|
|
10537
|
+
var ptr2 = key.__destroy_into_raw();
|
|
10538
|
+
wasm$1.programimports_addVerifyingKey(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2);
|
|
10539
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10540
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10541
|
+
if (r1) {
|
|
10542
|
+
throw takeObject(r0);
|
|
10543
|
+
}
|
|
10544
|
+
} finally {
|
|
10545
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10546
|
+
}
|
|
10547
|
+
}
|
|
10548
|
+
/**
|
|
10549
|
+
* Get a verifying key for a specific program and identifier (function or record name).
|
|
10550
|
+
* Returns a clone of the key from the internal Process. Non-destructive — the key
|
|
10551
|
+
* remains available for future calls.
|
|
10552
|
+
*
|
|
10553
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
10554
|
+
* @param {string} identifier The function or record name.
|
|
10555
|
+
* @returns {VerifyingKey | undefined}
|
|
10556
|
+
* @param {string} program_name
|
|
10557
|
+
* @param {string} identifier
|
|
10558
|
+
* @returns {VerifyingKey | undefined}
|
|
10559
|
+
*/
|
|
10560
|
+
getVerifyingKey(program_name, identifier) {
|
|
10561
|
+
const ptr0 = passStringToWasm0(program_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10562
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10563
|
+
const ptr1 = passStringToWasm0(identifier, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10564
|
+
const len1 = WASM_VECTOR_LEN;
|
|
10565
|
+
const ret = wasm$1.programimports_getVerifyingKey(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
10566
|
+
return ret === 0 ? undefined : VerifyingKey.__wrap(ret);
|
|
10567
|
+
}
|
|
10568
|
+
/**
|
|
10569
|
+
* Add a proving key from its byte representation.
|
|
10570
|
+
*
|
|
10571
|
+
* Deserializes the bytes into a native proving key and stores it. The program
|
|
10572
|
+
* must already have been added via `addProgram`.
|
|
10573
|
+
*
|
|
10574
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
10575
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
10576
|
+
* @param {Uint8Array} bytes The proving key bytes.
|
|
10577
|
+
* @param {string} program_name
|
|
10578
|
+
* @param {string} identifier
|
|
10579
|
+
* @param {Uint8Array} bytes
|
|
10580
|
+
*/
|
|
10581
|
+
addProvingKeyBytes(program_name, identifier, bytes) {
|
|
10582
|
+
try {
|
|
10583
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10584
|
+
const ptr0 = passStringToWasm0(program_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10585
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10586
|
+
const ptr1 = passStringToWasm0(identifier, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10587
|
+
const len1 = WASM_VECTOR_LEN;
|
|
10588
|
+
const ptr2 = passArray8ToWasm0(bytes, wasm$1.__wbindgen_export);
|
|
10589
|
+
const len2 = WASM_VECTOR_LEN;
|
|
10590
|
+
wasm$1.programimports_addProvingKeyBytes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
10591
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10592
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10593
|
+
if (r1) {
|
|
10594
|
+
throw takeObject(r0);
|
|
10595
|
+
}
|
|
10596
|
+
} finally {
|
|
10597
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10598
|
+
}
|
|
10599
|
+
}
|
|
10600
|
+
/**
|
|
10601
|
+
* Add a verifying key from its byte representation.
|
|
10602
|
+
*
|
|
10603
|
+
* Deserializes the bytes into a native verifying key and stores it. The program
|
|
10604
|
+
* must already have been added via `addProgram`.
|
|
10605
|
+
*
|
|
10606
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
10607
|
+
* @param {string} identifier The function name or record name the key belongs to.
|
|
10608
|
+
* @param {Uint8Array} bytes The verifying key bytes.
|
|
10609
|
+
* @param {string} program_name
|
|
10610
|
+
* @param {string} identifier
|
|
10611
|
+
* @param {Uint8Array} bytes
|
|
10612
|
+
*/
|
|
10613
|
+
addVerifyingKeyBytes(program_name, identifier, bytes) {
|
|
10614
|
+
try {
|
|
10615
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10616
|
+
const ptr0 = passStringToWasm0(program_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10617
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10618
|
+
const ptr1 = passStringToWasm0(identifier, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10619
|
+
const len1 = WASM_VECTOR_LEN;
|
|
10620
|
+
const ptr2 = passArray8ToWasm0(bytes, wasm$1.__wbindgen_export);
|
|
10621
|
+
const len2 = WASM_VECTOR_LEN;
|
|
10622
|
+
wasm$1.programimports_addVerifyingKeyBytes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
10623
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10624
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10625
|
+
if (r1) {
|
|
10626
|
+
throw takeObject(r0);
|
|
10627
|
+
}
|
|
10628
|
+
} finally {
|
|
10629
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10630
|
+
}
|
|
10631
|
+
}
|
|
10632
|
+
/**
|
|
10633
|
+
* Return the names of functions that have both a proving key and a verifying key
|
|
10634
|
+
* stored for the given program.
|
|
10635
|
+
*
|
|
10636
|
+
* @param {string} program_name The program name (e.g., "my_program.aleo").
|
|
10637
|
+
* @returns {Array<string>}
|
|
10638
|
+
* @param {string} program_name
|
|
10639
|
+
* @returns {Array<any>}
|
|
10640
|
+
*/
|
|
10641
|
+
functionKeysAvailable(program_name) {
|
|
10642
|
+
try {
|
|
10643
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10644
|
+
const ptr0 = passStringToWasm0(program_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10645
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10646
|
+
wasm$1.programimports_functionKeysAvailable(retptr, this.__wbg_ptr, ptr0, len0);
|
|
10647
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10648
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10649
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
10650
|
+
if (r2) {
|
|
10651
|
+
throw takeObject(r1);
|
|
10652
|
+
}
|
|
10653
|
+
return takeObject(r0);
|
|
10654
|
+
} finally {
|
|
10655
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10656
|
+
}
|
|
10657
|
+
}
|
|
10658
|
+
/**
|
|
10659
|
+
* Create a new empty ProgramImports builder.
|
|
10660
|
+
*
|
|
10661
|
+
* Initializes an internal snarkVM Process. This is the same cost as a
|
|
10662
|
+
* single execution call, but is paid once and reused across all operations.
|
|
10663
|
+
*/
|
|
10664
|
+
constructor() {
|
|
10665
|
+
try {
|
|
10666
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10667
|
+
wasm$1.programimports_new(retptr);
|
|
10668
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
10669
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
10670
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
10671
|
+
if (r2) {
|
|
10672
|
+
throw takeObject(r1);
|
|
10673
|
+
}
|
|
10674
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
10675
|
+
ProgramImportsFinalization.register(this, this.__wbg_ptr, this);
|
|
10676
|
+
return this;
|
|
10677
|
+
} finally {
|
|
10678
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
10679
|
+
}
|
|
10680
|
+
}
|
|
10681
|
+
/**
|
|
10682
|
+
* Create a cheap clone that shares the same underlying data.
|
|
10683
|
+
*
|
|
10684
|
+
* Useful for passing to WASM execution functions which consume ownership:
|
|
10685
|
+
* the caller keeps the original, and both copies see any mutations
|
|
10686
|
+
* (e.g. synthesized keys) through the shared interior state.
|
|
10687
|
+
* @returns {ProgramImports}
|
|
10688
|
+
*/
|
|
10689
|
+
clone() {
|
|
10690
|
+
const ret = wasm$1.programimports_clone(this.__wbg_ptr);
|
|
10691
|
+
return ProgramImports.__wrap(ret);
|
|
10692
|
+
}
|
|
10693
|
+
/**
|
|
10694
|
+
* Check whether a specific program has been added.
|
|
10695
|
+
*
|
|
10696
|
+
* @param {string} name The program name.
|
|
10697
|
+
* @returns {boolean}
|
|
10698
|
+
* @param {string} name
|
|
10699
|
+
* @returns {boolean}
|
|
10700
|
+
*/
|
|
10701
|
+
contains(name) {
|
|
10702
|
+
const ptr0 = passStringToWasm0(name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10703
|
+
const len0 = WASM_VECTOR_LEN;
|
|
10704
|
+
const ret = wasm$1.programimports_contains(this.__wbg_ptr, ptr0, len0);
|
|
10705
|
+
return ret !== 0;
|
|
10706
|
+
}
|
|
10707
|
+
/**
|
|
10708
|
+
* Check whether any programs have been added to this builder.
|
|
10709
|
+
*
|
|
10710
|
+
* @returns {boolean}
|
|
10711
|
+
* @returns {boolean}
|
|
10712
|
+
*/
|
|
10713
|
+
isEmpty() {
|
|
10714
|
+
const ret = wasm$1.programimports_isEmpty(this.__wbg_ptr);
|
|
10715
|
+
return ret !== 0;
|
|
10716
|
+
}
|
|
10717
|
+
/**
|
|
10718
|
+
* Convert this ProgramImports to a plain JavaScript object.
|
|
10719
|
+
*
|
|
10720
|
+
* Entries without keys use the simple `{ "name.aleo": "source" }` format.
|
|
10721
|
+
* Entries with keys use the structured format:
|
|
10722
|
+
* ```js
|
|
10723
|
+
* {
|
|
10724
|
+
* "name.aleo": {
|
|
10725
|
+
* program: "program source...",
|
|
10726
|
+
* keys: {
|
|
10727
|
+
* "function_name": {
|
|
10728
|
+
* provingKey: Uint8Array,
|
|
10729
|
+
* verifyingKey: Uint8Array
|
|
10730
|
+
* }
|
|
10731
|
+
* }
|
|
10732
|
+
* }
|
|
10733
|
+
* }
|
|
10734
|
+
* ```
|
|
10735
|
+
*
|
|
10736
|
+
* @returns {Object}
|
|
10737
|
+
* @returns {object}
|
|
10738
|
+
*/
|
|
10739
|
+
toObject() {
|
|
10740
|
+
const ret = wasm$1.programimports_toObject(this.__wbg_ptr);
|
|
10741
|
+
return takeObject(ret);
|
|
10742
|
+
}
|
|
10743
|
+
}
|
|
10744
|
+
if (Symbol.dispose) ProgramImports.prototype[Symbol.dispose] = ProgramImports.prototype.free;
|
|
10745
|
+
|
|
10269
10746
|
const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
10270
10747
|
? { register: () => {}, unregister: () => {} }
|
|
10271
10748
|
: new FinalizationRegistry(ptr => wasm$1.__wbg_programmanager_free(ptr >>> 0, 1));
|
|
@@ -10296,15 +10773,21 @@ class ProgramManager {
|
|
|
10296
10773
|
* @param {Array<any>} inputs
|
|
10297
10774
|
* @param {object | null} [imports]
|
|
10298
10775
|
* @param {number | null} [edition]
|
|
10776
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10299
10777
|
* @returns {Promise<KeyPair>}
|
|
10300
10778
|
*/
|
|
10301
|
-
static synthesizeKeyPair(private_key, program, function_id, inputs, imports, edition) {
|
|
10779
|
+
static synthesizeKeyPair(private_key, program, function_id, inputs, imports, edition, program_imports) {
|
|
10302
10780
|
_assertClass(private_key, PrivateKey);
|
|
10303
10781
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10304
10782
|
const len0 = WASM_VECTOR_LEN;
|
|
10305
10783
|
const ptr1 = passStringToWasm0(function_id, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10306
10784
|
const len1 = WASM_VECTOR_LEN;
|
|
10307
|
-
|
|
10785
|
+
let ptr2 = 0;
|
|
10786
|
+
if (!isLikeNone(program_imports)) {
|
|
10787
|
+
_assertClass(program_imports, ProgramImports);
|
|
10788
|
+
ptr2 = program_imports.__destroy_into_raw();
|
|
10789
|
+
}
|
|
10790
|
+
const ret = wasm$1.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
|
|
10308
10791
|
return takeObject(ret);
|
|
10309
10792
|
}
|
|
10310
10793
|
/**
|
|
@@ -10343,9 +10826,10 @@ class ProgramManager {
|
|
|
10343
10826
|
* @param {boolean} unchecked
|
|
10344
10827
|
* @param {number | null | undefined} edition
|
|
10345
10828
|
* @param {boolean} use_fee_master
|
|
10829
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10346
10830
|
* @returns {Promise<ProvingRequest>}
|
|
10347
10831
|
*/
|
|
10348
|
-
static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked, edition, use_fee_master) {
|
|
10832
|
+
static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked, edition, use_fee_master, program_imports) {
|
|
10349
10833
|
_assertClass(private_key, PrivateKey);
|
|
10350
10834
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10351
10835
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10356,7 +10840,12 @@ class ProgramManager {
|
|
|
10356
10840
|
_assertClass(fee_record, RecordPlaintext);
|
|
10357
10841
|
ptr2 = fee_record.__destroy_into_raw();
|
|
10358
10842
|
}
|
|
10359
|
-
|
|
10843
|
+
let ptr3 = 0;
|
|
10844
|
+
if (!isLikeNone(program_imports)) {
|
|
10845
|
+
_assertClass(program_imports, ProgramImports);
|
|
10846
|
+
ptr3 = program_imports.__destroy_into_raw();
|
|
10847
|
+
}
|
|
10848
|
+
const ret = wasm$1.programmanager_buildProvingRequest(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), base_fee_credits, priority_fee_credits, ptr2, isLikeNone(imports) ? 0 : addHeapObject(imports), broadcast, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, use_fee_master, ptr3);
|
|
10360
10849
|
return takeObject(ret);
|
|
10361
10850
|
}
|
|
10362
10851
|
/**
|
|
@@ -10376,9 +10865,10 @@ class ProgramManager {
|
|
|
10376
10865
|
* @param {number | null} [edition]
|
|
10377
10866
|
* @param {object | null} [imports]
|
|
10378
10867
|
* @param {PrivateKey | null} [private_key]
|
|
10868
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10379
10869
|
* @returns {Promise<ProvingRequest>}
|
|
10380
10870
|
*/
|
|
10381
|
-
static buildProvingRequestFromExecutionRequest(request, program, unchecked, broadcast, edition, imports, private_key) {
|
|
10871
|
+
static buildProvingRequestFromExecutionRequest(request, program, unchecked, broadcast, edition, imports, private_key, program_imports) {
|
|
10382
10872
|
_assertClass(request, ExecutionRequest);
|
|
10383
10873
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10384
10874
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10387,7 +10877,12 @@ class ProgramManager {
|
|
|
10387
10877
|
_assertClass(private_key, PrivateKey);
|
|
10388
10878
|
ptr1 = private_key.__destroy_into_raw();
|
|
10389
10879
|
}
|
|
10390
|
-
|
|
10880
|
+
let ptr2 = 0;
|
|
10881
|
+
if (!isLikeNone(program_imports)) {
|
|
10882
|
+
_assertClass(program_imports, ProgramImports);
|
|
10883
|
+
ptr2 = program_imports.__destroy_into_raw();
|
|
10884
|
+
}
|
|
10885
|
+
const ret = wasm$1.programmanager_buildProvingRequestFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, broadcast, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1, ptr2);
|
|
10391
10886
|
return takeObject(ret);
|
|
10392
10887
|
}
|
|
10393
10888
|
/**
|
|
@@ -10528,9 +11023,10 @@ class ProgramManager {
|
|
|
10528
11023
|
* @param {RecordPlaintext | null} [fee_record]
|
|
10529
11024
|
* @param {string | null} [url]
|
|
10530
11025
|
* @param {object | null} [imports]
|
|
11026
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10531
11027
|
* @returns {Promise<Transaction>}
|
|
10532
11028
|
*/
|
|
10533
|
-
static buildDevnodeDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports) {
|
|
11029
|
+
static buildDevnodeDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, program_imports) {
|
|
10534
11030
|
_assertClass(private_key, PrivateKey);
|
|
10535
11031
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10536
11032
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10541,7 +11037,12 @@ class ProgramManager {
|
|
|
10541
11037
|
}
|
|
10542
11038
|
var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10543
11039
|
var len2 = WASM_VECTOR_LEN;
|
|
10544
|
-
|
|
11040
|
+
let ptr3 = 0;
|
|
11041
|
+
if (!isLikeNone(program_imports)) {
|
|
11042
|
+
_assertClass(program_imports, ProgramImports);
|
|
11043
|
+
ptr3 = program_imports.__destroy_into_raw();
|
|
11044
|
+
}
|
|
11045
|
+
const ret = wasm$1.programmanager_buildDevnodeDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3);
|
|
10545
11046
|
return takeObject(ret);
|
|
10546
11047
|
}
|
|
10547
11048
|
/**
|
|
@@ -10569,9 +11070,10 @@ class ProgramManager {
|
|
|
10569
11070
|
* @param {RecordPlaintext | null} [fee_record]
|
|
10570
11071
|
* @param {string | null} [url]
|
|
10571
11072
|
* @param {object | null} [imports]
|
|
11073
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10572
11074
|
* @returns {Promise<Transaction>}
|
|
10573
11075
|
*/
|
|
10574
|
-
static buildDevnodeUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports) {
|
|
11076
|
+
static buildDevnodeUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, program_imports) {
|
|
10575
11077
|
_assertClass(private_key, PrivateKey);
|
|
10576
11078
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10577
11079
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10582,7 +11084,12 @@ class ProgramManager {
|
|
|
10582
11084
|
}
|
|
10583
11085
|
var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10584
11086
|
var len2 = WASM_VECTOR_LEN;
|
|
10585
|
-
|
|
11087
|
+
let ptr3 = 0;
|
|
11088
|
+
if (!isLikeNone(program_imports)) {
|
|
11089
|
+
_assertClass(program_imports, ProgramImports);
|
|
11090
|
+
ptr3 = program_imports.__destroy_into_raw();
|
|
11091
|
+
}
|
|
11092
|
+
const ret = wasm$1.programmanager_buildDevnodeUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3);
|
|
10586
11093
|
return takeObject(ret);
|
|
10587
11094
|
}
|
|
10588
11095
|
/**
|
|
@@ -10626,12 +11133,18 @@ class ProgramManager {
|
|
|
10626
11133
|
* @returns {u64}
|
|
10627
11134
|
* @param {string} program
|
|
10628
11135
|
* @param {object | null} [imports]
|
|
11136
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10629
11137
|
* @returns {Promise<bigint>}
|
|
10630
11138
|
*/
|
|
10631
|
-
static estimateDeploymentFee(program, imports) {
|
|
11139
|
+
static estimateDeploymentFee(program, imports, program_imports) {
|
|
10632
11140
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10633
11141
|
const len0 = WASM_VECTOR_LEN;
|
|
10634
|
-
|
|
11142
|
+
let ptr1 = 0;
|
|
11143
|
+
if (!isLikeNone(program_imports)) {
|
|
11144
|
+
_assertClass(program_imports, ProgramImports);
|
|
11145
|
+
ptr1 = program_imports.__destroy_into_raw();
|
|
11146
|
+
}
|
|
11147
|
+
const ret = wasm$1.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
|
|
10635
11148
|
return takeObject(ret);
|
|
10636
11149
|
}
|
|
10637
11150
|
/**
|
|
@@ -10661,9 +11174,10 @@ class ProgramManager {
|
|
|
10661
11174
|
* @param {ProvingKey | null} [fee_proving_key]
|
|
10662
11175
|
* @param {VerifyingKey | null} [fee_verifying_key]
|
|
10663
11176
|
* @param {OfflineQuery | null} [offline_query]
|
|
11177
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10664
11178
|
* @returns {Promise<Transaction>}
|
|
10665
11179
|
*/
|
|
10666
|
-
static buildDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
|
|
11180
|
+
static buildDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query, program_imports) {
|
|
10667
11181
|
_assertClass(private_key, PrivateKey);
|
|
10668
11182
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10669
11183
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10689,7 +11203,12 @@ class ProgramManager {
|
|
|
10689
11203
|
_assertClass(offline_query, OfflineQuery);
|
|
10690
11204
|
ptr5 = offline_query.__destroy_into_raw();
|
|
10691
11205
|
}
|
|
10692
|
-
|
|
11206
|
+
let ptr6 = 0;
|
|
11207
|
+
if (!isLikeNone(program_imports)) {
|
|
11208
|
+
_assertClass(program_imports, ProgramImports);
|
|
11209
|
+
ptr6 = program_imports.__destroy_into_raw();
|
|
11210
|
+
}
|
|
11211
|
+
const ret = wasm$1.programmanager_buildDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5, ptr6);
|
|
10693
11212
|
return takeObject(ret);
|
|
10694
11213
|
}
|
|
10695
11214
|
/**
|
|
@@ -10717,9 +11236,10 @@ class ProgramManager {
|
|
|
10717
11236
|
* @param {ProvingKey | null} [fee_proving_key]
|
|
10718
11237
|
* @param {VerifyingKey | null} [fee_verifying_key]
|
|
10719
11238
|
* @param {OfflineQuery | null} [offline_query]
|
|
11239
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10720
11240
|
* @returns {Promise<Transaction>}
|
|
10721
11241
|
*/
|
|
10722
|
-
static buildUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
|
|
11242
|
+
static buildUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query, program_imports) {
|
|
10723
11243
|
_assertClass(private_key, PrivateKey);
|
|
10724
11244
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10725
11245
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10745,7 +11265,12 @@ class ProgramManager {
|
|
|
10745
11265
|
_assertClass(offline_query, OfflineQuery);
|
|
10746
11266
|
ptr5 = offline_query.__destroy_into_raw();
|
|
10747
11267
|
}
|
|
10748
|
-
|
|
11268
|
+
let ptr6 = 0;
|
|
11269
|
+
if (!isLikeNone(program_imports)) {
|
|
11270
|
+
_assertClass(program_imports, ProgramImports);
|
|
11271
|
+
ptr6 = program_imports.__destroy_into_raw();
|
|
11272
|
+
}
|
|
11273
|
+
const ret = wasm$1.programmanager_buildUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5, ptr6);
|
|
10749
11274
|
return takeObject(ret);
|
|
10750
11275
|
}
|
|
10751
11276
|
/**
|
|
@@ -10759,19 +11284,10 @@ class ProgramManager {
|
|
|
10759
11284
|
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
10760
11285
|
* @param fee_record The record to spend the fee from
|
|
10761
11286
|
* @param url The url of the Aleo network node to send the transaction to
|
|
10762
|
-
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
10763
|
-
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
10764
|
-
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
10765
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
10766
11287
|
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
10767
11288
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
10768
11289
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
10769
|
-
* @param
|
|
10770
|
-
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
10771
|
-
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
10772
|
-
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
10773
|
-
* @param offline_query An offline query object to use if building a transaction without an internet connection.
|
|
10774
|
-
* @param edition The edition of the program to execute. Defaults to the latest found on the network, or 1 if the program does not exist on the network.
|
|
11290
|
+
* @param edition The edition of the program to execute. Defaults to 1.
|
|
10775
11291
|
* @returns {Transaction}
|
|
10776
11292
|
* @param {PrivateKey} private_key
|
|
10777
11293
|
* @param {string} program
|
|
@@ -10782,9 +11298,10 @@ class ProgramManager {
|
|
|
10782
11298
|
* @param {string | null} [url]
|
|
10783
11299
|
* @param {object | null} [imports]
|
|
10784
11300
|
* @param {number | null} [edition]
|
|
11301
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10785
11302
|
* @returns {Promise<Transaction>}
|
|
10786
11303
|
*/
|
|
10787
|
-
static buildDevnodeExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, edition) {
|
|
11304
|
+
static buildDevnodeExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, edition, program_imports) {
|
|
10788
11305
|
_assertClass(private_key, PrivateKey);
|
|
10789
11306
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10790
11307
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10797,7 +11314,12 @@ class ProgramManager {
|
|
|
10797
11314
|
}
|
|
10798
11315
|
var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10799
11316
|
var len3 = WASM_VECTOR_LEN;
|
|
10800
|
-
|
|
11317
|
+
let ptr4 = 0;
|
|
11318
|
+
if (!isLikeNone(program_imports)) {
|
|
11319
|
+
_assertClass(program_imports, ProgramImports);
|
|
11320
|
+
ptr4 = program_imports.__destroy_into_raw();
|
|
11321
|
+
}
|
|
11322
|
+
const ret = wasm$1.programmanager_buildDevnodeExecutionTransaction(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), priority_fee_credits, ptr2, ptr3, len3, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr4);
|
|
10801
11323
|
return takeObject(ret);
|
|
10802
11324
|
}
|
|
10803
11325
|
/**
|
|
@@ -10842,6 +11364,7 @@ class ProgramManager {
|
|
|
10842
11364
|
* @param imports The imports of the program being executed.
|
|
10843
11365
|
* @param url The url to get the inclusion proving information from.
|
|
10844
11366
|
* @param offline_query Optional offline query object if building a Transaction offline.
|
|
11367
|
+
* @param edition The program edition (defaults to 1).
|
|
10845
11368
|
* @param {Authorization} authorization
|
|
10846
11369
|
* @param {Authorization | null | undefined} fee_authorization
|
|
10847
11370
|
* @param {string} program
|
|
@@ -10852,9 +11375,11 @@ class ProgramManager {
|
|
|
10852
11375
|
* @param {object | null} [imports]
|
|
10853
11376
|
* @param {string | null} [url]
|
|
10854
11377
|
* @param {QueryOption | null} [query]
|
|
11378
|
+
* @param {ProgramImports | null} [program_imports]
|
|
11379
|
+
* @param {number | null} [edition]
|
|
10855
11380
|
* @returns {Promise<Transaction>}
|
|
10856
11381
|
*/
|
|
10857
|
-
static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, query) {
|
|
11382
|
+
static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, query, program_imports, edition) {
|
|
10858
11383
|
_assertClass(authorization, Authorization);
|
|
10859
11384
|
var ptr0 = authorization.__destroy_into_raw();
|
|
10860
11385
|
let ptr1 = 0;
|
|
@@ -10891,35 +11416,44 @@ class ProgramManager {
|
|
|
10891
11416
|
_assertClass(query, QueryOption);
|
|
10892
11417
|
ptr8 = query.__destroy_into_raw();
|
|
10893
11418
|
}
|
|
10894
|
-
|
|
11419
|
+
let ptr9 = 0;
|
|
11420
|
+
if (!isLikeNone(program_imports)) {
|
|
11421
|
+
_assertClass(program_imports, ProgramImports);
|
|
11422
|
+
ptr9 = program_imports.__destroy_into_raw();
|
|
11423
|
+
}
|
|
11424
|
+
const ret = wasm$1.programmanager_executeAuthorization(ptr0, ptr1, ptr2, len2, ptr3, ptr4, ptr5, ptr6, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr7, len7, ptr8, ptr9, isLikeNone(edition) ? 0xFFFFFF : edition);
|
|
10895
11425
|
return takeObject(ret);
|
|
10896
11426
|
}
|
|
10897
11427
|
/**
|
|
10898
|
-
* Estimate Fee for Aleo function execution.
|
|
10899
|
-
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
10900
|
-
* program executions.
|
|
11428
|
+
* Estimate Fee for Aleo function execution.
|
|
10901
11429
|
*
|
|
10902
11430
|
* @param program The source code of the program to estimate the execution fee for.
|
|
10903
11431
|
* @param function The name of the function to estimate the execution fee for.
|
|
10904
11432
|
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
10905
11433
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
10906
11434
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
10907
|
-
* @param edition
|
|
11435
|
+
* @param edition The edition of the program. Defaults to 1.
|
|
10908
11436
|
* @returns {u64} Fee in microcredits
|
|
10909
11437
|
* @param {string} program
|
|
10910
11438
|
* @param {string} _function
|
|
10911
11439
|
* @param {object | null} [imports]
|
|
10912
11440
|
* @param {number | null} [edition]
|
|
11441
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10913
11442
|
* @returns {bigint}
|
|
10914
11443
|
*/
|
|
10915
|
-
static estimateExecutionFee(program, _function, imports, edition) {
|
|
11444
|
+
static estimateExecutionFee(program, _function, imports, edition, program_imports) {
|
|
10916
11445
|
try {
|
|
10917
11446
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
10918
11447
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10919
11448
|
const len0 = WASM_VECTOR_LEN;
|
|
10920
11449
|
const ptr1 = passStringToWasm0(_function, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10921
11450
|
const len1 = WASM_VECTOR_LEN;
|
|
10922
|
-
|
|
11451
|
+
let ptr2 = 0;
|
|
11452
|
+
if (!isLikeNone(program_imports)) {
|
|
11453
|
+
_assertClass(program_imports, ProgramImports);
|
|
11454
|
+
ptr2 = program_imports.__destroy_into_raw();
|
|
11455
|
+
}
|
|
11456
|
+
wasm$1.programmanager_estimateExecutionFee(retptr, ptr0, len0, ptr1, len1, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
|
|
10923
11457
|
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
10924
11458
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
10925
11459
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
@@ -10948,7 +11482,7 @@ class ProgramManager {
|
|
|
10948
11482
|
* @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
|
|
10949
11483
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
10950
11484
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
10951
|
-
* @param {ProvingKey | undefined} proving_key (optional) Provide a
|
|
11485
|
+
* @param {ProvingKey | undefined} proving_key (optional) Provide a proving key to use for the function execution
|
|
10952
11486
|
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
10953
11487
|
* @param {PrivateKey} private_key
|
|
10954
11488
|
* @param {string} program
|
|
@@ -10962,9 +11496,10 @@ class ProgramManager {
|
|
|
10962
11496
|
* @param {string | null} [url]
|
|
10963
11497
|
* @param {QueryOption | null} [query]
|
|
10964
11498
|
* @param {number | null} [edition]
|
|
11499
|
+
* @param {ProgramImports | null} [program_imports]
|
|
10965
11500
|
* @returns {Promise<ExecutionResponse>}
|
|
10966
11501
|
*/
|
|
10967
|
-
static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, query, edition) {
|
|
11502
|
+
static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, query, edition, program_imports) {
|
|
10968
11503
|
_assertClass(private_key, PrivateKey);
|
|
10969
11504
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
10970
11505
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -10987,7 +11522,12 @@ class ProgramManager {
|
|
|
10987
11522
|
_assertClass(query, QueryOption);
|
|
10988
11523
|
ptr5 = query.__destroy_into_raw();
|
|
10989
11524
|
}
|
|
10990
|
-
|
|
11525
|
+
let ptr6 = 0;
|
|
11526
|
+
if (!isLikeNone(program_imports)) {
|
|
11527
|
+
_assertClass(program_imports, ProgramImports);
|
|
11528
|
+
ptr6 = program_imports.__destroy_into_raw();
|
|
11529
|
+
}
|
|
11530
|
+
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, ptr6);
|
|
10991
11531
|
return takeObject(ret);
|
|
10992
11532
|
}
|
|
10993
11533
|
/**
|
|
@@ -11053,15 +11593,21 @@ class ProgramManager {
|
|
|
11053
11593
|
* @param {string} program
|
|
11054
11594
|
* @param {object | null} [imports]
|
|
11055
11595
|
* @param {number | null} [edition]
|
|
11596
|
+
* @param {ProgramImports | null} [program_imports]
|
|
11056
11597
|
* @returns {bigint}
|
|
11057
11598
|
*/
|
|
11058
|
-
static estimateFeeForAuthorization(authorization, program, imports, edition) {
|
|
11599
|
+
static estimateFeeForAuthorization(authorization, program, imports, edition, program_imports) {
|
|
11059
11600
|
try {
|
|
11060
11601
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
11061
11602
|
_assertClass(authorization, Authorization);
|
|
11062
11603
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11063
11604
|
const len0 = WASM_VECTOR_LEN;
|
|
11064
|
-
|
|
11605
|
+
let ptr1 = 0;
|
|
11606
|
+
if (!isLikeNone(program_imports)) {
|
|
11607
|
+
_assertClass(program_imports, ProgramImports);
|
|
11608
|
+
ptr1 = program_imports.__destroy_into_raw();
|
|
11609
|
+
}
|
|
11610
|
+
wasm$1.programmanager_estimateFeeForAuthorization(retptr, authorization.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr1);
|
|
11065
11611
|
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
11066
11612
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
11067
11613
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
@@ -11083,19 +11629,15 @@ class ProgramManager {
|
|
|
11083
11629
|
* @param priority_fee_credits The optional priority fee to be paid for the transaction
|
|
11084
11630
|
* @param fee_record The record to spend the fee from
|
|
11085
11631
|
* @param url The url of the Aleo network node to send the transaction to
|
|
11086
|
-
* If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
|
|
11087
|
-
* `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
|
|
11088
|
-
* and used for subsequent transactions. If this is set to 'false' the proving and verifying
|
|
11089
|
-
* keys will be deallocated from memory after the transaction is executed.
|
|
11090
11632
|
* @param imports (optional) Provide a list of imports to use for the function execution in the
|
|
11091
11633
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
11092
11634
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
11093
|
-
* @param proving_key (optional) Provide a
|
|
11635
|
+
* @param proving_key (optional) Provide a proving key to use for the function execution
|
|
11094
11636
|
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
11095
11637
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
11096
11638
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
11097
11639
|
* @param offline_query An offline query object to use if building a transaction without an internet connection.
|
|
11098
|
-
* @param edition The edition of the program to execute. Defaults to
|
|
11640
|
+
* @param edition The edition of the program to execute. Defaults to 1.
|
|
11099
11641
|
* @returns {Transaction}
|
|
11100
11642
|
* @param {PrivateKey} private_key
|
|
11101
11643
|
* @param {string} program
|
|
@@ -11111,9 +11653,10 @@ class ProgramManager {
|
|
|
11111
11653
|
* @param {VerifyingKey | null} [fee_verifying_key]
|
|
11112
11654
|
* @param {QueryOption | null} [query]
|
|
11113
11655
|
* @param {number | null} [edition]
|
|
11656
|
+
* @param {ProgramImports | null} [program_imports]
|
|
11114
11657
|
* @returns {Promise<Transaction>}
|
|
11115
11658
|
*/
|
|
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) {
|
|
11659
|
+
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, program_imports) {
|
|
11117
11660
|
_assertClass(private_key, PrivateKey);
|
|
11118
11661
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11119
11662
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -11151,7 +11694,12 @@ class ProgramManager {
|
|
|
11151
11694
|
_assertClass(query, QueryOption);
|
|
11152
11695
|
ptr8 = query.__destroy_into_raw();
|
|
11153
11696
|
}
|
|
11154
|
-
|
|
11697
|
+
let ptr9 = 0;
|
|
11698
|
+
if (!isLikeNone(program_imports)) {
|
|
11699
|
+
_assertClass(program_imports, ProgramImports);
|
|
11700
|
+
ptr9 = program_imports.__destroy_into_raw();
|
|
11701
|
+
}
|
|
11702
|
+
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, ptr9);
|
|
11155
11703
|
return takeObject(ret);
|
|
11156
11704
|
}
|
|
11157
11705
|
/**
|
|
@@ -11276,9 +11824,10 @@ class ProgramManager {
|
|
|
11276
11824
|
* @param {number | null} [edition]
|
|
11277
11825
|
* @param {object | null} [imports]
|
|
11278
11826
|
* @param {PrivateKey | null} [private_key]
|
|
11827
|
+
* @param {ProgramImports | null} [program_imports]
|
|
11279
11828
|
* @returns {Promise<Authorization>}
|
|
11280
11829
|
*/
|
|
11281
|
-
static buildAuthorizationFromExecutionRequest(request, program, unchecked, edition, imports, private_key) {
|
|
11830
|
+
static buildAuthorizationFromExecutionRequest(request, program, unchecked, edition, imports, private_key, program_imports) {
|
|
11282
11831
|
_assertClass(request, ExecutionRequest);
|
|
11283
11832
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11284
11833
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -11287,7 +11836,12 @@ class ProgramManager {
|
|
|
11287
11836
|
_assertClass(private_key, PrivateKey);
|
|
11288
11837
|
ptr1 = private_key.__destroy_into_raw();
|
|
11289
11838
|
}
|
|
11290
|
-
|
|
11839
|
+
let ptr2 = 0;
|
|
11840
|
+
if (!isLikeNone(program_imports)) {
|
|
11841
|
+
_assertClass(program_imports, ProgramImports);
|
|
11842
|
+
ptr2 = program_imports.__destroy_into_raw();
|
|
11843
|
+
}
|
|
11844
|
+
const ret = wasm$1.programmanager_buildAuthorizationFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1, ptr2);
|
|
11291
11845
|
return takeObject(ret);
|
|
11292
11846
|
}
|
|
11293
11847
|
/**
|
|
@@ -11305,15 +11859,21 @@ class ProgramManager {
|
|
|
11305
11859
|
* @param {Array<any>} inputs
|
|
11306
11860
|
* @param {object | null} [imports]
|
|
11307
11861
|
* @param {number | null} [edition]
|
|
11862
|
+
* @param {ProgramImports | null} [program_imports]
|
|
11308
11863
|
* @returns {Promise<Authorization>}
|
|
11309
11864
|
*/
|
|
11310
|
-
static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports, edition) {
|
|
11865
|
+
static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports, edition, program_imports) {
|
|
11311
11866
|
_assertClass(private_key, PrivateKey);
|
|
11312
11867
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11313
11868
|
const len0 = WASM_VECTOR_LEN;
|
|
11314
11869
|
const ptr1 = passStringToWasm0(function_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11315
11870
|
const len1 = WASM_VECTOR_LEN;
|
|
11316
|
-
|
|
11871
|
+
let ptr2 = 0;
|
|
11872
|
+
if (!isLikeNone(program_imports)) {
|
|
11873
|
+
_assertClass(program_imports, ProgramImports);
|
|
11874
|
+
ptr2 = program_imports.__destroy_into_raw();
|
|
11875
|
+
}
|
|
11876
|
+
const ret = wasm$1.programmanager_buildAuthorizationUnchecked(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
|
|
11317
11877
|
return takeObject(ret);
|
|
11318
11878
|
}
|
|
11319
11879
|
/**
|
|
@@ -11330,15 +11890,21 @@ class ProgramManager {
|
|
|
11330
11890
|
* @param {Array<any>} inputs
|
|
11331
11891
|
* @param {object | null} [imports]
|
|
11332
11892
|
* @param {number | null} [edition]
|
|
11893
|
+
* @param {ProgramImports | null} [program_imports]
|
|
11333
11894
|
* @returns {Promise<Authorization>}
|
|
11334
11895
|
*/
|
|
11335
|
-
static authorize(private_key, program, function_name, inputs, imports, edition) {
|
|
11896
|
+
static authorize(private_key, program, function_name, inputs, imports, edition, program_imports) {
|
|
11336
11897
|
_assertClass(private_key, PrivateKey);
|
|
11337
11898
|
const ptr0 = passStringToWasm0(program, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11338
11899
|
const len0 = WASM_VECTOR_LEN;
|
|
11339
11900
|
const ptr1 = passStringToWasm0(function_name, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
11340
11901
|
const len1 = WASM_VECTOR_LEN;
|
|
11341
|
-
|
|
11902
|
+
let ptr2 = 0;
|
|
11903
|
+
if (!isLikeNone(program_imports)) {
|
|
11904
|
+
_assertClass(program_imports, ProgramImports);
|
|
11905
|
+
ptr2 = program_imports.__destroy_into_raw();
|
|
11906
|
+
}
|
|
11907
|
+
const ret = wasm$1.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
|
|
11342
11908
|
return takeObject(ret);
|
|
11343
11909
|
}
|
|
11344
11910
|
}
|
|
@@ -11842,6 +12408,17 @@ const ProvingRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
11842
12408
|
: new FinalizationRegistry(ptr => wasm$1.__wbg_provingrequest_free(ptr >>> 0, 1));
|
|
11843
12409
|
/**
|
|
11844
12410
|
* Represents a proving request to a prover.
|
|
12411
|
+
*
|
|
12412
|
+
* Carries one of two variants:
|
|
12413
|
+
* - `Authorization` — a fully-constructed snarkVM `Authorization` (plus optional
|
|
12414
|
+
* fee authorization). Submitted to `/prove/authorization` (encrypted-only).
|
|
12415
|
+
* - `Request` — a single signed snarkVM `Request` (plus optional fee `Request`)
|
|
12416
|
+
* that the prover authorizes server-side. Submitted to `/prove/request`
|
|
12417
|
+
* (encrypted-only).
|
|
12418
|
+
*
|
|
12419
|
+
* Use {@link ProvingRequest#kind} when handling a `ProvingRequest` of unknown
|
|
12420
|
+
* variant (e.g. after deserialization). Variant-specific accessors throw if
|
|
12421
|
+
* called on the wrong variant.
|
|
11845
12422
|
*/
|
|
11846
12423
|
class ProvingRequest {
|
|
11847
12424
|
|
|
@@ -11865,9 +12442,23 @@ class ProvingRequest {
|
|
|
11865
12442
|
wasm$1.__wbg_provingrequest_free(ptr, 0);
|
|
11866
12443
|
}
|
|
11867
12444
|
/**
|
|
11868
|
-
*
|
|
12445
|
+
* Returns the signed fee `ExecutionRequest` in the Request variant, or
|
|
12446
|
+
* `undefined` when no fee request is set or this is an Authorization variant.
|
|
12447
|
+
* @returns {ExecutionRequest | undefined}
|
|
12448
|
+
*/
|
|
12449
|
+
feeRequest() {
|
|
12450
|
+
const ret = wasm$1.provingrequest_feeRequest(this.__wbg_ptr);
|
|
12451
|
+
return ret === 0 ? undefined : ExecutionRequest.__wrap(ret);
|
|
12452
|
+
}
|
|
12453
|
+
/**
|
|
12454
|
+
* Creates a `ProvingRequest` from a JSON string representation.
|
|
11869
12455
|
*
|
|
11870
|
-
*
|
|
12456
|
+
* The variant is determined automatically by the JSON shape:
|
|
12457
|
+
* `{ authorization, ... }` → Authorization variant; `{ request, ... }` →
|
|
12458
|
+
* Request variant. Use {@link ProvingRequest#kind} to inspect the
|
|
12459
|
+
* resulting variant.
|
|
12460
|
+
*
|
|
12461
|
+
* @param {string} request JSON string representation of the ProvingRequest.
|
|
11871
12462
|
* @param {string} request
|
|
11872
12463
|
* @returns {ProvingRequest}
|
|
11873
12464
|
*/
|
|
@@ -11889,7 +12480,10 @@ class ProvingRequest {
|
|
|
11889
12480
|
}
|
|
11890
12481
|
}
|
|
11891
12482
|
/**
|
|
11892
|
-
* Creates a left-endian byte representation of the ProvingRequest
|
|
12483
|
+
* Creates a left-endian byte representation of the ProvingRequest,
|
|
12484
|
+
* dispatching on the variant. The bytes are wire-compatible with the
|
|
12485
|
+
* matching DPS route (`/prove[/encrypted]` for Authorization,
|
|
12486
|
+
* `/prove/request` for Request).
|
|
11893
12487
|
* @returns {Uint8Array}
|
|
11894
12488
|
*/
|
|
11895
12489
|
toBytesLe() {
|
|
@@ -11908,17 +12502,64 @@ class ProvingRequest {
|
|
|
11908
12502
|
}
|
|
11909
12503
|
}
|
|
11910
12504
|
/**
|
|
11911
|
-
*
|
|
12505
|
+
* Creates a new Request-variant `ProvingRequest` from a single signed
|
|
12506
|
+
* `ExecutionRequest` and an optional signed fee `ExecutionRequest`.
|
|
12507
|
+
*
|
|
12508
|
+
* The Request variant is processed by the DPS at the `/prove/request`
|
|
12509
|
+
* endpoint, which is encrypted-only. The server runs
|
|
12510
|
+
* `Process::authorize_request` to turn each `Request` into an
|
|
12511
|
+
* `Authorization` before proving.
|
|
12512
|
+
*
|
|
12513
|
+
* Only valid for single-public-request executions. Layered / nested
|
|
12514
|
+
* calls are not supported by `/prove/request` at this time.
|
|
12515
|
+
*
|
|
12516
|
+
* @param {ExecutionRequest} request The signed request for the function.
|
|
12517
|
+
* @param {ExecutionRequest} fee_request Optional signed request for the fee function. When omitted, the prover generates and pays the fee.
|
|
12518
|
+
* @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
|
|
12519
|
+
* @param {ExecutionRequest} request
|
|
12520
|
+
* @param {ExecutionRequest | null | undefined} fee_request
|
|
12521
|
+
* @param {boolean} broadcast
|
|
12522
|
+
* @returns {ProvingRequest}
|
|
12523
|
+
*/
|
|
12524
|
+
static fromRequest(request, fee_request, broadcast) {
|
|
12525
|
+
_assertClass(request, ExecutionRequest);
|
|
12526
|
+
var ptr0 = request.__destroy_into_raw();
|
|
12527
|
+
let ptr1 = 0;
|
|
12528
|
+
if (!isLikeNone(fee_request)) {
|
|
12529
|
+
_assertClass(fee_request, ExecutionRequest);
|
|
12530
|
+
ptr1 = fee_request.__destroy_into_raw();
|
|
12531
|
+
}
|
|
12532
|
+
const ret = wasm$1.provingrequest_fromRequest(ptr0, ptr1, broadcast);
|
|
12533
|
+
return ProvingRequest.__wrap(ret);
|
|
12534
|
+
}
|
|
12535
|
+
/**
|
|
12536
|
+
* Returns the Authorization of the main function in the ProvingRequest.
|
|
12537
|
+
*
|
|
12538
|
+
* @throws If this `ProvingRequest` is a Request variant. Check
|
|
12539
|
+
* {@link ProvingRequest#kind} or use {@link ProvingRequest#request} instead.
|
|
11912
12540
|
* @returns {Authorization}
|
|
11913
12541
|
*/
|
|
11914
12542
|
authorization() {
|
|
11915
|
-
|
|
11916
|
-
|
|
12543
|
+
try {
|
|
12544
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
12545
|
+
wasm$1.provingrequest_authorization(retptr, this.__wbg_ptr);
|
|
12546
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
12547
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
12548
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
12549
|
+
if (r2) {
|
|
12550
|
+
throw takeObject(r1);
|
|
12551
|
+
}
|
|
12552
|
+
return Authorization.__wrap(r0);
|
|
12553
|
+
} finally {
|
|
12554
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
12555
|
+
}
|
|
11917
12556
|
}
|
|
11918
12557
|
/**
|
|
11919
|
-
*
|
|
12558
|
+
* Reads bytes as an Authorization-variant `ProvingRequest`. For the
|
|
12559
|
+
* Request variant, use {@link ProvingRequest.fromBytesLeRequest}
|
|
12560
|
+
* explicitly — byte layout carries no variant discriminator.
|
|
11920
12561
|
*
|
|
11921
|
-
* @param {Uint8Array} bytes Left-endian bytes representing
|
|
12562
|
+
* @param {Uint8Array} bytes Left-endian bytes representing an Authorization-variant proving request.
|
|
11922
12563
|
* @param {Uint8Array} bytes
|
|
11923
12564
|
* @returns {ProvingRequest}
|
|
11924
12565
|
*/
|
|
@@ -11938,7 +12579,8 @@ class ProvingRequest {
|
|
|
11938
12579
|
}
|
|
11939
12580
|
}
|
|
11940
12581
|
/**
|
|
11941
|
-
*
|
|
12582
|
+
* Returns the fee Authorization in the ProvingRequest, or `undefined`
|
|
12583
|
+
* when no fee is set or this is a Request variant.
|
|
11942
12584
|
* @returns {Authorization | undefined}
|
|
11943
12585
|
*/
|
|
11944
12586
|
feeAuthorization() {
|
|
@@ -11946,7 +12588,32 @@ class ProvingRequest {
|
|
|
11946
12588
|
return ret === 0 ? undefined : Authorization.__wrap(ret);
|
|
11947
12589
|
}
|
|
11948
12590
|
/**
|
|
11949
|
-
*
|
|
12591
|
+
* Reads bytes as a Request-variant `ProvingRequest`. Byte layout is
|
|
12592
|
+
* disjoint from the Authorization variant; callers must pick the right
|
|
12593
|
+
* reader for the bytes they hold.
|
|
12594
|
+
*
|
|
12595
|
+
* @param {Uint8Array} bytes Left-endian bytes representing a Request-variant proving request.
|
|
12596
|
+
* @param {Uint8Array} bytes
|
|
12597
|
+
* @returns {ProvingRequest}
|
|
12598
|
+
*/
|
|
12599
|
+
static fromBytesLeRequest(bytes) {
|
|
12600
|
+
try {
|
|
12601
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
12602
|
+
wasm$1.provingrequest_fromBytesLeRequest(retptr, addHeapObject(bytes));
|
|
12603
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
12604
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
12605
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
12606
|
+
if (r2) {
|
|
12607
|
+
throw takeObject(r1);
|
|
12608
|
+
}
|
|
12609
|
+
return ProvingRequest.__wrap(r0);
|
|
12610
|
+
} finally {
|
|
12611
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
12612
|
+
}
|
|
12613
|
+
}
|
|
12614
|
+
/**
|
|
12615
|
+
* Creates a new Authorization-variant `ProvingRequest` from a function
|
|
12616
|
+
* `Authorization` and an optional fee `Authorization`.
|
|
11950
12617
|
*
|
|
11951
12618
|
* @param {Authorization} authorization An Authorization for a function.
|
|
11952
12619
|
* @param {Authorization} fee_authorization The authorization for the `credits.aleo/fee_public` or `credits.aleo/fee_private` function that pays the fee for the execution of the main function.
|
|
@@ -11967,6 +12634,28 @@ class ProvingRequest {
|
|
|
11967
12634
|
const ret = wasm$1.provingrequest_new(ptr0, ptr1, broadcast);
|
|
11968
12635
|
return ProvingRequest.__wrap(ret);
|
|
11969
12636
|
}
|
|
12637
|
+
/**
|
|
12638
|
+
* Returns the variant of this `ProvingRequest`: `"authorization"` or
|
|
12639
|
+
* `"request"`. Useful when handling a `ProvingRequest` whose variant
|
|
12640
|
+
* was determined at deserialization time.
|
|
12641
|
+
* @returns {string}
|
|
12642
|
+
*/
|
|
12643
|
+
kind() {
|
|
12644
|
+
let deferred1_0;
|
|
12645
|
+
let deferred1_1;
|
|
12646
|
+
try {
|
|
12647
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
12648
|
+
wasm$1.provingrequest_kind(retptr, this.__wbg_ptr);
|
|
12649
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
12650
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
12651
|
+
deferred1_0 = r0;
|
|
12652
|
+
deferred1_1 = r1;
|
|
12653
|
+
return getStringFromWasm0(r0, r1);
|
|
12654
|
+
} finally {
|
|
12655
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
12656
|
+
wasm$1.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
12657
|
+
}
|
|
12658
|
+
}
|
|
11970
12659
|
/**
|
|
11971
12660
|
* Check if a ProvingRequest is the same as another ProvingRequest.
|
|
11972
12661
|
* @param {ProvingRequest} other
|
|
@@ -11977,6 +12666,29 @@ class ProvingRequest {
|
|
|
11977
12666
|
const ret = wasm$1.provingrequest_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
11978
12667
|
return ret !== 0;
|
|
11979
12668
|
}
|
|
12669
|
+
/**
|
|
12670
|
+
* Returns the signed `ExecutionRequest` carried by the Request variant.
|
|
12671
|
+
*
|
|
12672
|
+
* @throws If this `ProvingRequest` is an Authorization variant. Check
|
|
12673
|
+
* {@link ProvingRequest#kind} or use {@link ProvingRequest#authorization}
|
|
12674
|
+
* instead.
|
|
12675
|
+
* @returns {ExecutionRequest}
|
|
12676
|
+
*/
|
|
12677
|
+
request() {
|
|
12678
|
+
try {
|
|
12679
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
12680
|
+
wasm$1.provingrequest_request(retptr, this.__wbg_ptr);
|
|
12681
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
12682
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
12683
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
12684
|
+
if (r2) {
|
|
12685
|
+
throw takeObject(r1);
|
|
12686
|
+
}
|
|
12687
|
+
return ExecutionRequest.__wrap(r0);
|
|
12688
|
+
} finally {
|
|
12689
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
12690
|
+
}
|
|
12691
|
+
}
|
|
11980
12692
|
/**
|
|
11981
12693
|
* Get the broadcast flag set in the ProvingRequest.
|
|
11982
12694
|
* @returns {boolean}
|
|
@@ -11986,7 +12698,9 @@ class ProvingRequest {
|
|
|
11986
12698
|
return ret !== 0;
|
|
11987
12699
|
}
|
|
11988
12700
|
/**
|
|
11989
|
-
* Creates a string representation of the ProvingRequest.
|
|
12701
|
+
* Creates a JSON string representation of the ProvingRequest.
|
|
12702
|
+
* The shape carries enough information to recover the variant via
|
|
12703
|
+
* {@link ProvingRequest.fromString}.
|
|
11990
12704
|
* @returns {string}
|
|
11991
12705
|
*/
|
|
11992
12706
|
toString() {
|
|
@@ -18300,6 +19014,10 @@ function __wbg_get_imports(memory) {
|
|
|
18300
19014
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
18301
19015
|
return ret;
|
|
18302
19016
|
};
|
|
19017
|
+
imports.wbg.__wbg___wbindgen_is_null_5e69f72e906cc57c = function(arg0) {
|
|
19018
|
+
const ret = getObject(arg0) === null;
|
|
19019
|
+
return ret;
|
|
19020
|
+
};
|
|
18303
19021
|
imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
|
|
18304
19022
|
const val = getObject(arg0);
|
|
18305
19023
|
const ret = typeof(val) === 'object' && val !== null;
|
|
@@ -18464,6 +19182,16 @@ function __wbg_get_imports(memory) {
|
|
|
18464
19182
|
const ret = getObject(arg0).headers;
|
|
18465
19183
|
return addHeapObject(ret);
|
|
18466
19184
|
};
|
|
19185
|
+
imports.wbg.__wbg_instanceof_Object_10bb762262230c68 = function(arg0) {
|
|
19186
|
+
let result;
|
|
19187
|
+
try {
|
|
19188
|
+
result = getObject(arg0) instanceof Object;
|
|
19189
|
+
} catch (_) {
|
|
19190
|
+
result = false;
|
|
19191
|
+
}
|
|
19192
|
+
const ret = result;
|
|
19193
|
+
return ret;
|
|
19194
|
+
};
|
|
18467
19195
|
imports.wbg.__wbg_instanceof_Promise_001fdd42afa1b7ef = function(arg0) {
|
|
18468
19196
|
let result;
|
|
18469
19197
|
try {
|
|
@@ -18518,7 +19246,7 @@ function __wbg_get_imports(memory) {
|
|
|
18518
19246
|
const ret = getObject(arg0).length;
|
|
18519
19247
|
return ret;
|
|
18520
19248
|
};
|
|
18521
|
-
imports.wbg.
|
|
19249
|
+
imports.wbg.__wbg_log_b88efcc0ed7757a6 = function(arg0, arg1) {
|
|
18522
19250
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
18523
19251
|
};
|
|
18524
19252
|
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
@@ -18540,7 +19268,7 @@ function __wbg_get_imports(memory) {
|
|
|
18540
19268
|
const a = state0.a;
|
|
18541
19269
|
state0.a = 0;
|
|
18542
19270
|
try {
|
|
18543
|
-
return
|
|
19271
|
+
return __wasm_bindgen_func_elem_7560(a, state0.b, arg0, arg1);
|
|
18544
19272
|
} finally {
|
|
18545
19273
|
state0.a = a;
|
|
18546
19274
|
}
|
|
@@ -18727,7 +19455,7 @@ function __wbg_get_imports(memory) {
|
|
|
18727
19455
|
const ret = Signature.__wrap(arg0);
|
|
18728
19456
|
return addHeapObject(ret);
|
|
18729
19457
|
};
|
|
18730
|
-
imports.wbg.
|
|
19458
|
+
imports.wbg.__wbg_spawnWorker_6ede797d507e374c = function(arg0, arg1, arg2, arg3) {
|
|
18731
19459
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
18732
19460
|
return addHeapObject(ret);
|
|
18733
19461
|
};
|
|
@@ -18829,7 +19557,7 @@ function __wbg_get_imports(memory) {
|
|
|
18829
19557
|
};
|
|
18830
19558
|
imports.wbg.__wbindgen_cast_3ebebf8ee554379e = function(arg0, arg1) {
|
|
18831
19559
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18832
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19560
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
|
|
18833
19561
|
return addHeapObject(ret);
|
|
18834
19562
|
};
|
|
18835
19563
|
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
@@ -18839,12 +19567,12 @@ function __wbg_get_imports(memory) {
|
|
|
18839
19567
|
};
|
|
18840
19568
|
imports.wbg.__wbindgen_cast_5e9bcb6388942484 = function(arg0, arg1) {
|
|
18841
19569
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [], shim_idx: 462, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18842
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19570
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_7287);
|
|
18843
19571
|
return addHeapObject(ret);
|
|
18844
19572
|
};
|
|
18845
19573
|
imports.wbg.__wbindgen_cast_74f3a90a349943d1 = function(arg0, arg1) {
|
|
18846
19574
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [Externref], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
18847
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19575
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
|
|
18848
19576
|
return addHeapObject(ret);
|
|
18849
19577
|
};
|
|
18850
19578
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -18988,6 +19716,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
|
|
|
18988
19716
|
PrivateKey: PrivateKey,
|
|
18989
19717
|
PrivateKeyCiphertext: PrivateKeyCiphertext,
|
|
18990
19718
|
Program: Program,
|
|
19719
|
+
ProgramImports: ProgramImports,
|
|
18991
19720
|
ProgramManager: ProgramManager,
|
|
18992
19721
|
Proof: Proof,
|
|
18993
19722
|
ProvingKey: ProvingKey,
|
|
@@ -19012,6 +19741,7 @@ var exports$1$1 = /*#__PURE__*/Object.freeze({
|
|
|
19012
19741
|
initSync: initSync$1,
|
|
19013
19742
|
initThreadPool: initThreadPool,
|
|
19014
19743
|
runRayonThread: runRayonThread,
|
|
19744
|
+
setWasmLogLevel: setWasmLogLevel,
|
|
19015
19745
|
snarkVerify: snarkVerify,
|
|
19016
19746
|
snarkVerifyBatch: snarkVerifyBatch,
|
|
19017
19747
|
stringToField: stringToField,
|