@provablehq/wasm 0.10.1 → 0.10.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -354,9 +354,10 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
354
354
  * @param {object | null | undefined} imports
355
355
  * @param {object | null | undefined} imported_verifying_keys
356
356
  * @param {number} block_height
357
+ * @param {ProgramImports | null} [program_imports]
357
358
  * @returns {boolean}
358
359
  */
359
- function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height) {
360
+ function verifyFunctionExecution(execution, verifying_key, program, function_id, imports, imported_verifying_keys, block_height, program_imports) {
360
361
  try {
361
362
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
362
363
  _assertClass(execution, Execution);
@@ -364,7 +365,12 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
364
365
  _assertClass(program, Program);
365
366
  const ptr0 = passStringToWasm0(function_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
366
367
  const len0 = WASM_VECTOR_LEN;
367
- 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);
368
+ let ptr1 = 0;
369
+ if (!isLikeNone(program_imports)) {
370
+ _assertClass(program_imports, ProgramImports);
371
+ ptr1 = program_imports.__destroy_into_raw();
372
+ }
373
+ 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);
368
374
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
369
375
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
370
376
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -471,16 +477,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
471
477
  }
472
478
  return result;
473
479
  }
474
- function __wasm_bindgen_func_elem_7164(arg0, arg1) {
475
- wasm.__wasm_bindgen_func_elem_7164(arg0, arg1);
480
+ function __wasm_bindgen_func_elem_7211(arg0, arg1) {
481
+ wasm.__wasm_bindgen_func_elem_7211(arg0, arg1);
476
482
  }
477
483
 
478
- function __wasm_bindgen_func_elem_8529(arg0, arg1, arg2) {
479
- wasm.__wasm_bindgen_func_elem_8529(arg0, arg1, addHeapObject(arg2));
484
+ function __wasm_bindgen_func_elem_8576(arg0, arg1, arg2) {
485
+ wasm.__wasm_bindgen_func_elem_8576(arg0, arg1, addHeapObject(arg2));
480
486
  }
481
487
 
482
- function __wasm_bindgen_func_elem_7436(arg0, arg1, arg2, arg3) {
483
- wasm.__wasm_bindgen_func_elem_7436(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
488
+ function __wasm_bindgen_func_elem_7483(arg0, arg1, arg2, arg3) {
489
+ wasm.__wasm_bindgen_func_elem_7483(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
484
490
  }
485
491
 
486
492
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -10208,6 +10214,436 @@ class Program {
10208
10214
  }
10209
10215
  if (Symbol.dispose) Program.prototype[Symbol.dispose] = Program.prototype.free;
10210
10216
 
10217
+ const ProgramImportsFinalization = (typeof FinalizationRegistry === 'undefined')
10218
+ ? { register: () => {}, unregister: () => {} }
10219
+ : new FinalizationRegistry(ptr => wasm.__wbg_programimports_free(ptr >>> 0, 1));
10220
+ /**
10221
+ * Backed by `Rc<RefCell<>>` for interior mutability — cloning produces a cheap
10222
+ * reference-counted copy that shares the same underlying data. This allows
10223
+ * execution functions to clone the builder internally while the caller's
10224
+ * original reference automatically sees any mutations (e.g. synthesized keys).
10225
+ */
10226
+ class ProgramImports {
10227
+
10228
+ static __wrap(ptr) {
10229
+ ptr = ptr >>> 0;
10230
+ const obj = Object.create(ProgramImports.prototype);
10231
+ obj.__wbg_ptr = ptr;
10232
+ ProgramImportsFinalization.register(obj, obj.__wbg_ptr, obj);
10233
+ return obj;
10234
+ }
10235
+
10236
+ __destroy_into_raw() {
10237
+ const ptr = this.__wbg_ptr;
10238
+ this.__wbg_ptr = 0;
10239
+ ProgramImportsFinalization.unregister(this);
10240
+ return ptr;
10241
+ }
10242
+
10243
+ free() {
10244
+ const ptr = this.__destroy_into_raw();
10245
+ wasm.__wbg_programimports_free(ptr, 0);
10246
+ }
10247
+ /**
10248
+ * Add a program's source code to the imports.
10249
+ *
10250
+ * The source is parsed, validated, and added to the internal Process.
10251
+ * Static imports of the program are resolved depth-first from programs
10252
+ * already present in this builder.
10253
+ *
10254
+ * @param {string} name The program name (e.g., "my_program.aleo").
10255
+ * @param {string} source The program source code.
10256
+ * @param {number | undefined} edition The program edition (defaults to 1).
10257
+ * @param {string} name
10258
+ * @param {string} source
10259
+ * @param {number | null} [edition]
10260
+ */
10261
+ addProgram(name, source, edition) {
10262
+ try {
10263
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10264
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10265
+ const len0 = WASM_VECTOR_LEN;
10266
+ const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10267
+ const len1 = WASM_VECTOR_LEN;
10268
+ wasm.programimports_addProgram(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(edition) ? 0xFFFFFF : edition);
10269
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10270
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10271
+ if (r1) {
10272
+ throw takeObject(r0);
10273
+ }
10274
+ } finally {
10275
+ wasm.__wbindgen_add_to_stack_pointer(16);
10276
+ }
10277
+ }
10278
+ /**
10279
+ * Create a ProgramImports from a plain JavaScript object.
10280
+ *
10281
+ * Accepts three formats:
10282
+ * ```js
10283
+ * // 1. Plain string — source code only.
10284
+ * { "my_program.aleo": "program source..." }
10285
+ *
10286
+ * // 2. Structured — program source with optional edition.
10287
+ * { "my_program.aleo": { program: "program source..." } }
10288
+ *
10289
+ * // 3. Structured with keys — program source plus proving/verifying keys per function.
10290
+ * {
10291
+ * "my_program.aleo": {
10292
+ * program: "program source...",
10293
+ * keys: {
10294
+ * "my_function": {
10295
+ * provingKey: Uint8Array,
10296
+ * verifyingKey: Uint8Array
10297
+ * }
10298
+ * }
10299
+ * }
10300
+ * }
10301
+ * ```
10302
+ *
10303
+ * Programs created via this method default to edition 1.
10304
+ *
10305
+ * @param {Object} object A plain JavaScript object mapping program names to source code
10306
+ * and optional keys.
10307
+ * @returns {ProgramImports}
10308
+ * @param {object} object
10309
+ * @returns {ProgramImports}
10310
+ */
10311
+ static fromObject(object) {
10312
+ try {
10313
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10314
+ wasm.programimports_fromObject(retptr, addHeapObject(object));
10315
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10316
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10317
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10318
+ if (r2) {
10319
+ throw takeObject(r1);
10320
+ }
10321
+ return ProgramImports.__wrap(r0);
10322
+ } finally {
10323
+ wasm.__wbindgen_add_to_stack_pointer(16);
10324
+ }
10325
+ }
10326
+ /**
10327
+ * Return the source code of a program by name, without serializing keys.
10328
+ *
10329
+ * @param {string} name The program name (e.g., "my_program.aleo").
10330
+ * @returns {string | undefined}
10331
+ * @param {string} name
10332
+ * @returns {string | undefined}
10333
+ */
10334
+ getProgram(name) {
10335
+ try {
10336
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10337
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10338
+ const len0 = WASM_VECTOR_LEN;
10339
+ wasm.programimports_getProgram(retptr, this.__wbg_ptr, ptr0, len0);
10340
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10341
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10342
+ let v2;
10343
+ if (r0 !== 0) {
10344
+ v2 = getStringFromWasm0(r0, r1).slice();
10345
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
10346
+ }
10347
+ return v2;
10348
+ } finally {
10349
+ wasm.__wbindgen_add_to_stack_pointer(16);
10350
+ }
10351
+ }
10352
+ /**
10353
+ * Return the names of all programs in this builder as a JS `Array<string>`.
10354
+ *
10355
+ * This is a lightweight alternative to `toObject()` when you only need to
10356
+ * enumerate program names without serializing keys.
10357
+ *
10358
+ * @returns {Array<string>}
10359
+ * @returns {Array<any>}
10360
+ */
10361
+ programNames() {
10362
+ const ret = wasm.programimports_programNames(this.__wbg_ptr);
10363
+ return takeObject(ret);
10364
+ }
10365
+ /**
10366
+ * Add a proving key for a function or record within an imported program.
10367
+ *
10368
+ * The key is transferred directly from the WASM `ProvingKey` type with no
10369
+ * serialization overhead.
10370
+ *
10371
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10372
+ * @param {string} identifier The function name or record name the key belongs to.
10373
+ * @param {ProvingKey} key The proving key.
10374
+ * @param {string} program_name
10375
+ * @param {string} identifier
10376
+ * @param {ProvingKey} key
10377
+ */
10378
+ addProvingKey(program_name, identifier, key) {
10379
+ try {
10380
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10381
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10382
+ const len0 = WASM_VECTOR_LEN;
10383
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10384
+ const len1 = WASM_VECTOR_LEN;
10385
+ _assertClass(key, ProvingKey);
10386
+ var ptr2 = key.__destroy_into_raw();
10387
+ wasm.programimports_addProvingKey(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2);
10388
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10389
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10390
+ if (r1) {
10391
+ throw takeObject(r0);
10392
+ }
10393
+ } finally {
10394
+ wasm.__wbindgen_add_to_stack_pointer(16);
10395
+ }
10396
+ }
10397
+ /**
10398
+ * Get a proving key for a specific program and identifier (function or record name).
10399
+ * Returns a clone of the key from the internal Process. Non-destructive — the key
10400
+ * remains available for future calls.
10401
+ *
10402
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10403
+ * @param {string} identifier The function or record name.
10404
+ * @returns {ProvingKey | undefined}
10405
+ * @param {string} program_name
10406
+ * @param {string} identifier
10407
+ * @returns {ProvingKey | undefined}
10408
+ */
10409
+ getProvingKey(program_name, identifier) {
10410
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10411
+ const len0 = WASM_VECTOR_LEN;
10412
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10413
+ const len1 = WASM_VECTOR_LEN;
10414
+ const ret = wasm.programimports_getProvingKey(this.__wbg_ptr, ptr0, len0, ptr1, len1);
10415
+ return ret === 0 ? undefined : ProvingKey.__wrap(ret);
10416
+ }
10417
+ /**
10418
+ * Add a verifying key for a function or record within an imported program.
10419
+ *
10420
+ * The key is transferred directly from the WASM `VerifyingKey` type with no
10421
+ * serialization overhead.
10422
+ *
10423
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10424
+ * @param {string} identifier The function name or record name the key belongs to.
10425
+ * @param {VerifyingKey} key The verifying key.
10426
+ * @param {string} program_name
10427
+ * @param {string} identifier
10428
+ * @param {VerifyingKey} key
10429
+ */
10430
+ addVerifyingKey(program_name, identifier, key) {
10431
+ try {
10432
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10433
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10434
+ const len0 = WASM_VECTOR_LEN;
10435
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10436
+ const len1 = WASM_VECTOR_LEN;
10437
+ _assertClass(key, VerifyingKey);
10438
+ var ptr2 = key.__destroy_into_raw();
10439
+ wasm.programimports_addVerifyingKey(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2);
10440
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10441
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10442
+ if (r1) {
10443
+ throw takeObject(r0);
10444
+ }
10445
+ } finally {
10446
+ wasm.__wbindgen_add_to_stack_pointer(16);
10447
+ }
10448
+ }
10449
+ /**
10450
+ * Get a verifying key for a specific program and identifier (function or record name).
10451
+ * Returns a clone of the key from the internal Process. Non-destructive — the key
10452
+ * remains available for future calls.
10453
+ *
10454
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10455
+ * @param {string} identifier The function or record name.
10456
+ * @returns {VerifyingKey | undefined}
10457
+ * @param {string} program_name
10458
+ * @param {string} identifier
10459
+ * @returns {VerifyingKey | undefined}
10460
+ */
10461
+ getVerifyingKey(program_name, identifier) {
10462
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10463
+ const len0 = WASM_VECTOR_LEN;
10464
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10465
+ const len1 = WASM_VECTOR_LEN;
10466
+ const ret = wasm.programimports_getVerifyingKey(this.__wbg_ptr, ptr0, len0, ptr1, len1);
10467
+ return ret === 0 ? undefined : VerifyingKey.__wrap(ret);
10468
+ }
10469
+ /**
10470
+ * Add a proving key from its byte representation.
10471
+ *
10472
+ * Deserializes the bytes into a native proving key and stores it. The program
10473
+ * must already have been added via `addProgram`.
10474
+ *
10475
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10476
+ * @param {string} identifier The function name or record name the key belongs to.
10477
+ * @param {Uint8Array} bytes The proving key bytes.
10478
+ * @param {string} program_name
10479
+ * @param {string} identifier
10480
+ * @param {Uint8Array} bytes
10481
+ */
10482
+ addProvingKeyBytes(program_name, identifier, bytes) {
10483
+ try {
10484
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10485
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10486
+ const len0 = WASM_VECTOR_LEN;
10487
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10488
+ const len1 = WASM_VECTOR_LEN;
10489
+ const ptr2 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
10490
+ const len2 = WASM_VECTOR_LEN;
10491
+ wasm.programimports_addProvingKeyBytes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
10492
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10493
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10494
+ if (r1) {
10495
+ throw takeObject(r0);
10496
+ }
10497
+ } finally {
10498
+ wasm.__wbindgen_add_to_stack_pointer(16);
10499
+ }
10500
+ }
10501
+ /**
10502
+ * Add a verifying key from its byte representation.
10503
+ *
10504
+ * Deserializes the bytes into a native verifying key and stores it. The program
10505
+ * must already have been added via `addProgram`.
10506
+ *
10507
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10508
+ * @param {string} identifier The function name or record name the key belongs to.
10509
+ * @param {Uint8Array} bytes The verifying key bytes.
10510
+ * @param {string} program_name
10511
+ * @param {string} identifier
10512
+ * @param {Uint8Array} bytes
10513
+ */
10514
+ addVerifyingKeyBytes(program_name, identifier, bytes) {
10515
+ try {
10516
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10517
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10518
+ const len0 = WASM_VECTOR_LEN;
10519
+ const ptr1 = passStringToWasm0(identifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10520
+ const len1 = WASM_VECTOR_LEN;
10521
+ const ptr2 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
10522
+ const len2 = WASM_VECTOR_LEN;
10523
+ wasm.programimports_addVerifyingKeyBytes(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
10524
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10525
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10526
+ if (r1) {
10527
+ throw takeObject(r0);
10528
+ }
10529
+ } finally {
10530
+ wasm.__wbindgen_add_to_stack_pointer(16);
10531
+ }
10532
+ }
10533
+ /**
10534
+ * Return the names of functions that have both a proving key and a verifying key
10535
+ * stored for the given program.
10536
+ *
10537
+ * @param {string} program_name The program name (e.g., "my_program.aleo").
10538
+ * @returns {Array<string>}
10539
+ * @param {string} program_name
10540
+ * @returns {Array<any>}
10541
+ */
10542
+ functionKeysAvailable(program_name) {
10543
+ try {
10544
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10545
+ const ptr0 = passStringToWasm0(program_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10546
+ const len0 = WASM_VECTOR_LEN;
10547
+ wasm.programimports_functionKeysAvailable(retptr, this.__wbg_ptr, ptr0, len0);
10548
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10549
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10550
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10551
+ if (r2) {
10552
+ throw takeObject(r1);
10553
+ }
10554
+ return takeObject(r0);
10555
+ } finally {
10556
+ wasm.__wbindgen_add_to_stack_pointer(16);
10557
+ }
10558
+ }
10559
+ /**
10560
+ * Create a new empty ProgramImports builder.
10561
+ *
10562
+ * Initializes an internal snarkVM Process. This is the same cost as a
10563
+ * single execution call, but is paid once and reused across all operations.
10564
+ */
10565
+ constructor() {
10566
+ try {
10567
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10568
+ wasm.programimports_new(retptr);
10569
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
10570
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
10571
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10572
+ if (r2) {
10573
+ throw takeObject(r1);
10574
+ }
10575
+ this.__wbg_ptr = r0 >>> 0;
10576
+ ProgramImportsFinalization.register(this, this.__wbg_ptr, this);
10577
+ return this;
10578
+ } finally {
10579
+ wasm.__wbindgen_add_to_stack_pointer(16);
10580
+ }
10581
+ }
10582
+ /**
10583
+ * Create a cheap clone that shares the same underlying data.
10584
+ *
10585
+ * Useful for passing to WASM execution functions which consume ownership:
10586
+ * the caller keeps the original, and both copies see any mutations
10587
+ * (e.g. synthesized keys) through the shared interior state.
10588
+ * @returns {ProgramImports}
10589
+ */
10590
+ clone() {
10591
+ const ret = wasm.programimports_clone(this.__wbg_ptr);
10592
+ return ProgramImports.__wrap(ret);
10593
+ }
10594
+ /**
10595
+ * Check whether a specific program has been added.
10596
+ *
10597
+ * @param {string} name The program name.
10598
+ * @returns {boolean}
10599
+ * @param {string} name
10600
+ * @returns {boolean}
10601
+ */
10602
+ contains(name) {
10603
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10604
+ const len0 = WASM_VECTOR_LEN;
10605
+ const ret = wasm.programimports_contains(this.__wbg_ptr, ptr0, len0);
10606
+ return ret !== 0;
10607
+ }
10608
+ /**
10609
+ * Check whether any programs have been added to this builder.
10610
+ *
10611
+ * @returns {boolean}
10612
+ * @returns {boolean}
10613
+ */
10614
+ isEmpty() {
10615
+ const ret = wasm.programimports_isEmpty(this.__wbg_ptr);
10616
+ return ret !== 0;
10617
+ }
10618
+ /**
10619
+ * Convert this ProgramImports to a plain JavaScript object.
10620
+ *
10621
+ * Entries without keys use the simple `{ "name.aleo": "source" }` format.
10622
+ * Entries with keys use the structured format:
10623
+ * ```js
10624
+ * {
10625
+ * "name.aleo": {
10626
+ * program: "program source...",
10627
+ * keys: {
10628
+ * "function_name": {
10629
+ * provingKey: Uint8Array,
10630
+ * verifyingKey: Uint8Array
10631
+ * }
10632
+ * }
10633
+ * }
10634
+ * }
10635
+ * ```
10636
+ *
10637
+ * @returns {Object}
10638
+ * @returns {object}
10639
+ */
10640
+ toObject() {
10641
+ const ret = wasm.programimports_toObject(this.__wbg_ptr);
10642
+ return takeObject(ret);
10643
+ }
10644
+ }
10645
+ if (Symbol.dispose) ProgramImports.prototype[Symbol.dispose] = ProgramImports.prototype.free;
10646
+
10211
10647
  const ProgramManagerFinalization = (typeof FinalizationRegistry === 'undefined')
10212
10648
  ? { register: () => {}, unregister: () => {} }
10213
10649
  : new FinalizationRegistry(ptr => wasm.__wbg_programmanager_free(ptr >>> 0, 1));
@@ -10238,15 +10674,21 @@ class ProgramManager {
10238
10674
  * @param {Array<any>} inputs
10239
10675
  * @param {object | null} [imports]
10240
10676
  * @param {number | null} [edition]
10677
+ * @param {ProgramImports | null} [program_imports]
10241
10678
  * @returns {Promise<KeyPair>}
10242
10679
  */
10243
- static synthesizeKeyPair(private_key, program, function_id, inputs, imports, edition) {
10680
+ static synthesizeKeyPair(private_key, program, function_id, inputs, imports, edition, program_imports) {
10244
10681
  _assertClass(private_key, PrivateKey);
10245
10682
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10246
10683
  const len0 = WASM_VECTOR_LEN;
10247
10684
  const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10248
10685
  const len1 = WASM_VECTOR_LEN;
10249
- const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
10686
+ let ptr2 = 0;
10687
+ if (!isLikeNone(program_imports)) {
10688
+ _assertClass(program_imports, ProgramImports);
10689
+ ptr2 = program_imports.__destroy_into_raw();
10690
+ }
10691
+ 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);
10250
10692
  return takeObject(ret);
10251
10693
  }
10252
10694
  /**
@@ -10285,9 +10727,10 @@ class ProgramManager {
10285
10727
  * @param {boolean} unchecked
10286
10728
  * @param {number | null | undefined} edition
10287
10729
  * @param {boolean} use_fee_master
10730
+ * @param {ProgramImports | null} [program_imports]
10288
10731
  * @returns {Promise<ProvingRequest>}
10289
10732
  */
10290
- static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked, edition, use_fee_master) {
10733
+ 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) {
10291
10734
  _assertClass(private_key, PrivateKey);
10292
10735
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10293
10736
  const len0 = WASM_VECTOR_LEN;
@@ -10298,7 +10741,12 @@ class ProgramManager {
10298
10741
  _assertClass(fee_record, RecordPlaintext);
10299
10742
  ptr2 = fee_record.__destroy_into_raw();
10300
10743
  }
10301
- 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);
10744
+ let ptr3 = 0;
10745
+ if (!isLikeNone(program_imports)) {
10746
+ _assertClass(program_imports, ProgramImports);
10747
+ ptr3 = program_imports.__destroy_into_raw();
10748
+ }
10749
+ 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);
10302
10750
  return takeObject(ret);
10303
10751
  }
10304
10752
  /**
@@ -10318,9 +10766,10 @@ class ProgramManager {
10318
10766
  * @param {number | null} [edition]
10319
10767
  * @param {object | null} [imports]
10320
10768
  * @param {PrivateKey | null} [private_key]
10769
+ * @param {ProgramImports | null} [program_imports]
10321
10770
  * @returns {Promise<ProvingRequest>}
10322
10771
  */
10323
- static buildProvingRequestFromExecutionRequest(request, program, unchecked, broadcast, edition, imports, private_key) {
10772
+ static buildProvingRequestFromExecutionRequest(request, program, unchecked, broadcast, edition, imports, private_key, program_imports) {
10324
10773
  _assertClass(request, ExecutionRequest);
10325
10774
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10326
10775
  const len0 = WASM_VECTOR_LEN;
@@ -10329,7 +10778,12 @@ class ProgramManager {
10329
10778
  _assertClass(private_key, PrivateKey);
10330
10779
  ptr1 = private_key.__destroy_into_raw();
10331
10780
  }
10332
- const ret = wasm.programmanager_buildProvingRequestFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, broadcast, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
10781
+ let ptr2 = 0;
10782
+ if (!isLikeNone(program_imports)) {
10783
+ _assertClass(program_imports, ProgramImports);
10784
+ ptr2 = program_imports.__destroy_into_raw();
10785
+ }
10786
+ const ret = wasm.programmanager_buildProvingRequestFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, broadcast, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1, ptr2);
10333
10787
  return takeObject(ret);
10334
10788
  }
10335
10789
  /**
@@ -10470,9 +10924,10 @@ class ProgramManager {
10470
10924
  * @param {RecordPlaintext | null} [fee_record]
10471
10925
  * @param {string | null} [url]
10472
10926
  * @param {object | null} [imports]
10927
+ * @param {ProgramImports | null} [program_imports]
10473
10928
  * @returns {Promise<Transaction>}
10474
10929
  */
10475
- static buildDevnodeDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports) {
10930
+ static buildDevnodeDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, program_imports) {
10476
10931
  _assertClass(private_key, PrivateKey);
10477
10932
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10478
10933
  const len0 = WASM_VECTOR_LEN;
@@ -10483,7 +10938,12 @@ class ProgramManager {
10483
10938
  }
10484
10939
  var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10485
10940
  var len2 = WASM_VECTOR_LEN;
10486
- const ret = wasm.programmanager_buildDevnodeDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports));
10941
+ let ptr3 = 0;
10942
+ if (!isLikeNone(program_imports)) {
10943
+ _assertClass(program_imports, ProgramImports);
10944
+ ptr3 = program_imports.__destroy_into_raw();
10945
+ }
10946
+ const ret = wasm.programmanager_buildDevnodeDeploymentTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3);
10487
10947
  return takeObject(ret);
10488
10948
  }
10489
10949
  /**
@@ -10511,9 +10971,10 @@ class ProgramManager {
10511
10971
  * @param {RecordPlaintext | null} [fee_record]
10512
10972
  * @param {string | null} [url]
10513
10973
  * @param {object | null} [imports]
10974
+ * @param {ProgramImports | null} [program_imports]
10514
10975
  * @returns {Promise<Transaction>}
10515
10976
  */
10516
- static buildDevnodeUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports) {
10977
+ static buildDevnodeUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, program_imports) {
10517
10978
  _assertClass(private_key, PrivateKey);
10518
10979
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10519
10980
  const len0 = WASM_VECTOR_LEN;
@@ -10524,7 +10985,12 @@ class ProgramManager {
10524
10985
  }
10525
10986
  var ptr2 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10526
10987
  var len2 = WASM_VECTOR_LEN;
10527
- const ret = wasm.programmanager_buildDevnodeUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports));
10988
+ let ptr3 = 0;
10989
+ if (!isLikeNone(program_imports)) {
10990
+ _assertClass(program_imports, ProgramImports);
10991
+ ptr3 = program_imports.__destroy_into_raw();
10992
+ }
10993
+ const ret = wasm.programmanager_buildDevnodeUpgradeTransaction(private_key.__wbg_ptr, ptr0, len0, priority_fee_credits, ptr1, ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3);
10528
10994
  return takeObject(ret);
10529
10995
  }
10530
10996
  /**
@@ -10568,12 +11034,18 @@ class ProgramManager {
10568
11034
  * @returns {u64}
10569
11035
  * @param {string} program
10570
11036
  * @param {object | null} [imports]
11037
+ * @param {ProgramImports | null} [program_imports]
10571
11038
  * @returns {Promise<bigint>}
10572
11039
  */
10573
- static estimateDeploymentFee(program, imports) {
11040
+ static estimateDeploymentFee(program, imports, program_imports) {
10574
11041
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10575
11042
  const len0 = WASM_VECTOR_LEN;
10576
- const ret = wasm.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports));
11043
+ let ptr1 = 0;
11044
+ if (!isLikeNone(program_imports)) {
11045
+ _assertClass(program_imports, ProgramImports);
11046
+ ptr1 = program_imports.__destroy_into_raw();
11047
+ }
11048
+ const ret = wasm.programmanager_estimateDeploymentFee(ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
10577
11049
  return takeObject(ret);
10578
11050
  }
10579
11051
  /**
@@ -10603,9 +11075,10 @@ class ProgramManager {
10603
11075
  * @param {ProvingKey | null} [fee_proving_key]
10604
11076
  * @param {VerifyingKey | null} [fee_verifying_key]
10605
11077
  * @param {OfflineQuery | null} [offline_query]
11078
+ * @param {ProgramImports | null} [program_imports]
10606
11079
  * @returns {Promise<Transaction>}
10607
11080
  */
10608
- static buildDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
11081
+ static buildDeploymentTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query, program_imports) {
10609
11082
  _assertClass(private_key, PrivateKey);
10610
11083
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10611
11084
  const len0 = WASM_VECTOR_LEN;
@@ -10631,7 +11104,12 @@ class ProgramManager {
10631
11104
  _assertClass(offline_query, OfflineQuery);
10632
11105
  ptr5 = offline_query.__destroy_into_raw();
10633
11106
  }
10634
- 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);
11107
+ let ptr6 = 0;
11108
+ if (!isLikeNone(program_imports)) {
11109
+ _assertClass(program_imports, ProgramImports);
11110
+ ptr6 = program_imports.__destroy_into_raw();
11111
+ }
11112
+ 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);
10635
11113
  return takeObject(ret);
10636
11114
  }
10637
11115
  /**
@@ -10659,9 +11137,10 @@ class ProgramManager {
10659
11137
  * @param {ProvingKey | null} [fee_proving_key]
10660
11138
  * @param {VerifyingKey | null} [fee_verifying_key]
10661
11139
  * @param {OfflineQuery | null} [offline_query]
11140
+ * @param {ProgramImports | null} [program_imports]
10662
11141
  * @returns {Promise<Transaction>}
10663
11142
  */
10664
- static buildUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query) {
11143
+ static buildUpgradeTransaction(private_key, program, priority_fee_credits, fee_record, url, imports, fee_proving_key, fee_verifying_key, offline_query, program_imports) {
10665
11144
  _assertClass(private_key, PrivateKey);
10666
11145
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10667
11146
  const len0 = WASM_VECTOR_LEN;
@@ -10687,7 +11166,12 @@ class ProgramManager {
10687
11166
  _assertClass(offline_query, OfflineQuery);
10688
11167
  ptr5 = offline_query.__destroy_into_raw();
10689
11168
  }
10690
- 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);
11169
+ let ptr6 = 0;
11170
+ if (!isLikeNone(program_imports)) {
11171
+ _assertClass(program_imports, ProgramImports);
11172
+ ptr6 = program_imports.__destroy_into_raw();
11173
+ }
11174
+ 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);
10691
11175
  return takeObject(ret);
10692
11176
  }
10693
11177
  /**
@@ -10701,19 +11185,10 @@ class ProgramManager {
10701
11185
  * @param priority_fee_credits The optional priority fee to be paid for the transaction
10702
11186
  * @param fee_record The record to spend the fee from
10703
11187
  * @param url The url of the Aleo network node to send the transaction to
10704
- * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
10705
- * `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
10706
- * and used for subsequent transactions. If this is set to 'false' the proving and verifying
10707
- * keys will be deallocated from memory after the transaction is executed.
10708
11188
  * @param imports (optional) Provide a list of imports to use for the function execution in the
10709
11189
  * form of a javascript object where the keys are a string of the program name and the values
10710
11190
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
10711
- * @param proving_key (optional) Provide a verifying key to use for the function execution
10712
- * @param verifying_key (optional) Provide a verifying key to use for the function execution
10713
- * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
10714
- * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
10715
- * @param offline_query An offline query object to use if building a transaction without an internet connection.
10716
- * @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.
11191
+ * @param edition The edition of the program to execute. Defaults to 1.
10717
11192
  * @returns {Transaction}
10718
11193
  * @param {PrivateKey} private_key
10719
11194
  * @param {string} program
@@ -10724,9 +11199,10 @@ class ProgramManager {
10724
11199
  * @param {string | null} [url]
10725
11200
  * @param {object | null} [imports]
10726
11201
  * @param {number | null} [edition]
11202
+ * @param {ProgramImports | null} [program_imports]
10727
11203
  * @returns {Promise<Transaction>}
10728
11204
  */
10729
- static buildDevnodeExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, edition) {
11205
+ static buildDevnodeExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, edition, program_imports) {
10730
11206
  _assertClass(private_key, PrivateKey);
10731
11207
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10732
11208
  const len0 = WASM_VECTOR_LEN;
@@ -10739,7 +11215,12 @@ class ProgramManager {
10739
11215
  }
10740
11216
  var ptr3 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10741
11217
  var len3 = WASM_VECTOR_LEN;
10742
- 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);
11218
+ let ptr4 = 0;
11219
+ if (!isLikeNone(program_imports)) {
11220
+ _assertClass(program_imports, ProgramImports);
11221
+ ptr4 = program_imports.__destroy_into_raw();
11222
+ }
11223
+ 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);
10743
11224
  return takeObject(ret);
10744
11225
  }
10745
11226
  /**
@@ -10784,6 +11265,7 @@ class ProgramManager {
10784
11265
  * @param imports The imports of the program being executed.
10785
11266
  * @param url The url to get the inclusion proving information from.
10786
11267
  * @param offline_query Optional offline query object if building a Transaction offline.
11268
+ * @param edition The program edition (defaults to 1).
10787
11269
  * @param {Authorization} authorization
10788
11270
  * @param {Authorization | null | undefined} fee_authorization
10789
11271
  * @param {string} program
@@ -10794,9 +11276,11 @@ class ProgramManager {
10794
11276
  * @param {object | null} [imports]
10795
11277
  * @param {string | null} [url]
10796
11278
  * @param {OfflineQuery | null} [offline_query]
11279
+ * @param {ProgramImports | null} [program_imports]
11280
+ * @param {number | null} [edition]
10797
11281
  * @returns {Promise<Transaction>}
10798
11282
  */
10799
- static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, offline_query) {
11283
+ static executeAuthorization(authorization, fee_authorization, program, proving_key, verifying_key, fee_proving_key, fee_verifying_key, imports, url, offline_query, program_imports, edition) {
10800
11284
  _assertClass(authorization, Authorization);
10801
11285
  var ptr0 = authorization.__destroy_into_raw();
10802
11286
  let ptr1 = 0;
@@ -10833,35 +11317,44 @@ class ProgramManager {
10833
11317
  _assertClass(offline_query, OfflineQuery);
10834
11318
  ptr8 = offline_query.__destroy_into_raw();
10835
11319
  }
10836
- const ret = wasm.programmanager_executeAuthorization(ptr0, ptr1, ptr2, len2, ptr3, ptr4, ptr5, ptr6, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr7, len7, ptr8);
11320
+ let ptr9 = 0;
11321
+ if (!isLikeNone(program_imports)) {
11322
+ _assertClass(program_imports, ProgramImports);
11323
+ ptr9 = program_imports.__destroy_into_raw();
11324
+ }
11325
+ 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);
10837
11326
  return takeObject(ret);
10838
11327
  }
10839
11328
  /**
10840
- * Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
10841
- * verifying keys will be stored in the ProgramManager's memory and used for subsequent
10842
- * program executions.
11329
+ * Estimate Fee for Aleo function execution.
10843
11330
  *
10844
11331
  * @param program The source code of the program to estimate the execution fee for.
10845
11332
  * @param function The name of the function to estimate the execution fee for.
10846
11333
  * @param imports (optional) Provide a list of imports to use for the fee estimation in the
10847
11334
  * form of a javascript object where the keys are a string of the program name and the values
10848
11335
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
10849
- * @param edition {
11336
+ * @param edition The edition of the program. Defaults to 1.
10850
11337
  * @returns {u64} Fee in microcredits
10851
11338
  * @param {string} program
10852
11339
  * @param {string} _function
10853
11340
  * @param {object | null} [imports]
10854
11341
  * @param {number | null} [edition]
11342
+ * @param {ProgramImports | null} [program_imports]
10855
11343
  * @returns {bigint}
10856
11344
  */
10857
- static estimateExecutionFee(program, _function, imports, edition) {
11345
+ static estimateExecutionFee(program, _function, imports, edition, program_imports) {
10858
11346
  try {
10859
11347
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10860
11348
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10861
11349
  const len0 = WASM_VECTOR_LEN;
10862
11350
  const ptr1 = passStringToWasm0(_function, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10863
11351
  const len1 = WASM_VECTOR_LEN;
10864
- wasm.programmanager_estimateExecutionFee(retptr, ptr0, len0, ptr1, len1, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11352
+ let ptr2 = 0;
11353
+ if (!isLikeNone(program_imports)) {
11354
+ _assertClass(program_imports, ProgramImports);
11355
+ ptr2 = program_imports.__destroy_into_raw();
11356
+ }
11357
+ wasm.programmanager_estimateExecutionFee(retptr, ptr0, len0, ptr1, len1, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr2);
10865
11358
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
10866
11359
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10867
11360
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -10890,7 +11383,7 @@ class ProgramManager {
10890
11383
  * @param {Object | undefined} imports (optional) Provide a list of imports to use for the function execution in the
10891
11384
  * form of a javascript object where the keys are a string of the program name and the values
10892
11385
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
10893
- * @param {ProvingKey | undefined} proving_key (optional) Provide a verifying key to use for the function execution
11386
+ * @param {ProvingKey | undefined} proving_key (optional) Provide a proving key to use for the function execution
10894
11387
  * @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
10895
11388
  * @param {PrivateKey} private_key
10896
11389
  * @param {string} program
@@ -10904,9 +11397,10 @@ class ProgramManager {
10904
11397
  * @param {string | null} [url]
10905
11398
  * @param {OfflineQuery | null} [offline_query]
10906
11399
  * @param {number | null} [edition]
11400
+ * @param {ProgramImports | null} [program_imports]
10907
11401
  * @returns {Promise<ExecutionResponse>}
10908
11402
  */
10909
- static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, offline_query, edition) {
11403
+ static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, offline_query, edition, program_imports) {
10910
11404
  _assertClass(private_key, PrivateKey);
10911
11405
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10912
11406
  const len0 = WASM_VECTOR_LEN;
@@ -10929,7 +11423,12 @@ class ProgramManager {
10929
11423
  _assertClass(offline_query, OfflineQuery);
10930
11424
  ptr5 = offline_query.__destroy_into_raw();
10931
11425
  }
10932
- 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);
11426
+ let ptr6 = 0;
11427
+ if (!isLikeNone(program_imports)) {
11428
+ _assertClass(program_imports, ProgramImports);
11429
+ ptr6 = program_imports.__destroy_into_raw();
11430
+ }
11431
+ 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);
10933
11432
  return takeObject(ret);
10934
11433
  }
10935
11434
  /**
@@ -10948,15 +11447,21 @@ class ProgramManager {
10948
11447
  * @param {string} program
10949
11448
  * @param {object | null} [imports]
10950
11449
  * @param {number | null} [edition]
11450
+ * @param {ProgramImports | null} [program_imports]
10951
11451
  * @returns {bigint}
10952
11452
  */
10953
- static estimateFeeForAuthorization(authorization, program, imports, edition) {
11453
+ static estimateFeeForAuthorization(authorization, program, imports, edition, program_imports) {
10954
11454
  try {
10955
11455
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10956
11456
  _assertClass(authorization, Authorization);
10957
11457
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
10958
11458
  const len0 = WASM_VECTOR_LEN;
10959
- wasm.programmanager_estimateFeeForAuthorization(retptr, authorization.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11459
+ let ptr1 = 0;
11460
+ if (!isLikeNone(program_imports)) {
11461
+ _assertClass(program_imports, ProgramImports);
11462
+ ptr1 = program_imports.__destroy_into_raw();
11463
+ }
11464
+ wasm.programmanager_estimateFeeForAuthorization(retptr, authorization.__wbg_ptr, ptr0, len0, isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition, ptr1);
10960
11465
  var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
10961
11466
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
10962
11467
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
@@ -10978,19 +11483,15 @@ class ProgramManager {
10978
11483
  * @param priority_fee_credits The optional priority fee to be paid for the transaction
10979
11484
  * @param fee_record The record to spend the fee from
10980
11485
  * @param url The url of the Aleo network node to send the transaction to
10981
- * If this is set to 'true' the keys synthesized (or passed in as optional parameters via the
10982
- * `proving_key` and `verifying_key` arguments) will be stored in the ProgramManager's memory
10983
- * and used for subsequent transactions. If this is set to 'false' the proving and verifying
10984
- * keys will be deallocated from memory after the transaction is executed.
10985
11486
  * @param imports (optional) Provide a list of imports to use for the function execution in the
10986
11487
  * form of a javascript object where the keys are a string of the program name and the values
10987
11488
  * are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
10988
- * @param proving_key (optional) Provide a verifying key to use for the function execution
11489
+ * @param proving_key (optional) Provide a proving key to use for the function execution
10989
11490
  * @param verifying_key (optional) Provide a verifying key to use for the function execution
10990
11491
  * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
10991
11492
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
10992
11493
  * @param offline_query An offline query object to use if building a transaction without an internet connection.
10993
- * @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.
11494
+ * @param edition The edition of the program to execute. Defaults to 1.
10994
11495
  * @returns {Transaction}
10995
11496
  * @param {PrivateKey} private_key
10996
11497
  * @param {string} program
@@ -11006,9 +11507,10 @@ class ProgramManager {
11006
11507
  * @param {VerifyingKey | null} [fee_verifying_key]
11007
11508
  * @param {OfflineQuery | null} [offline_query]
11008
11509
  * @param {number | null} [edition]
11510
+ * @param {ProgramImports | null} [program_imports]
11009
11511
  * @returns {Promise<Transaction>}
11010
11512
  */
11011
- static buildExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key, offline_query, edition) {
11513
+ static buildExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key, offline_query, edition, program_imports) {
11012
11514
  _assertClass(private_key, PrivateKey);
11013
11515
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11014
11516
  const len0 = WASM_VECTOR_LEN;
@@ -11046,7 +11548,12 @@ class ProgramManager {
11046
11548
  _assertClass(offline_query, OfflineQuery);
11047
11549
  ptr8 = offline_query.__destroy_into_raw();
11048
11550
  }
11049
- 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);
11551
+ let ptr9 = 0;
11552
+ if (!isLikeNone(program_imports)) {
11553
+ _assertClass(program_imports, ProgramImports);
11554
+ ptr9 = program_imports.__destroy_into_raw();
11555
+ }
11556
+ 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);
11050
11557
  return takeObject(ret);
11051
11558
  }
11052
11559
  /**
@@ -11171,9 +11678,10 @@ class ProgramManager {
11171
11678
  * @param {number | null} [edition]
11172
11679
  * @param {object | null} [imports]
11173
11680
  * @param {PrivateKey | null} [private_key]
11681
+ * @param {ProgramImports | null} [program_imports]
11174
11682
  * @returns {Promise<Authorization>}
11175
11683
  */
11176
- static buildAuthorizationFromExecutionRequest(request, program, unchecked, edition, imports, private_key) {
11684
+ static buildAuthorizationFromExecutionRequest(request, program, unchecked, edition, imports, private_key, program_imports) {
11177
11685
  _assertClass(request, ExecutionRequest);
11178
11686
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11179
11687
  const len0 = WASM_VECTOR_LEN;
@@ -11182,7 +11690,12 @@ class ProgramManager {
11182
11690
  _assertClass(private_key, PrivateKey);
11183
11691
  ptr1 = private_key.__destroy_into_raw();
11184
11692
  }
11185
- const ret = wasm.programmanager_buildAuthorizationFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1);
11693
+ let ptr2 = 0;
11694
+ if (!isLikeNone(program_imports)) {
11695
+ _assertClass(program_imports, ProgramImports);
11696
+ ptr2 = program_imports.__destroy_into_raw();
11697
+ }
11698
+ const ret = wasm.programmanager_buildAuthorizationFromExecutionRequest(request.__wbg_ptr, ptr0, len0, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr1, ptr2);
11186
11699
  return takeObject(ret);
11187
11700
  }
11188
11701
  /**
@@ -11200,15 +11713,21 @@ class ProgramManager {
11200
11713
  * @param {Array<any>} inputs
11201
11714
  * @param {object | null} [imports]
11202
11715
  * @param {number | null} [edition]
11716
+ * @param {ProgramImports | null} [program_imports]
11203
11717
  * @returns {Promise<Authorization>}
11204
11718
  */
11205
- static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports, edition) {
11719
+ static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports, edition, program_imports) {
11206
11720
  _assertClass(private_key, PrivateKey);
11207
11721
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11208
11722
  const len0 = WASM_VECTOR_LEN;
11209
11723
  const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11210
11724
  const len1 = WASM_VECTOR_LEN;
11211
- const ret = wasm.programmanager_buildAuthorizationUnchecked(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11725
+ let ptr2 = 0;
11726
+ if (!isLikeNone(program_imports)) {
11727
+ _assertClass(program_imports, ProgramImports);
11728
+ ptr2 = program_imports.__destroy_into_raw();
11729
+ }
11730
+ 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);
11212
11731
  return takeObject(ret);
11213
11732
  }
11214
11733
  /**
@@ -11225,15 +11744,21 @@ class ProgramManager {
11225
11744
  * @param {Array<any>} inputs
11226
11745
  * @param {object | null} [imports]
11227
11746
  * @param {number | null} [edition]
11747
+ * @param {ProgramImports | null} [program_imports]
11228
11748
  * @returns {Promise<Authorization>}
11229
11749
  */
11230
- static authorize(private_key, program, function_name, inputs, imports, edition) {
11750
+ static authorize(private_key, program, function_name, inputs, imports, edition, program_imports) {
11231
11751
  _assertClass(private_key, PrivateKey);
11232
11752
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11233
11753
  const len0 = WASM_VECTOR_LEN;
11234
11754
  const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
11235
11755
  const len1 = WASM_VECTOR_LEN;
11236
- const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
11756
+ let ptr2 = 0;
11757
+ if (!isLikeNone(program_imports)) {
11758
+ _assertClass(program_imports, ProgramImports);
11759
+ ptr2 = program_imports.__destroy_into_raw();
11760
+ }
11761
+ 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);
11237
11762
  return takeObject(ret);
11238
11763
  }
11239
11764
  }
@@ -18138,6 +18663,10 @@ function __wbg_get_imports(memory) {
18138
18663
  const ret = typeof(getObject(arg0)) === 'function';
18139
18664
  return ret;
18140
18665
  };
18666
+ imports.wbg.__wbg___wbindgen_is_null_5e69f72e906cc57c = function(arg0) {
18667
+ const ret = getObject(arg0) === null;
18668
+ return ret;
18669
+ };
18141
18670
  imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
18142
18671
  const val = getObject(arg0);
18143
18672
  const ret = typeof(val) === 'object' && val !== null;
@@ -18292,6 +18821,16 @@ function __wbg_get_imports(memory) {
18292
18821
  const ret = getObject(arg0).headers;
18293
18822
  return addHeapObject(ret);
18294
18823
  };
18824
+ imports.wbg.__wbg_instanceof_Object_10bb762262230c68 = function(arg0) {
18825
+ let result;
18826
+ try {
18827
+ result = getObject(arg0) instanceof Object;
18828
+ } catch (_) {
18829
+ result = false;
18830
+ }
18831
+ const ret = result;
18832
+ return ret;
18833
+ };
18295
18834
  imports.wbg.__wbg_instanceof_Response_f4f3e87e07f3135c = function(arg0) {
18296
18835
  let result;
18297
18836
  try {
@@ -18358,7 +18897,7 @@ function __wbg_get_imports(memory) {
18358
18897
  const a = state0.a;
18359
18898
  state0.a = 0;
18360
18899
  try {
18361
- return __wasm_bindgen_func_elem_7436(a, state0.b, arg0, arg1);
18900
+ return __wasm_bindgen_func_elem_7483(a, state0.b, arg0, arg1);
18362
18901
  } finally {
18363
18902
  state0.a = a;
18364
18903
  }
@@ -18652,7 +19191,7 @@ function __wbg_get_imports(memory) {
18652
19191
  };
18653
19192
  imports.wbg.__wbindgen_cast_711d7deea8fc39ca = function(arg0, arg1) {
18654
19193
  // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [Externref], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18655
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7163, __wasm_bindgen_func_elem_8529);
19194
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7210, __wasm_bindgen_func_elem_8576);
18656
19195
  return addHeapObject(ret);
18657
19196
  };
18658
19197
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -18662,12 +19201,12 @@ function __wbg_get_imports(memory) {
18662
19201
  };
18663
19202
  imports.wbg.__wbindgen_cast_bff04fdc9653fdb7 = function(arg0, arg1) {
18664
19203
  // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [], shim_idx: 465, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18665
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7163, __wasm_bindgen_func_elem_7164);
19204
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7210, __wasm_bindgen_func_elem_7211);
18666
19205
  return addHeapObject(ret);
18667
19206
  };
18668
19207
  imports.wbg.__wbindgen_cast_cada7727142cd213 = function(arg0, arg1) {
18669
19208
  // Cast intrinsic for `Closure(Closure { dtor_idx: 356, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 357, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
18670
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7163, __wasm_bindgen_func_elem_8529);
19209
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_7210, __wasm_bindgen_func_elem_8576);
18671
19210
  return addHeapObject(ret);
18672
19211
  };
18673
19212
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
@@ -18783,5 +19322,5 @@ async function initThreadPool(threads) {
18783
19322
  await initThreadPool$1(new URL("worker.js", import.meta.url), threads);
18784
19323
  }
18785
19324
 
18786
- export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, DynamicRecord, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, I128, I16, I32, I64, I8, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, Proof, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, Value, VerifyingKey, ViewKey, getOrInitConsensusVersionTestHeights, initSync, initThreadPool, runRayonThread, snarkVerify, snarkVerifyBatch, stringToField, verifyFunctionExecution };
19325
+ export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, DynamicRecord, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, I128, I16, I32, I64, I8, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramImports, ProgramManager, Proof, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, Value, VerifyingKey, ViewKey, getOrInitConsensusVersionTestHeights, initSync, initThreadPool, runRayonThread, snarkVerify, snarkVerifyBatch, stringToField, verifyFunctionExecution };
18787
19326
  //# sourceMappingURL=index.js.map