@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.
@@ -286,6 +286,17 @@ function runRayonThread(receiver) {
286
286
  wasm.runRayonThread(receiver);
287
287
  }
288
288
 
289
+ /**
290
+ * Set the WASM log level from JS. Called automatically by the SDK's
291
+ * `setLogLevel(level)` to keep TS and WASM logging in sync.
292
+ * Levels: 0=silent, 1=error, 2=warn, 3=info (default), 4=debug.
293
+ * Values above 4 are clamped to debug.
294
+ * @param {number} level
295
+ */
296
+ function setWasmLogLevel(level) {
297
+ wasm.setWasmLogLevel(level);
298
+ }
299
+
289
300
  /**
290
301
  * @param {URL} url
291
302
  * @param {number} num_threads
@@ -303,39 +314,6 @@ function addBorrowedObject(obj) {
303
314
  heap[--stack_pointer] = obj;
304
315
  return stack_pointer;
305
316
  }
306
- /**
307
- * Verify a SNARK proof against a verifying key and public inputs.
308
- *
309
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
310
- * It directly invokes the Varuna proof verification from snarkVM.
311
- *
312
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
313
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
314
- * @param {Proof} proof The proof to verify
315
- * @returns {boolean} True if the proof is valid, false otherwise
316
- * @param {VerifyingKey} verifying_key
317
- * @param {Array<any>} inputs
318
- * @param {Proof} proof
319
- * @returns {boolean}
320
- */
321
- function snarkVerify(verifying_key, inputs, proof) {
322
- try {
323
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
324
- _assertClass(verifying_key, VerifyingKey);
325
- _assertClass(proof, Proof);
326
- wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
327
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
328
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
329
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
330
- if (r2) {
331
- throw takeObject(r1);
332
- }
333
- return r0 !== 0;
334
- } finally {
335
- wasm.__wbindgen_add_to_stack_pointer(16);
336
- }
337
- }
338
-
339
317
  /**
340
318
  * Verify an execution. Executions with multiple transitions must have the program source code and
341
319
  * verifying keys of imported functions supplied from outside to correctly verify. Also, this does
@@ -355,9 +333,10 @@ function snarkVerify(verifying_key, inputs, proof) {
355
333
  * @param {object | null | undefined} imports
356
334
  * @param {object | null | undefined} imported_verifying_keys
357
335
  * @param {number} block_height
336
+ * @param {ProgramImports | null} [program_imports]
358
337
  * @returns {boolean}
359
338
  */
360
- function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height) {
339
+ function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height, program_imports) {
361
340
  try {
362
341
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
363
342
  _assertClass(execution, Execution);
@@ -365,7 +344,12 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
365
344
  _assertClass(program, Program);
366
345
  const ptr0 = passStringToWasm0(function_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
367
346
  const len0 = WASM_VECTOR_LEN;
368
- wasm.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);
347
+ let ptr1 = 0;
348
+ if (!isLikeNone(program_imports)) {
349
+ _assertClass(program_imports, ProgramImports);
350
+ ptr1 = program_imports.__destroy_into_raw();
351
+ }
352
+ wasm.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);
369
353
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
370
354
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
371
355
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -379,25 +363,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
379
363
  }
380
364
 
381
365
  /**
382
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
366
+ * Verify a SNARK proof against a verifying key and public inputs.
383
367
  *
384
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
385
- * Each verifying key is paired with one or more sets of public inputs (instances).
368
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
369
+ * It directly invokes the Varuna proof verification from snarkVM.
386
370
  *
387
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
388
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
389
- * @param {Proof} proof The batch proof to verify
390
- * @returns {boolean} True if the batch proof is valid, false otherwise
391
- * @param {Array<any>} verifying_keys
371
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
372
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
373
+ * @param {Proof} proof The proof to verify
374
+ * @returns {boolean} True if the proof is valid, false otherwise
375
+ * @param {VerifyingKey} verifying_key
392
376
  * @param {Array<any>} inputs
393
377
  * @param {Proof} proof
394
378
  * @returns {boolean}
395
379
  */
396
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
380
+ function snarkVerify(verifying_key, inputs, proof) {
397
381
  try {
398
382
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
+ _assertClass(verifying_key, VerifyingKey);
399
384
  _assertClass(proof, Proof);
400
- wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
385
+ wasm.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
401
386
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
402
387
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
403
388
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -411,22 +396,32 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
411
396
  }
412
397
 
413
398
  /**
414
- * @param {string} string
415
- * @returns {Field}
399
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
400
+ *
401
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
402
+ * Each verifying key is paired with one or more sets of public inputs (instances).
403
+ *
404
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
405
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
406
+ * @param {Proof} proof The batch proof to verify
407
+ * @returns {boolean} True if the batch proof is valid, false otherwise
408
+ * @param {Array<any>} verifying_keys
409
+ * @param {Array<any>} inputs
410
+ * @param {Proof} proof
411
+ * @returns {boolean}
416
412
  */
417
- function stringToField(string) {
413
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
418
414
  try {
419
415
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
420
- const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
421
- const len0 = WASM_VECTOR_LEN;
422
- wasm.stringToField(retptr, ptr0, len0);
416
+ _assertClass(proof, Proof);
417
+ wasm.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
423
418
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
424
419
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
425
420
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
426
421
  if (r2) {
427
422
  throw takeObject(r1);
428
423
  }
429
- return Field.__wrap(r0);
424
+ return r0 !== 0;
430
425
  } finally {
431
426
  wasm.__wbindgen_add_to_stack_pointer(16);
432
427
  }
@@ -452,6 +447,28 @@ function getOrInitConsensusVersionTestHeights(heights) {
452
447
  return takeObject(ret);
453
448
  }
454
449
 
450
+ /**
451
+ * @param {string} string
452
+ * @returns {Field}
453
+ */
454
+ function stringToField(string) {
455
+ try {
456
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
457
+ const ptr0 = passStringToWasm0(string, wasm.__wbindgen_export, wasm.__wbindgen_export2);
458
+ const len0 = WASM_VECTOR_LEN;
459
+ wasm.stringToField(retptr, ptr0, len0);
460
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
461
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
462
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
463
+ if (r2) {
464
+ throw takeObject(r1);
465
+ }
466
+ return Field.__wrap(r0);
467
+ } finally {
468
+ wasm.__wbindgen_add_to_stack_pointer(16);
469
+ }
470
+ }
471
+
455
472
  function passArrayJsValueToWasm0(array, malloc) {
456
473
  const ptr = malloc(array.length * 4, 4) >>> 0;
457
474
  const mem = getDataViewMemory0();
@@ -471,16 +488,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
471
488
  }
472
489
  return result;
473
490
  }
474
- function __wasm_bindgen_func_elem_7206(arg0, arg1) {
475
- wasm.__wasm_bindgen_func_elem_7206(arg0, arg1);
491
+ function __wasm_bindgen_func_elem_7287(arg0, arg1) {
492
+ wasm.__wasm_bindgen_func_elem_7287(arg0, arg1);
476
493
  }
477
494
 
478
- function __wasm_bindgen_func_elem_8569(arg0, arg1, arg2) {
479
- wasm.__wasm_bindgen_func_elem_8569(arg0, arg1, addHeapObject(arg2));
495
+ function __wasm_bindgen_func_elem_8655(arg0, arg1, arg2) {
496
+ wasm.__wasm_bindgen_func_elem_8655(arg0, arg1, addHeapObject(arg2));
480
497
  }
481
498
 
482
- function __wasm_bindgen_func_elem_7479(arg0, arg1, arg2, arg3) {
483
- wasm.__wasm_bindgen_func_elem_7479(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
499
+ function __wasm_bindgen_func_elem_7560(arg0, arg1, arg2, arg3) {
500
+ wasm.__wasm_bindgen_func_elem_7560(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
484
501
  }
485
502
 
486
503
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -9997,6 +10014,36 @@ class Program {
9997
10014
  const ret = wasm.program_getFunctions(this.__wbg_ptr);
9998
10015
  return takeObject(ret);
9999
10016
  }
10017
+ /**
10018
+ * Get the external call graph reachable from a specific entry function.
10019
+ *
10020
+ * Starting from `entry_function`, traces all reachable functions and closures
10021
+ * within this program (via local calls) and collects external calls
10022
+ * (`call program.aleo/function`). Returns a JS object mapping program names
10023
+ * to arrays of called function names.
10024
+ *
10025
+ * @param {string} entry_function The name of the entry function to trace from
10026
+ * @returns {object} An object like `{ "program.aleo": ["fn1", "fn2"] }`
10027
+ * @param {string} entry_function
10028
+ * @returns {any}
10029
+ */
10030
+ getCallGraph(entry_function) {
10031
+ try {
10032
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10033
+ const ptr0 = passStringToWasm0(entry_function, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10034
+ const len0 = WASM_VECTOR_LEN;
10035
+ wasm.program_getCallGraph(retptr, this.__wbg_ptr, ptr0, len0);
10036
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10037
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10038
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10039
+ if (r2) {
10040
+ throw takeObject(r1);
10041
+ }
10042
+ return takeObject(r0);
10043
+ } finally {
10044
+ wasm.__wbindgen_add_to_stack_pointer(16);
10045
+ }
10046
+ }
10000
10047
  /**
10001
10048
  * Get a javascript object representation of a program record and its types
10002
10049
  *
@@ -10260,6 +10307,436 @@ class Program {
10260
10307
  }
10261
10308
  if (Symbol.dispose) Program.prototype[Symbol.dispose] = Program.prototype.free;
10262
10309
 
10310
+ const ProgramImportsFinalization = (typeof FinalizationRegistry === 'undefined')
10311
+ ? { register: () => {}, unregister: () => {} }
10312
+ : new FinalizationRegistry(ptr => wasm.__wbg_programimports_free(ptr >>> 0, 1));
10313
+ /**
10314
+ * Backed by `Rc<RefCell<>>` for interior mutability — cloning produces a cheap
10315
+ * reference-counted copy that shares the same underlying data. This allows
10316
+ * execution functions to clone the builder internally while the caller's
10317
+ * original reference automatically sees any mutations (e.g. synthesized keys).
10318
+ */
10319
+ class ProgramImports {
10320
+
10321
+ static __wrap(ptr) {
10322
+ ptr = ptr >>> 0;
10323
+ const obj = Object.create(ProgramImports.prototype);
10324
+ obj.__wbg_ptr = ptr;
10325
+ ProgramImportsFinalization.register(obj, obj.__wbg_ptr, obj);
10326
+ return obj;
10327
+ }
10328
+
10329
+ __destroy_into_raw() {
10330
+ const ptr = this.__wbg_ptr;
10331
+ this.__wbg_ptr = 0;
10332
+ ProgramImportsFinalization.unregister(this);
10333
+ return ptr;
10334
+ }
10335
+
10336
+ free() {
10337
+ const ptr = this.__destroy_into_raw();
10338
+ wasm.__wbg_programimports_free(ptr, 0);
10339
+ }
10340
+ /**
10341
+ * Add a program's source code to the imports.
10342
+ *
10343
+ * The source is parsed, validated, and added to the internal Process.
10344
+ * Static imports of the program are resolved depth-first from programs
10345
+ * already present in this builder.
10346
+ *
10347
+ * @param {string} name The program name (e.g., "my_program.aleo").
10348
+ * @param {string} source The program source code.
10349
+ * @param {number | undefined} edition The program edition (defaults to 1).
10350
+ * @param {string} name
10351
+ * @param {string} source
10352
+ * @param {number | null} [edition]
10353
+ */
10354
+ addProgram(name, source, edition) {
10355
+ try {
10356
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10357
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10358
+ const len0 = WASM_VECTOR_LEN;
10359
+ const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10360
+ const len1 = WASM_VECTOR_LEN;
10361
+ wasm.programimports_addProgram(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(edition) ? 0xFFFFFF : edition);
10362
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10363
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10364
+ if (r1) {
10365
+ throw takeObject(r0);
10366
+ }
10367
+ } finally {
10368
+ wasm.__wbindgen_add_to_stack_pointer(16);
10369
+ }
10370
+ }
10371
+ /**
10372
+ * Create a ProgramImports from a plain JavaScript object.
10373
+ *
10374
+ * Accepts three formats:
10375
+ * ```js
10376
+ * // 1. Plain string — source code only.
10377
+ * { "my_program.aleo": "program source..." }
10378
+ *
10379
+ * // 2. Structured — program source with optional edition.
10380
+ * { "my_program.aleo": { program: "program source..." } }
10381
+ *
10382
+ * // 3. Structured with keys — program source plus proving/verifying keys per function.
10383
+ * {
10384
+ * "my_program.aleo": {
10385
+ * program: "program source...",
10386
+ * keys: {
10387
+ * "my_function": {
10388
+ * provingKey: Uint8Array,
10389
+ * verifyingKey: Uint8Array
10390
+ * }
10391
+ * }
10392
+ * }
10393
+ * }
10394
+ * ```
10395
+ *
10396
+ * Programs created via this method default to edition 1.
10397
+ *
10398
+ * @param {Object} object A plain JavaScript object mapping program names to source code
10399
+ * and optional keys.
10400
+ * @returns {ProgramImports}
10401
+ * @param {object} object
10402
+ * @returns {ProgramImports}
10403
+ */
10404
+ static fromObject(object) {
10405
+ try {
10406
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10407
+ wasm.programimports_fromObject(retptr, addHeapObject(object));
10408
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10409
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10410
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10411
+ if (r2) {
10412
+ throw takeObject(r1);
10413
+ }
10414
+ return ProgramImports.__wrap(r0);
10415
+ } finally {
10416
+ wasm.__wbindgen_add_to_stack_pointer(16);
10417
+ }
10418
+ }
10419
+ /**
10420
+ * Return the source code of a program by name, without serializing keys.
10421
+ *
10422
+ * @param {string} name The program name (e.g., "my_program.aleo").
10423
+ * @returns {string | undefined}
10424
+ * @param {string} name
10425
+ * @returns {string | undefined}
10426
+ */
10427
+ getProgram(name) {
10428
+ try {
10429
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10430
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10431
+ const len0 = WASM_VECTOR_LEN;
10432
+ wasm.programimports_getProgram(retptr, this.__wbg_ptr, ptr0, len0);
10433
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10434
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10435
+ let v2;
10436
+ if (r0 !== 0) {
10437
+ v2 = getStringFromWasm0(r0, r1).slice();
10438
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
10439
+ }
10440
+ return v2;
10441
+ } finally {
10442
+ wasm.__wbindgen_add_to_stack_pointer(16);
10443
+ }
10444
+ }
10445
+ /**
10446
+ * Return the names of all programs in this builder as a JS `Array<string>`.
10447
+ *
10448
+ * This is a lightweight alternative to `toObject()` when you only need to
10449
+ * enumerate program names without serializing keys.
10450
+ *
10451
+ * @returns {Array<string>}
10452
+ * @returns {Array<any>}
10453
+ */
10454
+ programNames() {
10455
+ const ret = wasm.programimports_programNames(this.__wbg_ptr);
10456
+ return takeObject(ret);
10457
+ }
10458
+ /**
10459
+ * Add a proving key for a function or record within an imported program.
10460
+ *
10461
+ * The key is transferred directly from the WASM `ProvingKey` type with no
10462
+ * serialization overhead.
10463
+ *
10464
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10465
+ * @param {string} identifier The function name or record name the key belongs to.
10466
+ * @param {ProvingKey} key The proving key.
10467
+ * @param {string} program_name
10468
+ * @param {string} identifier
10469
+ * @param {ProvingKey} key
10470
+ */
10471
+ addProvingKey(program_name, identifier, key) {
10472
+ try {
10473
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10474
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10475
+ const len0 = WASM_VECTOR_LEN;
10476
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10477
+ const len1 = WASM_VECTOR_LEN;
10478
+ _assertClass(key, ProvingKey);
10479
+ var ptr2 = key.__destroy_into_raw();
10480
+ wasm.programimports_addProvingKey(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2);
10481
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10482
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10483
+ if (r1) {
10484
+ throw takeObject(r0);
10485
+ }
10486
+ } finally {
10487
+ wasm.__wbindgen_add_to_stack_pointer(16);
10488
+ }
10489
+ }
10490
+ /**
10491
+ * Get a proving key for a specific program and identifier (function or record name).
10492
+ * Returns a clone of the key from the internal Process. Non-destructive — the key
10493
+ * remains available for future calls.
10494
+ *
10495
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10496
+ * @param {string} identifier The function or record name.
10497
+ * @returns {ProvingKey | undefined}
10498
+ * @param {string} program_name
10499
+ * @param {string} identifier
10500
+ * @returns {ProvingKey | undefined}
10501
+ */
10502
+ getProvingKey(program_name, identifier) {
10503
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10504
+ const len0 = WASM_VECTOR_LEN;
10505
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10506
+ const len1 = WASM_VECTOR_LEN;
10507
+ const ret = wasm.programimports_getProvingKey(this.__wbg_ptr, ptr0, len0, ptr1, len1);
10508
+ return ret === 0 ? undefined : ProvingKey.__wrap(ret);
10509
+ }
10510
+ /**
10511
+ * Add a verifying key for a function or record within an imported program.
10512
+ *
10513
+ * The key is transferred directly from the WASM `VerifyingKey` type with no
10514
+ * serialization overhead.
10515
+ *
10516
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10517
+ * @param {string} identifier The function name or record name the key belongs to.
10518
+ * @param {VerifyingKey} key The verifying key.
10519
+ * @param {string} program_name
10520
+ * @param {string} identifier
10521
+ * @param {VerifyingKey} key
10522
+ */
10523
+ addVerifyingKey(program_name, identifier, key) {
10524
+ try {
10525
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10526
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10527
+ const len0 = WASM_VECTOR_LEN;
10528
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10529
+ const len1 = WASM_VECTOR_LEN;
10530
+ _assertClass(key, VerifyingKey);
10531
+ var ptr2 = key.__destroy_into_raw();
10532
+ wasm.programimports_addVerifyingKey(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2);
10533
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10534
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10535
+ if (r1) {
10536
+ throw takeObject(r0);
10537
+ }
10538
+ } finally {
10539
+ wasm.__wbindgen_add_to_stack_pointer(16);
10540
+ }
10541
+ }
10542
+ /**
10543
+ * Get a verifying key for a specific program and identifier (function or record name).
10544
+ * Returns a clone of the key from the internal Process. Non-destructive — the key
10545
+ * remains available for future calls.
10546
+ *
10547
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10548
+ * @param {string} identifier The function or record name.
10549
+ * @returns {VerifyingKey | undefined}
10550
+ * @param {string} program_name
10551
+ * @param {string} identifier
10552
+ * @returns {VerifyingKey | undefined}
10553
+ */
10554
+ getVerifyingKey(program_name, identifier) {
10555
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10556
+ const len0 = WASM_VECTOR_LEN;
10557
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10558
+ const len1 = WASM_VECTOR_LEN;
10559
+ const ret = wasm.programimports_getVerifyingKey(this.__wbg_ptr, ptr0, len0, ptr1, len1);
10560
+ return ret === 0 ? undefined : VerifyingKey.__wrap(ret);
10561
+ }
10562
+ /**
10563
+ * Add a proving key from its byte representation.
10564
+ *
10565
+ * Deserializes the bytes into a native proving key and stores it. The program
10566
+ * must already have been added via `addProgram`.
10567
+ *
10568
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10569
+ * @param {string} identifier The function name or record name the key belongs to.
10570
+ * @param {Uint8Array} bytes The proving key bytes.
10571
+ * @param {string} program_name
10572
+ * @param {string} identifier
10573
+ * @param {Uint8Array} bytes
10574
+ */
10575
+ addProvingKeyBytes(program_name, identifier, bytes) {
10576
+ try {
10577
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10578
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10579
+ const len0 = WASM_VECTOR_LEN;
10580
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10581
+ const len1 = WASM_VECTOR_LEN;
10582
+ const ptr2 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
10583
+ const len2 = WASM_VECTOR_LEN;
10584
+ wasm.programimports_addProvingKeyBytes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
10585
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10586
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10587
+ if (r1) {
10588
+ throw takeObject(r0);
10589
+ }
10590
+ } finally {
10591
+ wasm.__wbindgen_add_to_stack_pointer(16);
10592
+ }
10593
+ }
10594
+ /**
10595
+ * Add a verifying key from its byte representation.
10596
+ *
10597
+ * Deserializes the bytes into a native verifying key and stores it. The program
10598
+ * must already have been added via `addProgram`.
10599
+ *
10600
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10601
+ * @param {string} identifier The function name or record name the key belongs to.
10602
+ * @param {Uint8Array} bytes The verifying key bytes.
10603
+ * @param {string} program_name
10604
+ * @param {string} identifier
10605
+ * @param {Uint8Array} bytes
10606
+ */
10607
+ addVerifyingKeyBytes(program_name, identifier, bytes) {
10608
+ try {
10609
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10610
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10611
+ const len0 = WASM_VECTOR_LEN;
10612
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10613
+ const len1 = WASM_VECTOR_LEN;
10614
+ const ptr2 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
10615
+ const len2 = WASM_VECTOR_LEN;
10616
+ wasm.programimports_addVerifyingKeyBytes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
10617
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10618
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10619
+ if (r1) {
10620
+ throw takeObject(r0);
10621
+ }
10622
+ } finally {
10623
+ wasm.__wbindgen_add_to_stack_pointer(16);
10624
+ }
10625
+ }
10626
+ /**
10627
+ * Return the names of functions that have both a proving key and a verifying key
10628
+ * stored for the given program.
10629
+ *
10630
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10631
+ * @returns {Array<string>}
10632
+ * @param {string} program_name
10633
+ * @returns {Array<any>}
10634
+ */
10635
+ functionKeysAvailable(program_name) {
10636
+ try {
10637
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10638
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10639
+ const len0 = WASM_VECTOR_LEN;
10640
+ wasm.programimports_functionKeysAvailable(retptr, this.__wbg_ptr, ptr0, len0);
10641
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10642
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10643
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10644
+ if (r2) {
10645
+ throw takeObject(r1);
10646
+ }
10647
+ return takeObject(r0);
10648
+ } finally {
10649
+ wasm.__wbindgen_add_to_stack_pointer(16);
10650
+ }
10651
+ }
10652
+ /**
10653
+ * Create a new empty ProgramImports builder.
10654
+ *
10655
+ * Initializes an internal snarkVM Process. This is the same cost as a
10656
+ * single execution call, but is paid once and reused across all operations.
10657
+ */
10658
+ constructor() {
10659
+ try {
10660
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10661
+ wasm.programimports_new(retptr);
10662
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10663
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10664
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10665
+ if (r2) {
10666
+ throw takeObject(r1);
10667
+ }
10668
+ this.__wbg_ptr = r0 >>> 0;
10669
+ ProgramImportsFinalization.register(this, this.__wbg_ptr, this);
10670
+ return this;
10671
+ } finally {
10672
+ wasm.__wbindgen_add_to_stack_pointer(16);
10673
+ }
10674
+ }
10675
+ /**
10676
+ * Create a cheap clone that shares the same underlying data.
10677
+ *
10678
+ * Useful for passing to WASM execution functions which consume ownership:
10679
+ * the caller keeps the original, and both copies see any mutations
10680
+ * (e.g. synthesized keys) through the shared interior state.
10681
+ * @returns {ProgramImports}
10682
+ */
10683
+ clone() {
10684
+ const ret = wasm.programimports_clone(this.__wbg_ptr);
10685
+ return ProgramImports.__wrap(ret);
10686
+ }
10687
+ /**
10688
+ * Check whether a specific program has been added.
10689
+ *
10690
+ * @param {string} name The program name.
10691
+ * @returns {boolean}
10692
+ * @param {string} name
10693
+ * @returns {boolean}
10694
+ */
10695
+ contains(name) {
10696
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10697
+ const len0 = WASM_VECTOR_LEN;
10698
+ const ret = wasm.programimports_contains(this.__wbg_ptr, ptr0, len0);
10699
+ return ret !== 0;
10700
+ }
10701
+ /**
10702
+ * Check whether any programs have been added to this builder.
10703
+ *
10704
+ * @returns {boolean}
10705
+ * @returns {boolean}
10706
+ */
10707
+ isEmpty() {
10708
+ const ret = wasm.programimports_isEmpty(this.__wbg_ptr);
10709
+ return ret !== 0;
10710
+ }
10711
+ /**
10712
+ * Convert this ProgramImports to a plain JavaScript object.
10713
+ *
10714
+ * Entries without keys use the simple `{ "name.aleo": "source" }` format.
10715
+ * Entries with keys use the structured format:
10716
+ * ```js
10717
+ * {
10718
+ * "name.aleo": {
10719
+ * program: "program source...",
10720
+ * keys: {
10721
+ * "function_name": {
10722
+ * provingKey: Uint8Array,
10723
+ * verifyingKey: Uint8Array
10724
+ * }
10725
+ * }
10726
+ * }
10727
+ * }
10728
+ * ```
10729
+ *
10730
+ * @returns {Object}
10731
+ * @returns {object}
10732
+ */
10733
+ toObject() {
10734
+ const ret = wasm.programimports_toObject(this.__wbg_ptr);
10735
+ return takeObject(ret);
10736
+ }
10737
+ }
10738
+ if (Symbol.dispose) ProgramImports.prototype[Symbol.dispose] = ProgramImports.prototype.free;
10739
+
10263
10740
  const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
10264
10741
  ? { register: () => {}, unregister: () => {} }
10265
10742
  : new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0, 1));
@@ -10290,15 +10767,21 @@ class ProgramManager {
10290
10767
  * @param {Array<any>} inputs
10291
10768
  * @param {object | null} [imports]
10292
10769
  * @param {number | null} [edition]
10770
+ * @param {ProgramImports | null} [program_imports]
10293
10771
  * @returns {Promise<KeyPair>}
10294
10772
  */
10295
- static synthesizeKeyPair(private_key, program, function_id, inputs, imports, edition) {
10773
+ static synthesizeKeyPair(private_key, program, function_id, inputs, imports, edition, program_imports) {
10296
10774
  _assertClass(private_key, PrivateKey);
10297
10775
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10298
10776
  const len0 = WASM_VECTOR_LEN;
10299
10777
  const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10300
10778
  const len1 = WASM_VECTOR_LEN;
10301
- const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
10779
+ let ptr2 = 0;
10780
+ if (!isLikeNone(program_imports)) {
10781
+ _assertClass(program_imports, ProgramImports);
10782
+ ptr2 = program_imports.__destroy_into_raw();
10783
+ }
10784
+ const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
10302
10785
  return takeObject(ret);
10303
10786
  }
10304
10787
  /**
@@ -10337,9 +10820,10 @@ class ProgramManager {
10337
10820
  * @param {boolean} unchecked
10338
10821
  * @param {number | null | undefined} edition
10339
10822
  * @param {boolean} use_fee_master
10823
+ * @param {ProgramImports | null} [program_imports]
10340
10824
  * @returns {Promise<ProvingRequest>}
10341
10825
  */
10342
- static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked, edition, use_fee_master) {
10826
+ 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) {
10343
10827
  _assertClass(private_key, PrivateKey);
10344
10828
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10345
10829
  const len0 = WASM_VECTOR_LEN;
@@ -10350,7 +10834,12 @@ class ProgramManager {
10350
10834
  _assertClass(fee_record, RecordPlaintext);
10351
10835
  ptr2 = fee_record.__destroy_into_raw();
10352
10836
  }
10353
- const ret = wasm.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);
10837
+ let ptr3 = 0;
10838
+ if (!isLikeNone(program_imports)) {
10839
+ _assertClass(program_imports, ProgramImports);
10840
+ ptr3 = program_imports.__destroy_into_raw();
10841
+ }
10842
+ const ret = wasm.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);
10354
10843
  return takeObject(ret);
10355
10844
  }
10356
10845
  /**
@@ -10370,9 +10859,10 @@ class ProgramManager {
10370
10859
  * @param {number | null} [edition]
10371
10860
  * @param {object | null} [imports]
10372
10861
  * @param {PrivateKey | null} [private_key]
10862
+ * @param {ProgramImports | null} [program_imports]
10373
10863
  * @returns {Promise<ProvingRequest>}
10374
10864
  */
10375
- static buildProvingRequestFromExecutionRequest(request, program, unchecked, broadcast, edition, imports, private_key) {
10865
+ static buildProvingRequestFromExecutionRequest(request, program, unchecked, broadcast, edition, imports, private_key, program_imports) {
10376
10866
  _assertClass(request, ExecutionRequest);
10377
10867
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10378
10868
  const len0 = WASM_VECTOR_LEN;
@@ -10381,7 +10871,12 @@ class ProgramManager {
10381
10871
  _assertClass(private_key, PrivateKey);
10382
10872
  ptr1 = private_key.__destroy_into_raw();
10383
10873
  }
10384
- const ret = wasm.programmanager_buildProvingRequestFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, broadcast, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
10874
+ let ptr2 = 0;
10875
+ if (!isLikeNone(program_imports)) {
10876
+ _assertClass(program_imports, ProgramImports);
10877
+ ptr2 = program_imports.__destroy_into_raw();
10878
+ }
10879
+ const ret = wasm.programmanager_buildProvingRequestFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, broadcast, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1, ptr2);
10385
10880
  return takeObject(ret);
10386
10881
  }
10387
10882
  /**
@@ -10522,9 +11017,10 @@ class ProgramManager {
10522
11017
  * @param {RecordPlaintext | null} [fee_record]
10523
11018
  * @param {string | null} [url]
10524
11019
  * @param {object | null} [imports]
11020
+ * @param {ProgramImports | null} [program_imports]
10525
11021
  * @returns {Promise<Transaction>}
10526
11022
  */
10527
- static buildDevnodeDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports) {
11023
+ static buildDevnodeDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, program_imports) {
10528
11024
  _assertClass(private_key, PrivateKey);
10529
11025
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10530
11026
  const len0 = WASM_VECTOR_LEN;
@@ -10535,7 +11031,12 @@ class ProgramManager {
10535
11031
  }
10536
11032
  var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10537
11033
  var len2 = WASM_VECTOR_LEN;
10538
- const ret = wasm.programmanager_buildDevnodeDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports));
11034
+ let ptr3 = 0;
11035
+ if (!isLikeNone(program_imports)) {
11036
+ _assertClass(program_imports, ProgramImports);
11037
+ ptr3 = program_imports.__destroy_into_raw();
11038
+ }
11039
+ const ret = wasm.programmanager_buildDevnodeDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3);
10539
11040
  return takeObject(ret);
10540
11041
  }
10541
11042
  /**
@@ -10563,9 +11064,10 @@ class ProgramManager {
10563
11064
  * @param {RecordPlaintext | null} [fee_record]
10564
11065
  * @param {string | null} [url]
10565
11066
  * @param {object | null} [imports]
11067
+ * @param {ProgramImports | null} [program_imports]
10566
11068
  * @returns {Promise<Transaction>}
10567
11069
  */
10568
- static buildDevnodeUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports) {
11070
+ static buildDevnodeUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, program_imports) {
10569
11071
  _assertClass(private_key, PrivateKey);
10570
11072
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10571
11073
  const len0 = WASM_VECTOR_LEN;
@@ -10576,7 +11078,12 @@ class ProgramManager {
10576
11078
  }
10577
11079
  var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10578
11080
  var len2 = WASM_VECTOR_LEN;
10579
- const ret = wasm.programmanager_buildDevnodeUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports));
11081
+ let ptr3 = 0;
11082
+ if (!isLikeNone(program_imports)) {
11083
+ _assertClass(program_imports, ProgramImports);
11084
+ ptr3 = program_imports.__destroy_into_raw();
11085
+ }
11086
+ const ret = wasm.programmanager_buildDevnodeUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3);
10580
11087
  return takeObject(ret);
10581
11088
  }
10582
11089
  /**
@@ -10620,12 +11127,18 @@ class ProgramManager {
10620
11127
  * @returns {u64}
10621
11128
  * @param {string} program
10622
11129
  * @param {object | null} [imports]
11130
+ * @param {ProgramImports | null} [program_imports]
10623
11131
  * @returns {Promise<bigint>}
10624
11132
  */
10625
- static estimateDeploymentFee(program, imports) {
11133
+ static estimateDeploymentFee(program, imports, program_imports) {
10626
11134
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10627
11135
  const len0 = WASM_VECTOR_LEN;
10628
- const ret = wasm.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports));
11136
+ let ptr1 = 0;
11137
+ if (!isLikeNone(program_imports)) {
11138
+ _assertClass(program_imports, ProgramImports);
11139
+ ptr1 = program_imports.__destroy_into_raw();
11140
+ }
11141
+ const ret = wasm.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
10629
11142
  return takeObject(ret);
10630
11143
  }
10631
11144
  /**
@@ -10655,9 +11168,10 @@ class ProgramManager {
10655
11168
  * @param {ProvingKey | null} [fee_proving_key]
10656
11169
  * @param {VerifyingKey | null} [fee_verifying_key]
10657
11170
  * @param {OfflineQuery | null} [offline_query]
11171
+ * @param {ProgramImports | null} [program_imports]
10658
11172
  * @returns {Promise<Transaction>}
10659
11173
  */
10660
- static buildDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
11174
+ static buildDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query, program_imports) {
10661
11175
  _assertClass(private_key, PrivateKey);
10662
11176
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10663
11177
  const len0 = WASM_VECTOR_LEN;
@@ -10683,7 +11197,12 @@ class ProgramManager {
10683
11197
  _assertClass(offline_query, OfflineQuery);
10684
11198
  ptr5 = offline_query.__destroy_into_raw();
10685
11199
  }
10686
- const ret = wasm.programmanager_buildDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
11200
+ let ptr6 = 0;
11201
+ if (!isLikeNone(program_imports)) {
11202
+ _assertClass(program_imports, ProgramImports);
11203
+ ptr6 = program_imports.__destroy_into_raw();
11204
+ }
11205
+ const ret = wasm.programmanager_buildDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5, ptr6);
10687
11206
  return takeObject(ret);
10688
11207
  }
10689
11208
  /**
@@ -10711,9 +11230,10 @@ class ProgramManager {
10711
11230
  * @param {ProvingKey | null} [fee_proving_key]
10712
11231
  * @param {VerifyingKey | null} [fee_verifying_key]
10713
11232
  * @param {OfflineQuery | null} [offline_query]
11233
+ * @param {ProgramImports | null} [program_imports]
10714
11234
  * @returns {Promise<Transaction>}
10715
11235
  */
10716
- static buildUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
11236
+ static buildUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query, program_imports) {
10717
11237
  _assertClass(private_key, PrivateKey);
10718
11238
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10719
11239
  const len0 = WASM_VECTOR_LEN;
@@ -10739,7 +11259,12 @@ class ProgramManager {
10739
11259
  _assertClass(offline_query, OfflineQuery);
10740
11260
  ptr5 = offline_query.__destroy_into_raw();
10741
11261
  }
10742
- const ret = wasm.programmanager_buildUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
11262
+ let ptr6 = 0;
11263
+ if (!isLikeNone(program_imports)) {
11264
+ _assertClass(program_imports, ProgramImports);
11265
+ ptr6 = program_imports.__destroy_into_raw();
11266
+ }
11267
+ const ret = wasm.programmanager_buildUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5, ptr6);
10743
11268
  return takeObject(ret);
10744
11269
  }
10745
11270
  /**
@@ -10753,19 +11278,10 @@ class ProgramManager {
10753
11278
  * @param priority_fee_credits The optional priority fee to be paid for the transaction
10754
11279
  * @param fee_record The record to spend the fee from
10755
11280
  * @param url The url of the Aleo network node to send the transaction to
10756
- * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
10757
- * `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
10758
- * and used for subsequent transactions. If this is set to 'false' the proving and verifying
10759
- * keys will be deallocated from memory after the transaction is executed.
10760
11281
  * @param imports (optional) Provide a list of imports to use for the function execution in the
10761
11282
  * form of a javascript object where the keys are a string of the program name and the values
10762
11283
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
10763
- * @param proving_key (optional) Provide a verifying key to use for the function execution
10764
- * @param verifying_key (optional) Provide a verifying key to use for the function execution
10765
- * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
10766
- * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
10767
- * @param offline_query An offline query object to use if building a transaction without an internet connection.
10768
- * @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.
11284
+ * @param edition The edition of the program to execute. Defaults to 1.
10769
11285
  * @returns {Transaction}
10770
11286
  * @param {PrivateKey} private_key
10771
11287
  * @param {string} program
@@ -10776,9 +11292,10 @@ class ProgramManager {
10776
11292
  * @param {string | null} [url]
10777
11293
  * @param {object | null} [imports]
10778
11294
  * @param {number | null} [edition]
11295
+ * @param {ProgramImports | null} [program_imports]
10779
11296
  * @returns {Promise<Transaction>}
10780
11297
  */
10781
- static buildDevnodeExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, edition) {
11298
+ static buildDevnodeExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, edition, program_imports) {
10782
11299
  _assertClass(private_key, PrivateKey);
10783
11300
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10784
11301
  const len0 = WASM_VECTOR_LEN;
@@ -10791,7 +11308,12 @@ class ProgramManager {
10791
11308
  }
10792
11309
  var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10793
11310
  var len3 = WASM_VECTOR_LEN;
10794
- const ret = wasm.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);
11311
+ let ptr4 = 0;
11312
+ if (!isLikeNone(program_imports)) {
11313
+ _assertClass(program_imports, ProgramImports);
11314
+ ptr4 = program_imports.__destroy_into_raw();
11315
+ }
11316
+ const ret = wasm.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);
10795
11317
  return takeObject(ret);
10796
11318
  }
10797
11319
  /**
@@ -10836,6 +11358,7 @@ class ProgramManager {
10836
11358
  * @param imports The imports of the program being executed.
10837
11359
  * @param url The url to get the inclusion proving information from.
10838
11360
  * @param offline_query Optional offline query object if building a Transaction offline.
11361
+ * @param edition The program edition (defaults to 1).
10839
11362
  * @param {Authorization} authorization
10840
11363
  * @param {Authorization | null | undefined} fee_authorization
10841
11364
  * @param {string} program
@@ -10846,9 +11369,11 @@ class ProgramManager {
10846
11369
  * @param {object | null} [imports]
10847
11370
  * @param {string | null} [url]
10848
11371
  * @param {QueryOption | null} [query]
11372
+ * @param {ProgramImports | null} [program_imports]
11373
+ * @param {number | null} [edition]
10849
11374
  * @returns {Promise<Transaction>}
10850
11375
  */
10851
- static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, query) {
11376
+ static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, query, program_imports, edition) {
10852
11377
  _assertClass(authorization, Authorization);
10853
11378
  var ptr0 = authorization.__destroy_into_raw();
10854
11379
  let ptr1 = 0;
@@ -10885,35 +11410,44 @@ class ProgramManager {
10885
11410
  _assertClass(query, QueryOption);
10886
11411
  ptr8 = query.__destroy_into_raw();
10887
11412
  }
10888
- const ret = wasm.programmanager_executeAuthorization(ptr0, ptr1, ptr2, len2, ptr3, ptr4, ptr5, ptr6, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr7, len7, ptr8);
11413
+ let ptr9 = 0;
11414
+ if (!isLikeNone(program_imports)) {
11415
+ _assertClass(program_imports, ProgramImports);
11416
+ ptr9 = program_imports.__destroy_into_raw();
11417
+ }
11418
+ const ret = wasm.programmanager_executeAuthorization(ptr0, ptr1, ptr2, len2, ptr3, ptr4, ptr5, ptr6, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr7, len7, ptr8, ptr9, isLikeNone(edition) ? 0xFFFFFF : edition);
10889
11419
  return takeObject(ret);
10890
11420
  }
10891
11421
  /**
10892
- * Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
10893
- * verifying keys will be stored in the ProgramManager's memory and used for subsequent
10894
- * program executions.
11422
+ * Estimate Fee for Aleo function execution.
10895
11423
  *
10896
11424
  * @param program The source code of the program to estimate the execution fee for.
10897
11425
  * @param function The name of the function to estimate the execution fee for.
10898
11426
  * @param imports (optional) Provide a list of imports to use for the fee estimation in the
10899
11427
  * form of a javascript object where the keys are a string of the program name and the values
10900
11428
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
10901
- * @param edition {
11429
+ * @param edition The edition of the program. Defaults to 1.
10902
11430
  * @returns {u64} Fee in microcredits
10903
11431
  * @param {string} program
10904
11432
  * @param {string} _function
10905
11433
  * @param {object | null} [imports]
10906
11434
  * @param {number | null} [edition]
11435
+ * @param {ProgramImports | null} [program_imports]
10907
11436
  * @returns {bigint}
10908
11437
  */
10909
- static estimateExecutionFee(program, _function, imports, edition) {
11438
+ static estimateExecutionFee(program, _function, imports, edition, program_imports) {
10910
11439
  try {
10911
11440
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10912
11441
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10913
11442
  const len0 = WASM_VECTOR_LEN;
10914
11443
  const ptr1 = passStringToWasm0(_function, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10915
11444
  const len1 = WASM_VECTOR_LEN;
10916
- wasm.programmanager_estimateExecutionFee(retptr, ptr0, len0, ptr1, len1, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11445
+ let ptr2 = 0;
11446
+ if (!isLikeNone(program_imports)) {
11447
+ _assertClass(program_imports, ProgramImports);
11448
+ ptr2 = program_imports.__destroy_into_raw();
11449
+ }
11450
+ wasm.programmanager_estimateExecutionFee(retptr, ptr0, len0, ptr1, len1, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
10917
11451
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
10918
11452
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10919
11453
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -10942,7 +11476,7 @@ class ProgramManager {
10942
11476
  * @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
10943
11477
  * form of a javascript object where the keys are a string of the program name and the values
10944
11478
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
10945
- * @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
11479
+ * @param {ProvingKey | undefined} proving_key (optional) Provide a proving key to use for the function execution
10946
11480
  * @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
10947
11481
  * @param {PrivateKey} private_key
10948
11482
  * @param {string} program
@@ -10956,9 +11490,10 @@ class ProgramManager {
10956
11490
  * @param {string | null} [url]
10957
11491
  * @param {QueryOption | null} [query]
10958
11492
  * @param {number | null} [edition]
11493
+ * @param {ProgramImports | null} [program_imports]
10959
11494
  * @returns {Promise<ExecutionResponse>}
10960
11495
  */
10961
- static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, query, edition) {
11496
+ static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, query, edition, program_imports) {
10962
11497
  _assertClass(private_key, PrivateKey);
10963
11498
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10964
11499
  const len0 = WASM_VECTOR_LEN;
@@ -10981,7 +11516,12 @@ class ProgramManager {
10981
11516
  _assertClass(query, QueryOption);
10982
11517
  ptr5 = query.__destroy_into_raw();
10983
11518
  }
10984
- const ret = wasm.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);
11519
+ let ptr6 = 0;
11520
+ if (!isLikeNone(program_imports)) {
11521
+ _assertClass(program_imports, ProgramImports);
11522
+ ptr6 = program_imports.__destroy_into_raw();
11523
+ }
11524
+ const ret = wasm.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);
10985
11525
  return takeObject(ret);
10986
11526
  }
10987
11527
  /**
@@ -11047,15 +11587,21 @@ class ProgramManager {
11047
11587
  * @param {string} program
11048
11588
  * @param {object | null} [imports]
11049
11589
  * @param {number | null} [edition]
11590
+ * @param {ProgramImports | null} [program_imports]
11050
11591
  * @returns {bigint}
11051
11592
  */
11052
- static estimateFeeForAuthorization(authorization, program, imports, edition) {
11593
+ static estimateFeeForAuthorization(authorization, program, imports, edition, program_imports) {
11053
11594
  try {
11054
11595
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
11055
11596
  _assertClass(authorization, Authorization);
11056
11597
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11057
11598
  const len0 = WASM_VECTOR_LEN;
11058
- wasm.programmanager_estimateFeeForAuthorization(retptr, authorization.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11599
+ let ptr1 = 0;
11600
+ if (!isLikeNone(program_imports)) {
11601
+ _assertClass(program_imports, ProgramImports);
11602
+ ptr1 = program_imports.__destroy_into_raw();
11603
+ }
11604
+ wasm.programmanager_estimateFeeForAuthorization(retptr, authorization.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr1);
11059
11605
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
11060
11606
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
11061
11607
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -11077,19 +11623,15 @@ class ProgramManager {
11077
11623
  * @param priority_fee_credits The optional priority fee to be paid for the transaction
11078
11624
  * @param fee_record The record to spend the fee from
11079
11625
  * @param url The url of the Aleo network node to send the transaction to
11080
- * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
11081
- * `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
11082
- * and used for subsequent transactions. If this is set to 'false' the proving and verifying
11083
- * keys will be deallocated from memory after the transaction is executed.
11084
11626
  * @param imports (optional) Provide a list of imports to use for the function execution in the
11085
11627
  * form of a javascript object where the keys are a string of the program name and the values
11086
11628
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
11087
- * @param proving_key (optional) Provide a verifying key to use for the function execution
11629
+ * @param proving_key (optional) Provide a proving key to use for the function execution
11088
11630
  * @param verifying_key (optional) Provide a verifying key to use for the function execution
11089
11631
  * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
11090
11632
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
11091
11633
  * @param offline_query An offline query object to use if building a transaction without an internet connection.
11092
- * @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.
11634
+ * @param edition The edition of the program to execute. Defaults to 1.
11093
11635
  * @returns {Transaction}
11094
11636
  * @param {PrivateKey} private_key
11095
11637
  * @param {string} program
@@ -11105,9 +11647,10 @@ class ProgramManager {
11105
11647
  * @param {VerifyingKey | null} [fee_verifying_key]
11106
11648
  * @param {QueryOption | null} [query]
11107
11649
  * @param {number | null} [edition]
11650
+ * @param {ProgramImports | null} [program_imports]
11108
11651
  * @returns {Promise<Transaction>}
11109
11652
  */
11110
- 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) {
11653
+ 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) {
11111
11654
  _assertClass(private_key, PrivateKey);
11112
11655
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11113
11656
  const len0 = WASM_VECTOR_LEN;
@@ -11145,7 +11688,12 @@ class ProgramManager {
11145
11688
  _assertClass(query, QueryOption);
11146
11689
  ptr8 = query.__destroy_into_raw();
11147
11690
  }
11148
- const ret = wasm.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);
11691
+ let ptr9 = 0;
11692
+ if (!isLikeNone(program_imports)) {
11693
+ _assertClass(program_imports, ProgramImports);
11694
+ ptr9 = program_imports.__destroy_into_raw();
11695
+ }
11696
+ const ret = wasm.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);
11149
11697
  return takeObject(ret);
11150
11698
  }
11151
11699
  /**
@@ -11270,9 +11818,10 @@ class ProgramManager {
11270
11818
  * @param {number | null} [edition]
11271
11819
  * @param {object | null} [imports]
11272
11820
  * @param {PrivateKey | null} [private_key]
11821
+ * @param {ProgramImports | null} [program_imports]
11273
11822
  * @returns {Promise<Authorization>}
11274
11823
  */
11275
- static buildAuthorizationFromExecutionRequest(request, program, unchecked, edition, imports, private_key) {
11824
+ static buildAuthorizationFromExecutionRequest(request, program, unchecked, edition, imports, private_key, program_imports) {
11276
11825
  _assertClass(request, ExecutionRequest);
11277
11826
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11278
11827
  const len0 = WASM_VECTOR_LEN;
@@ -11281,7 +11830,12 @@ class ProgramManager {
11281
11830
  _assertClass(private_key, PrivateKey);
11282
11831
  ptr1 = private_key.__destroy_into_raw();
11283
11832
  }
11284
- const ret = wasm.programmanager_buildAuthorizationFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
11833
+ let ptr2 = 0;
11834
+ if (!isLikeNone(program_imports)) {
11835
+ _assertClass(program_imports, ProgramImports);
11836
+ ptr2 = program_imports.__destroy_into_raw();
11837
+ }
11838
+ const ret = wasm.programmanager_buildAuthorizationFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1, ptr2);
11285
11839
  return takeObject(ret);
11286
11840
  }
11287
11841
  /**
@@ -11299,15 +11853,21 @@ class ProgramManager {
11299
11853
  * @param {Array<any>} inputs
11300
11854
  * @param {object | null} [imports]
11301
11855
  * @param {number | null} [edition]
11856
+ * @param {ProgramImports | null} [program_imports]
11302
11857
  * @returns {Promise<Authorization>}
11303
11858
  */
11304
- static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports, edition) {
11859
+ static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports, edition, program_imports) {
11305
11860
  _assertClass(private_key, PrivateKey);
11306
11861
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11307
11862
  const len0 = WASM_VECTOR_LEN;
11308
11863
  const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11309
11864
  const len1 = WASM_VECTOR_LEN;
11310
- const ret = wasm.programmanager_buildAuthorizationUnchecked(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11865
+ let ptr2 = 0;
11866
+ if (!isLikeNone(program_imports)) {
11867
+ _assertClass(program_imports, ProgramImports);
11868
+ ptr2 = program_imports.__destroy_into_raw();
11869
+ }
11870
+ const ret = wasm.programmanager_buildAuthorizationUnchecked(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
11311
11871
  return takeObject(ret);
11312
11872
  }
11313
11873
  /**
@@ -11324,15 +11884,21 @@ class ProgramManager {
11324
11884
  * @param {Array<any>} inputs
11325
11885
  * @param {object | null} [imports]
11326
11886
  * @param {number | null} [edition]
11887
+ * @param {ProgramImports | null} [program_imports]
11327
11888
  * @returns {Promise<Authorization>}
11328
11889
  */
11329
- static authorize(private_key, program, function_name, inputs, imports, edition) {
11890
+ static authorize(private_key, program, function_name, inputs, imports, edition, program_imports) {
11330
11891
  _assertClass(private_key, PrivateKey);
11331
11892
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11332
11893
  const len0 = WASM_VECTOR_LEN;
11333
11894
  const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11334
11895
  const len1 = WASM_VECTOR_LEN;
11335
- const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11896
+ let ptr2 = 0;
11897
+ if (!isLikeNone(program_imports)) {
11898
+ _assertClass(program_imports, ProgramImports);
11899
+ ptr2 = program_imports.__destroy_into_raw();
11900
+ }
11901
+ const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
11336
11902
  return takeObject(ret);
11337
11903
  }
11338
11904
  }
@@ -11836,6 +12402,17 @@ const ProvingRequestFinalization = (typeof FinalizationRegistry === 'undefined')
11836
12402
  : new FinalizationRegistry(ptr => wasm.__wbg_provingrequest_free(ptr >>> 0, 1));
11837
12403
  /**
11838
12404
  * Represents a proving request to a prover.
12405
+ *
12406
+ * Carries one of two variants:
12407
+ * - `Authorization` — a fully-constructed snarkVM `Authorization` (plus optional
12408
+ * fee authorization). Submitted to `/prove/authorization` (encrypted-only).
12409
+ * - `Request` — a single signed snarkVM `Request` (plus optional fee `Request`)
12410
+ * that the prover authorizes server-side. Submitted to `/prove/request`
12411
+ * (encrypted-only).
12412
+ *
12413
+ * Use {@link ProvingRequest#kind} when handling a `ProvingRequest` of unknown
12414
+ * variant (e.g. after deserialization). Variant-specific accessors throw if
12415
+ * called on the wrong variant.
11839
12416
  */
11840
12417
  class ProvingRequest {
11841
12418
 
@@ -11859,9 +12436,23 @@ class ProvingRequest {
11859
12436
  wasm.__wbg_provingrequest_free(ptr, 0);
11860
12437
  }
11861
12438
  /**
11862
- * Creates a ProvingRequest from a string representation.
12439
+ * Returns the signed fee `ExecutionRequest` in the Request variant, or
12440
+ * `undefined` when no fee request is set or this is an Authorization variant.
12441
+ * @returns {ExecutionRequest | undefined}
12442
+ */
12443
+ feeRequest() {
12444
+ const ret = wasm.provingrequest_feeRequest(this.__wbg_ptr);
12445
+ return ret === 0 ? undefined : ExecutionRequest.__wrap(ret);
12446
+ }
12447
+ /**
12448
+ * Creates a `ProvingRequest` from a JSON string representation.
11863
12449
  *
11864
- * @param {Uint8Array} request String representation of the ProvingRequest.
12450
+ * The variant is determined automatically by the JSON shape:
12451
+ * `{ authorization, ... }` → Authorization variant; `{ request, ... }` →
12452
+ * Request variant. Use {@link ProvingRequest#kind} to inspect the
12453
+ * resulting variant.
12454
+ *
12455
+ * @param {string} request JSON string representation of the ProvingRequest.
11865
12456
  * @param {string} request
11866
12457
  * @returns {ProvingRequest}
11867
12458
  */
@@ -11883,7 +12474,10 @@ class ProvingRequest {
11883
12474
  }
11884
12475
  }
11885
12476
  /**
11886
- * Creates a left-endian byte representation of the ProvingRequest.
12477
+ * Creates a left-endian byte representation of the ProvingRequest,
12478
+ * dispatching on the variant. The bytes are wire-compatible with the
12479
+ * matching DPS route (`/prove[/encrypted]` for Authorization,
12480
+ * `/prove/request` for Request).
11887
12481
  * @returns {Uint8Array}
11888
12482
  */
11889
12483
  toBytesLe() {
@@ -11902,17 +12496,64 @@ class ProvingRequest {
11902
12496
  }
11903
12497
  }
11904
12498
  /**
11905
- * Get the Authorization of the main function in the ProvingRequest.
12499
+ * Creates a new Request-variant `ProvingRequest` from a single signed
12500
+ * `ExecutionRequest` and an optional signed fee `ExecutionRequest`.
12501
+ *
12502
+ * The Request variant is processed by the DPS at the `/prove/request`
12503
+ * endpoint, which is encrypted-only. The server runs
12504
+ * `Process::authorize_request` to turn each `Request` into an
12505
+ * `Authorization` before proving.
12506
+ *
12507
+ * Only valid for single-public-request executions. Layered / nested
12508
+ * calls are not supported by `/prove/request` at this time.
12509
+ *
12510
+ * @param {ExecutionRequest} request The signed request for the function.
12511
+ * @param {ExecutionRequest} fee_request Optional signed request for the fee function. When omitted, the prover generates and pays the fee.
12512
+ * @param {boolean} broadcast Flag that indicates whether the remote proving service should attempt to submit the transaction on the caller's behalf.
12513
+ * @param {ExecutionRequest} request
12514
+ * @param {ExecutionRequest | null | undefined} fee_request
12515
+ * @param {boolean} broadcast
12516
+ * @returns {ProvingRequest}
12517
+ */
12518
+ static fromRequest(request, fee_request, broadcast) {
12519
+ _assertClass(request, ExecutionRequest);
12520
+ var ptr0 = request.__destroy_into_raw();
12521
+ let ptr1 = 0;
12522
+ if (!isLikeNone(fee_request)) {
12523
+ _assertClass(fee_request, ExecutionRequest);
12524
+ ptr1 = fee_request.__destroy_into_raw();
12525
+ }
12526
+ const ret = wasm.provingrequest_fromRequest(ptr0, ptr1, broadcast);
12527
+ return ProvingRequest.__wrap(ret);
12528
+ }
12529
+ /**
12530
+ * Returns the Authorization of the main function in the ProvingRequest.
12531
+ *
12532
+ * @throws If this `ProvingRequest` is a Request variant. Check
12533
+ * {@link ProvingRequest#kind} or use {@link ProvingRequest#request} instead.
11906
12534
  * @returns {Authorization}
11907
12535
  */
11908
12536
  authorization() {
11909
- const ret = wasm.provingrequest_authorization(this.__wbg_ptr);
11910
- return Authorization.__wrap(ret);
12537
+ try {
12538
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
12539
+ wasm.provingrequest_authorization(retptr, this.__wbg_ptr);
12540
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12541
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12542
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
12543
+ if (r2) {
12544
+ throw takeObject(r1);
12545
+ }
12546
+ return Authorization.__wrap(r0);
12547
+ } finally {
12548
+ wasm.__wbindgen_add_to_stack_pointer(16);
12549
+ }
11911
12550
  }
11912
12551
  /**
11913
- * Creates a ProvingRequest from a left-endian byte representation of the ProvingRequest.
12552
+ * Reads bytes as an Authorization-variant `ProvingRequest`. For the
12553
+ * Request variant, use {@link ProvingRequest.fromBytesLeRequest}
12554
+ * explicitly — byte layout carries no variant discriminator.
11914
12555
  *
11915
- * @param {Uint8Array} bytes Left-endian bytes representing the proving request.
12556
+ * @param {Uint8Array} bytes Left-endian bytes representing an Authorization-variant proving request.
11916
12557
  * @param {Uint8Array} bytes
11917
12558
  * @returns {ProvingRequest}
11918
12559
  */
@@ -11932,7 +12573,8 @@ class ProvingRequest {
11932
12573
  }
11933
12574
  }
11934
12575
  /**
11935
- * Get the fee Authorization in the ProvingRequest.
12576
+ * Returns the fee Authorization in the ProvingRequest, or `undefined`
12577
+ * when no fee is set or this is a Request variant.
11936
12578
  * @returns {Authorization | undefined}
11937
12579
  */
11938
12580
  feeAuthorization() {
@@ -11940,7 +12582,32 @@ class ProvingRequest {
11940
12582
  return ret === 0 ? undefined : Authorization.__wrap(ret);
11941
12583
  }
11942
12584
  /**
11943
- * Creates a new ProvingRequest from a function Authorization and an optional fee Authorization.
12585
+ * Reads bytes as a Request-variant `ProvingRequest`. Byte layout is
12586
+ * disjoint from the Authorization variant; callers must pick the right
12587
+ * reader for the bytes they hold.
12588
+ *
12589
+ * @param {Uint8Array} bytes Left-endian bytes representing a Request-variant proving request.
12590
+ * @param {Uint8Array} bytes
12591
+ * @returns {ProvingRequest}
12592
+ */
12593
+ static fromBytesLeRequest(bytes) {
12594
+ try {
12595
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
12596
+ wasm.provingrequest_fromBytesLeRequest(retptr, addHeapObject(bytes));
12597
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12598
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12599
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
12600
+ if (r2) {
12601
+ throw takeObject(r1);
12602
+ }
12603
+ return ProvingRequest.__wrap(r0);
12604
+ } finally {
12605
+ wasm.__wbindgen_add_to_stack_pointer(16);
12606
+ }
12607
+ }
12608
+ /**
12609
+ * Creates a new Authorization-variant `ProvingRequest` from a function
12610
+ * `Authorization` and an optional fee `Authorization`.
11944
12611
  *
11945
12612
  * @param {Authorization} authorization An Authorization for a function.
11946
12613
  * @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.
@@ -11961,6 +12628,28 @@ class ProvingRequest {
11961
12628
  const ret = wasm.provingrequest_new(ptr0, ptr1, broadcast);
11962
12629
  return ProvingRequest.__wrap(ret);
11963
12630
  }
12631
+ /**
12632
+ * Returns the variant of this `ProvingRequest`: `"authorization"` or
12633
+ * `"request"`. Useful when handling a `ProvingRequest` whose variant
12634
+ * was determined at deserialization time.
12635
+ * @returns {string}
12636
+ */
12637
+ kind() {
12638
+ let deferred1_0;
12639
+ let deferred1_1;
12640
+ try {
12641
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
12642
+ wasm.provingrequest_kind(retptr, this.__wbg_ptr);
12643
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12644
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12645
+ deferred1_0 = r0;
12646
+ deferred1_1 = r1;
12647
+ return getStringFromWasm0(r0, r1);
12648
+ } finally {
12649
+ wasm.__wbindgen_add_to_stack_pointer(16);
12650
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
12651
+ }
12652
+ }
11964
12653
  /**
11965
12654
  * Check if a ProvingRequest is the same as another ProvingRequest.
11966
12655
  * @param {ProvingRequest} other
@@ -11971,6 +12660,29 @@ class ProvingRequest {
11971
12660
  const ret = wasm.provingrequest_equals(this.__wbg_ptr, other.__wbg_ptr);
11972
12661
  return ret !== 0;
11973
12662
  }
12663
+ /**
12664
+ * Returns the signed `ExecutionRequest` carried by the Request variant.
12665
+ *
12666
+ * @throws If this `ProvingRequest` is an Authorization variant. Check
12667
+ * {@link ProvingRequest#kind} or use {@link ProvingRequest#authorization}
12668
+ * instead.
12669
+ * @returns {ExecutionRequest}
12670
+ */
12671
+ request() {
12672
+ try {
12673
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
12674
+ wasm.provingrequest_request(retptr, this.__wbg_ptr);
12675
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12676
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12677
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
12678
+ if (r2) {
12679
+ throw takeObject(r1);
12680
+ }
12681
+ return ExecutionRequest.__wrap(r0);
12682
+ } finally {
12683
+ wasm.__wbindgen_add_to_stack_pointer(16);
12684
+ }
12685
+ }
11974
12686
  /**
11975
12687
  * Get the broadcast flag set in the ProvingRequest.
11976
12688
  * @returns {boolean}
@@ -11980,7 +12692,9 @@ class ProvingRequest {
11980
12692
  return ret !== 0;
11981
12693
  }
11982
12694
  /**
11983
- * Creates a string representation of the ProvingRequest.
12695
+ * Creates a JSON string representation of the ProvingRequest.
12696
+ * The shape carries enough information to recover the variant via
12697
+ * {@link ProvingRequest.fromString}.
11984
12698
  * @returns {string}
11985
12699
  */
11986
12700
  toString() {
@@ -18294,6 +19008,10 @@ function __wbg_get_imports(memory) {
18294
19008
  const ret = typeof(getObject(arg0)) === 'function';
18295
19009
  return ret;
18296
19010
  };
19011
+ imports.wbg.__wbg___wbindgen_is_null_5e69f72e906cc57c = function(arg0) {
19012
+ const ret = getObject(arg0) === null;
19013
+ return ret;
19014
+ };
18297
19015
  imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
18298
19016
  const val = getObject(arg0);
18299
19017
  const ret = typeof(val) === 'object' && val !== null;
@@ -18458,6 +19176,16 @@ function __wbg_get_imports(memory) {
18458
19176
  const ret = getObject(arg0).headers;
18459
19177
  return addHeapObject(ret);
18460
19178
  };
19179
+ imports.wbg.__wbg_instanceof_Object_10bb762262230c68 = function(arg0) {
19180
+ let result;
19181
+ try {
19182
+ result = getObject(arg0) instanceof Object;
19183
+ } catch (_) {
19184
+ result = false;
19185
+ }
19186
+ const ret = result;
19187
+ return ret;
19188
+ };
18461
19189
  imports.wbg.__wbg_instanceof_Promise_001fdd42afa1b7ef = function(arg0) {
18462
19190
  let result;
18463
19191
  try {
@@ -18512,7 +19240,7 @@ function __wbg_get_imports(memory) {
18512
19240
  const ret = getObject(arg0).length;
18513
19241
  return ret;
18514
19242
  };
18515
- imports.wbg.__wbg_log_78f898e0b3066062 = function(arg0, arg1) {
19243
+ imports.wbg.__wbg_log_b88efcc0ed7757a6 = function(arg0, arg1) {
18516
19244
  console.log(getStringFromWasm0(arg0, arg1));
18517
19245
  };
18518
19246
  imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
@@ -18534,7 +19262,7 @@ function __wbg_get_imports(memory) {
18534
19262
  const a = state0.a;
18535
19263
  state0.a = 0;
18536
19264
  try {
18537
- return __wasm_bindgen_func_elem_7479(a, state0.b, arg0, arg1);
19265
+ return __wasm_bindgen_func_elem_7560(a, state0.b, arg0, arg1);
18538
19266
  } finally {
18539
19267
  state0.a = a;
18540
19268
  }
@@ -18721,7 +19449,7 @@ function __wbg_get_imports(memory) {
18721
19449
  const ret = Signature.__wrap(arg0);
18722
19450
  return addHeapObject(ret);
18723
19451
  };
18724
- imports.wbg.__wbg_spawnWorker_16cedfb6613c80ac = function(arg0, arg1, arg2, arg3) {
19452
+ imports.wbg.__wbg_spawnWorker_6ede797d507e374c = function(arg0, arg1, arg2, arg3) {
18725
19453
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
18726
19454
  return addHeapObject(ret);
18727
19455
  };
@@ -18823,7 +19551,7 @@ function __wbg_get_imports(memory) {
18823
19551
  };
18824
19552
  imports.wbg.__wbindgen_cast_3ebebf8ee554379e = function(arg0, arg1) {
18825
19553
  // 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`.
18826
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7205, __wasm_bindgen_func_elem_8569);
19554
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
18827
19555
  return addHeapObject(ret);
18828
19556
  };
18829
19557
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
@@ -18833,12 +19561,12 @@ function __wbg_get_imports(memory) {
18833
19561
  };
18834
19562
  imports.wbg.__wbindgen_cast_5e9bcb6388942484 = function(arg0, arg1) {
18835
19563
  // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [], shim_idx: 462, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18836
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7205, __wasm_bindgen_func_elem_7206);
19564
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_7287);
18837
19565
  return addHeapObject(ret);
18838
19566
  };
18839
19567
  imports.wbg.__wbindgen_cast_74f3a90a349943d1 = function(arg0, arg1) {
18840
19568
  // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [Externref], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18841
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7205, __wasm_bindgen_func_elem_8569);
19569
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
18842
19570
  return addHeapObject(ret);
18843
19571
  };
18844
19572
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -18982,6 +19710,7 @@ var exports$1 = /*#__PURE__*/Object.freeze({
18982
19710
  PrivateKey: PrivateKey,
18983
19711
  PrivateKeyCiphertext: PrivateKeyCiphertext,
18984
19712
  Program: Program,
19713
+ ProgramImports: ProgramImports,
18985
19714
  ProgramManager: ProgramManager,
18986
19715
  Proof: Proof,
18987
19716
  ProvingKey: ProvingKey,
@@ -19006,6 +19735,7 @@ var exports$1 = /*#__PURE__*/Object.freeze({
19006
19735
  initSync: initSync,
19007
19736
  initThreadPool: initThreadPool,
19008
19737
  runRayonThread: runRayonThread,
19738
+ setWasmLogLevel: setWasmLogLevel,
19009
19739
  snarkVerify: snarkVerify,
19010
19740
  snarkVerifyBatch: snarkVerifyBatch,
19011
19741
  stringToField: stringToField,