@provablehq/sdk 0.9.9 → 0.9.10

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.
Files changed (35) hide show
  1. package/dist/dynamic/browser.d.ts +8 -0
  2. package/dist/dynamic/browser.js +8 -0
  3. package/dist/dynamic/node.d.ts +8 -0
  4. package/dist/dynamic/node.js +8 -0
  5. package/dist/mainnet/browser.d.ts +5 -3
  6. package/dist/mainnet/browser.js +769 -7
  7. package/dist/mainnet/browser.js.map +1 -1
  8. package/dist/mainnet/constants.d.ts +5 -0
  9. package/dist/mainnet/function-key-provider.d.ts +18 -0
  10. package/dist/mainnet/integrations/sealance/merkle-tree.d.ts +121 -0
  11. package/dist/mainnet/models/record-scanner/recordsResponseFilter.d.ts +5 -1
  12. package/dist/mainnet/models/record-scanner/registrationResponse.d.ts +2 -2
  13. package/dist/mainnet/models/record-scanner/statusResponse.d.ts +13 -0
  14. package/dist/mainnet/node.js +3 -2
  15. package/dist/mainnet/node.js.map +1 -1
  16. package/dist/mainnet/offline-key-provider.d.ts +14 -0
  17. package/dist/mainnet/program-manager.d.ts +105 -13
  18. package/dist/mainnet/record-scanner.d.ts +151 -0
  19. package/dist/mainnet/wasm.d.ts +1 -1
  20. package/dist/testnet/browser.d.ts +5 -3
  21. package/dist/testnet/browser.js +769 -7
  22. package/dist/testnet/browser.js.map +1 -1
  23. package/dist/testnet/constants.d.ts +5 -0
  24. package/dist/testnet/function-key-provider.d.ts +18 -0
  25. package/dist/testnet/integrations/sealance/merkle-tree.d.ts +121 -0
  26. package/dist/testnet/models/record-scanner/recordsResponseFilter.d.ts +5 -1
  27. package/dist/testnet/models/record-scanner/registrationResponse.d.ts +2 -2
  28. package/dist/testnet/models/record-scanner/statusResponse.d.ts +13 -0
  29. package/dist/testnet/node.js +3 -2
  30. package/dist/testnet/node.js.map +1 -1
  31. package/dist/testnet/offline-key-provider.d.ts +14 -0
  32. package/dist/testnet/program-manager.d.ts +105 -13
  33. package/dist/testnet/record-scanner.d.ts +151 -0
  34. package/dist/testnet/wasm.d.ts +1 -1
  35. package/package.json +8 -3
@@ -1,6 +1,7 @@
1
1
  import 'core-js/proposals/json-parse-with-source.js';
2
- import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, EncryptionToolkit, Group, Program, Plaintext, Transaction, ProvingRequest, Metadata, VerifyingKey, ProvingKey, RecordPlaintext, ProgramManager as ProgramManager$1, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
3
- export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, ExecutionResponse, Field, Execution as FunctionExecution, GraphKey, Group, I128, I16, I32, I64, I8, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
2
+ import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, EncryptionToolkit, Group, Program, Plaintext, Transaction, ProvingRequest, Metadata, VerifyingKey, ProvingKey, RecordPlaintext, Field, Poseidon4, ProgramManager as ProgramManager$1, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
3
+ export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, ExecutionResponse, Field, Execution as FunctionExecution, GraphKey, Group, I128, I16, I32, I64, I8, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, VerifyingKey, ViewKey, getOrInitConsensusVersionTestHeights, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
4
+ import { bech32m } from '@scure/base';
4
5
 
5
6
  /**
6
7
  * Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from
@@ -491,7 +492,7 @@ class AleoNetworkClient {
491
492
  else {
492
493
  this.headers = {
493
494
  // This is replaced by the actual version by a Rollup plugin
494
- "X-Aleo-SDK-Version": "0.9.9",
495
+ "X-Aleo-SDK-Version": "0.9.10",
495
496
  "X-Aleo-environment": environment(),
496
497
  };
497
498
  }
@@ -2044,6 +2045,11 @@ const PUBLIC_TO_PRIVATE_TRANSFER = new Set([
2044
2045
  "transfer_public_to_private",
2045
2046
  "transferPublicToPrivate",
2046
2047
  ]);
2048
+ const RECORD_DOMAIN = "RecordScannerV0";
2049
+ /**
2050
+ * Zero address on Aleo blockchain that corresponds to field element 0. Used as padding in Merkle trees and as a sentinel value.
2051
+ */
2052
+ const ZERO_ADDRESS = "aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc";
2047
2053
 
2048
2054
  /**
2049
2055
  * AleoKeyProviderParams search parameter for the AleoKeyProvider. It allows for the specification of a proverUri and
@@ -2355,6 +2361,22 @@ class AleoKeyProvider {
2355
2361
  throw new Error("Invalid visibility type");
2356
2362
  }
2357
2363
  }
2364
+ /**
2365
+ * Returns the proving and verifying keys for the transfer_public function.
2366
+ *
2367
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the transfer_public function
2368
+ */
2369
+ async transferPublicKeys() {
2370
+ return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_public);
2371
+ }
2372
+ /**
2373
+ * Returns the proving and verifying keys for the inclusion proof.
2374
+ *
2375
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the inclusion proof.
2376
+ */
2377
+ async inclusionKeys() {
2378
+ return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.inclusion);
2379
+ }
2358
2380
  /**
2359
2381
  * Returns the proving and verifying keys for the join function in the credits.aleo program
2360
2382
  *
@@ -2771,6 +2793,15 @@ class OfflineKeyProvider {
2771
2793
  return this.functionKeys(OfflineSearchParams.feePublicKeyParams());
2772
2794
  }
2773
2795
  ;
2796
+ /**
2797
+ * Get the inclusion prover keys from. The keys must be cached prior to calling this method for it to work.
2798
+ *
2799
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the inclusion prover
2800
+ */
2801
+ inclusionKeys() {
2802
+ return this.functionKeys(OfflineSearchParams.inclusionKeyParams());
2803
+ }
2804
+ ;
2774
2805
  /**
2775
2806
  * Get join function keys from the credits.aleo program. The keys must be cached prior to calling this
2776
2807
  * method for it to work.
@@ -2903,6 +2934,21 @@ class OfflineKeyProvider {
2903
2934
  throw new Error("Attempted to insert invalid proving keys for fee_public");
2904
2935
  }
2905
2936
  }
2937
+ /**
2938
+ * Insert the proving and verifying keys for the inclusion prover into the cache. Only the proving key needs
2939
+ * to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
2940
+ * that the keys match the expected checksum for the inclusion prover.
2941
+ *
2942
+ * @param provingKey
2943
+ */
2944
+ insertInclusionKeys(provingKey) {
2945
+ if (provingKey.isInclusionProver()) {
2946
+ this.cache.set(CREDITS_PROGRAM_KEYS.inclusion.locator, [provingKey.toBytes(), VerifyingKey.inclusionVerifier().toBytes()]);
2947
+ }
2948
+ else {
2949
+ throw new Error("Attempted to insert invalid proving keys for the inclusion prover");
2950
+ }
2951
+ }
2906
2952
  /**
2907
2953
  * Insert the proving and verifying keys for the join function into the cache. Only the proving key needs
2908
2954
  * to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
@@ -3236,6 +3282,532 @@ class BlockHeightSearch {
3236
3282
  }
3237
3283
  }
3238
3284
 
3285
+ /**
3286
+ * RecordScanner is a RecordProvider implementation that uses the record scanner service to find records.
3287
+ *
3288
+ * @example
3289
+ * const account = new Account({ privateKey: 'APrivateKey1...' });
3290
+ *
3291
+ * const recordScanner = new RecordScanner({ url: "https://record-scanner.aleo.org" });
3292
+ * recordScanner.setAccount(account);
3293
+ * recordScanner.setApiKey("your-api-key");
3294
+ * const uuid = await recordScanner.register(0);
3295
+ *
3296
+ * const filter = {
3297
+ * uuid,
3298
+ * filter: {
3299
+ * program: "credits.aleo",
3300
+ * records: ["credits"],
3301
+ * },
3302
+ * responseFilter: {
3303
+ * commitment: true,
3304
+ * owner: true,
3305
+ * tag: true,
3306
+ * tag?: boolean;
3307
+ * sender: true,
3308
+ * spent: true,
3309
+ * record_ciphertext: true,
3310
+ * block_height: true;
3311
+ * block_timestamp: true;
3312
+ * output_index: true;
3313
+ * record_name: true;
3314
+ * function_name: true;
3315
+ * program_name: true;
3316
+ * transition_id: true;
3317
+ * transaction_id: true;
3318
+ * transaction_index: true;
3319
+ * transition_index: true;
3320
+ * },
3321
+ * unspent: true,
3322
+ * };
3323
+ *
3324
+ * const records = await recordScanner.findRecords(filter);
3325
+ */
3326
+ class RecordScanner {
3327
+ url;
3328
+ apiKey;
3329
+ uuid;
3330
+ constructor(options) {
3331
+ this.url = options.url;
3332
+ this.apiKey = typeof options.apiKey === "string" ? { header: "X-Provable-API-Key", value: options.apiKey } : options.apiKey;
3333
+ }
3334
+ /**
3335
+ * Set the API key to use for the record scanner.
3336
+ *
3337
+ * @param {string} apiKey The API key to use for the record scanner.
3338
+ */
3339
+ async setApiKey(apiKey) {
3340
+ this.apiKey = typeof apiKey === "string" ? { header: "X-Provable-API-Key", value: apiKey } : apiKey;
3341
+ }
3342
+ /**
3343
+ * Set the UUID to use for the record scanner.
3344
+ *
3345
+ * @param {Field} uuid The UUID to use for the record scanner.
3346
+ */
3347
+ async setUuid(uuidOrViewKey) {
3348
+ this.uuid = uuidOrViewKey instanceof ViewKey ? this.computeUUID(uuidOrViewKey) : uuidOrViewKey;
3349
+ }
3350
+ /**
3351
+ * Register the account with the record scanner service.
3352
+ *
3353
+ * @param {number} startBlock The block height to start scanning from.
3354
+ * @returns {Promise<RegistrationResponse>} The response from the record scanner service.
3355
+ */
3356
+ async register(viewKey, startBlock) {
3357
+ try {
3358
+ let request = {
3359
+ view_key: viewKey.to_string(),
3360
+ start: startBlock,
3361
+ };
3362
+ const response = await this.request(new Request(`${this.url}/register`, {
3363
+ method: "POST",
3364
+ headers: { "Content-Type": "application/json" },
3365
+ body: JSON.stringify(request),
3366
+ }));
3367
+ const data = await response.json();
3368
+ this.uuid = data.uuid;
3369
+ return data;
3370
+ }
3371
+ catch (error) {
3372
+ console.error(`Failed to register view key: ${error}`);
3373
+ throw error;
3374
+ }
3375
+ }
3376
+ /**
3377
+ * Get encrypted records from the record scanner service.
3378
+ *
3379
+ * @param {RecordsFilter} recordsFilter The filter to use to find the records and filter the response.
3380
+ * @returns {Promise<EncryptedRecord[]>} The encrypted records.
3381
+ */
3382
+ async encryptedRecords(recordsFilter) {
3383
+ try {
3384
+ const response = await this.request(new Request(`${this.url}/records/encrypted`, {
3385
+ method: "POST",
3386
+ headers: { "Content-Type": "application/json" },
3387
+ body: JSON.stringify(recordsFilter),
3388
+ }));
3389
+ return await response.json();
3390
+ }
3391
+ catch (error) {
3392
+ console.error(`Failed to get encrypted records: ${error}`);
3393
+ throw error;
3394
+ }
3395
+ }
3396
+ /**
3397
+ * Check if a list of serial numbers exist in the record scanner service.
3398
+ *
3399
+ * @param {string[]} serialNumbers The serial numbers to check.
3400
+ * @returns {Promise<Record<string, boolean>>} Map of Aleo Record serial numbers and whether they appeared in any inputs on chain. If boolean corresponding to the Serial Number has a true value, that Record is considered spent by the Aleo Network.
3401
+ */
3402
+ async checkSerialNumbers(serialNumbers) {
3403
+ try {
3404
+ const response = await this.request(new Request(`${this.url}/records/sns`, {
3405
+ method: "POST",
3406
+ headers: { "Content-Type": "application/json" },
3407
+ body: JSON.stringify(serialNumbers),
3408
+ }));
3409
+ return await response.json();
3410
+ }
3411
+ catch (error) {
3412
+ console.error(`Failed to check if serial numbers exist: ${error}`);
3413
+ throw error;
3414
+ }
3415
+ }
3416
+ /**
3417
+ * Check if a list of tags exist in the record scanner service.
3418
+ *
3419
+ * @param {string[]} tags The tags to check.
3420
+ * @returns {Promise<Record<string, boolean>>} Map of Aleo Record tags and whether they appeared in any inputs on chain. If boolean corresponding to the tag has a true value, that Record is considered spent by the Aleo Network.
3421
+ */
3422
+ async checkTags(tags) {
3423
+ try {
3424
+ const response = await this.request(new Request(`${this.url}/records/tags`, {
3425
+ method: "POST",
3426
+ headers: { "Content-Type": "application/json" },
3427
+ body: JSON.stringify(tags),
3428
+ }));
3429
+ return await response.json();
3430
+ }
3431
+ catch (error) {
3432
+ console.error(`Failed to check if tags exist: ${error}`);
3433
+ throw error;
3434
+ }
3435
+ }
3436
+ /**
3437
+ * Check the status of a record scanner indexing job.
3438
+ *
3439
+ * @param {string} jobId The job id to check.
3440
+ * @returns {Promise<StatusResponse>} The status of the job.
3441
+ */
3442
+ async checkStatus() {
3443
+ try {
3444
+ const response = await this.request(new Request(`${this.url}/status`, {
3445
+ method: "POST",
3446
+ headers: { "Content-Type": "application/json" },
3447
+ body: JSON.stringify(this.uuid?.toString()),
3448
+ }));
3449
+ return await response.json();
3450
+ }
3451
+ catch (error) {
3452
+ console.error(`Failed to check status of job: ${error}`);
3453
+ throw error;
3454
+ }
3455
+ }
3456
+ /**
3457
+ * Find a record in the record scanner service.
3458
+ *
3459
+ * @param {OwnedFilter} searchParameters The filter to use to find the record.
3460
+ * @returns {Promise<OwnedRecord>} The record.
3461
+ */
3462
+ async findRecord(searchParameters) {
3463
+ try {
3464
+ const records = await this.findRecords(searchParameters);
3465
+ if (records.length > 0) {
3466
+ return records[0];
3467
+ }
3468
+ throw new Error("Record not found");
3469
+ }
3470
+ catch (error) {
3471
+ console.error(`Failed to find record: ${error}`);
3472
+ throw error;
3473
+ }
3474
+ }
3475
+ /**
3476
+ * Find records in the record scanner service.
3477
+ *
3478
+ * @param {OwnedFilter} filter The filter to use to find the records.
3479
+ * @returns {Promise<OwnedRecord[]>} The records.
3480
+ */
3481
+ async findRecords(filter) {
3482
+ if (!this.uuid) {
3483
+ throw new Error("You are using the RecordScanner implementation of the RecordProvider. No account has been registered with the RecordScanner which is required to use the findRecords method. Please set an with the setAccount method before calling the findRecords method again.");
3484
+ }
3485
+ filter.uuid = this.uuid?.toString();
3486
+ try {
3487
+ const response = await this.request(new Request(`${this.url}/records/owned`, {
3488
+ method: "POST",
3489
+ headers: { "Content-Type": "application/json" },
3490
+ body: JSON.stringify(filter),
3491
+ }));
3492
+ return await response.json();
3493
+ }
3494
+ catch (error) {
3495
+ console.error(`Failed to get owned records: ${error}`);
3496
+ throw error;
3497
+ }
3498
+ }
3499
+ /**
3500
+ * Find a credits record in the record scanner service.
3501
+ *
3502
+ * @param {number} microcredits The amount of microcredits to find.
3503
+ * @param {OwnedFilter} searchParameters The filter to use to find the record.
3504
+ * @returns {Promise<OwnedRecord>} The record.
3505
+ */
3506
+ async findCreditsRecord(microcredits, searchParameters) {
3507
+ try {
3508
+ const records = await this.findRecords({
3509
+ decrypt: true,
3510
+ unspent: searchParameters.unspent,
3511
+ filter: {
3512
+ start: searchParameters.filter?.start ?? 0,
3513
+ program: "credits.aleo",
3514
+ record: "credits",
3515
+ },
3516
+ uuid: this.uuid?.toString(),
3517
+ });
3518
+ const record = records.find(record => {
3519
+ const plaintext = RecordPlaintext.fromString(record.record_plaintext ?? '');
3520
+ const amountStr = plaintext.getMember("microcredits").toString();
3521
+ const amount = parseInt(amountStr.replace("u64", ""));
3522
+ return amount >= microcredits;
3523
+ });
3524
+ if (!record) {
3525
+ throw new Error(`No records found matching the supplied search filter:\n${JSON.stringify(searchParameters, null, 2)}`);
3526
+ }
3527
+ return record;
3528
+ }
3529
+ catch (error) {
3530
+ console.error(`Failed to find credits record: ${error}`);
3531
+ throw error;
3532
+ }
3533
+ }
3534
+ /**
3535
+ * Find credits records using a record scanning service.
3536
+ *
3537
+ * @param {number[]} microcreditAmounts The amounts of microcredits to find.
3538
+ * @param {OwnedFilter} searchParameters The filter to use to find the records.
3539
+ * @returns {Promise<OwnedRecord[]>} The records
3540
+ */
3541
+ async findCreditsRecords(microcreditAmounts, searchParameters) {
3542
+ try {
3543
+ const records = await this.findRecords({
3544
+ decrypt: true,
3545
+ unspent: searchParameters.unspent,
3546
+ filter: {
3547
+ start: searchParameters.filter?.start ?? 0,
3548
+ program: "credits.aleo",
3549
+ record: "credits",
3550
+ },
3551
+ uuid: this.uuid?.toString(),
3552
+ });
3553
+ return records.filter(record => {
3554
+ const plaintext = RecordPlaintext.fromString(record.record_plaintext ?? '');
3555
+ const amount = plaintext.getMember("microcredits").toString();
3556
+ return microcreditAmounts.includes(parseInt(amount.replace("u64", "")));
3557
+ });
3558
+ }
3559
+ catch (error) {
3560
+ console.error(`Failed to find credits records: ${error}`);
3561
+ throw error;
3562
+ }
3563
+ }
3564
+ /**
3565
+ * Wrapper function to make a request to the record scanner service and handle any errors.
3566
+ *
3567
+ * @param {Request} req The request to make.
3568
+ * @returns {Promise<Response>} The response.
3569
+ */
3570
+ async request(req) {
3571
+ try {
3572
+ if (this.apiKey) {
3573
+ req.headers.set(this.apiKey.header, this.apiKey.value);
3574
+ }
3575
+ const response = await fetch(req);
3576
+ if (!response.ok) {
3577
+ throw new Error(await response.text() ?? `Request to ${req.url} failed with status ${response.status}`);
3578
+ }
3579
+ return response;
3580
+ }
3581
+ catch (error) {
3582
+ console.error(`Failed to make request to ${req.url}: ${error}`);
3583
+ throw error;
3584
+ }
3585
+ }
3586
+ computeUUID(vk) {
3587
+ // Construct the material needed for the Poseidon oracle.
3588
+ const inputs = [Field.newDomainSeparator(RECORD_DOMAIN), vk.toField(), Field.one()];
3589
+ // Calculate the uuid.
3590
+ const hasher = new Poseidon4();
3591
+ return hasher.hash(inputs);
3592
+ }
3593
+ }
3594
+
3595
+ /**
3596
+ * Client library that encapsulates methods for constructing Merkle exclusion proofs for compliant stablecoin programs following the Sealance architecture.
3597
+ *
3598
+
3599
+ * @example
3600
+ * Construct a Merkle exclusion proof.
3601
+ * ```typescript
3602
+ * const sealance = new SealanceMerkleTree();
3603
+ * const leaves = [
3604
+ * "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px",
3605
+ * "aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t",
3606
+ * "aleo1s3ws5tra87fjycnjrwsjcrnw2qxr8jfqqdugnf0xzqqw29q9m5pqem2u4t",
3607
+ * ];
3608
+ * const result = sealance.generateLeaves(leaves);
3609
+ * const tree = sealance.buildTree(result);
3610
+ * const [leftIdx, rightIdx] = sealance.getLeafIndices(tree, "aleo1kypwp5m7qtk9mwazgcpg0tq8aal23mnrvwfvug65qgcg9xvsrqgspyjm6n");
3611
+ * const proof_left = sealance.getSiblingPath(tree, leftIdx, 15);
3612
+ * const proof_right = sealance.getSiblingPath(tree, rightIdx, 15);
3613
+ * const exclusion_proof = [proof_left, proof_right];
3614
+ * ```
3615
+ */
3616
+ class SealanceMerkleTree {
3617
+ static hasher = new Poseidon4();
3618
+ /**
3619
+ * Converts an Aleo blockchain address to a field element.
3620
+ *
3621
+ * This function decodes a bech32m-encoded Aleo address and converts it to a field element
3622
+ * represented as a BigInt. The address format follows the Aleo protocol specification,
3623
+ * starting with the prefix "aleo1" followed by encoded data.
3624
+ *
3625
+ * @param address - The Aleo blockchain address (e.g., "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
3626
+ * @returns A BigInt representing the field element.
3627
+ * @throws Error if the address is invalid or cannot be decoded.
3628
+ *
3629
+ * @example
3630
+ * ```typescript
3631
+ * const address = "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px";
3632
+ * const fieldValue = convertAddressToField(address);
3633
+ * console.log(fieldValue); // 123456789...n
3634
+ * ```
3635
+ */
3636
+ convertAddressToField(address) {
3637
+ const { words } = bech32m.decode(address);
3638
+ const bytes = bech32m.fromWords(words);
3639
+ // Convert bytes to BigInt (little-endian)
3640
+ let fieldValue = BigInt(0);
3641
+ for (let i = 0; i < bytes.length; i++) {
3642
+ fieldValue |= BigInt(bytes[i]) << BigInt(i * 8);
3643
+ }
3644
+ return fieldValue;
3645
+ }
3646
+ /**
3647
+ * Hashes two elements using Poseidon4 hash function
3648
+ * @param prefix - Prefix for the hash (e.g., "0field" for nodes, "1field" for leaves)
3649
+ * @param el1 - First element to hash
3650
+ * @param el2 - Second element to hash
3651
+ * @returns The hash result as a Field
3652
+ * @throws {Error} If inputs are empty or invalid
3653
+ */
3654
+ hashTwoElements(prefix, el1, el2) {
3655
+ if (!el1 || !el2) {
3656
+ throw new Error("Invalid inputs: elements cannot be empty");
3657
+ }
3658
+ const fields = [Field.fromString(prefix), Field.fromString(el1), Field.fromString(el2)];
3659
+ const arrayPlaintext = Plaintext.fromString(`[${fields.map(f => f.toString()).join(",")}]`);
3660
+ return SealanceMerkleTree.hasher.hash(arrayPlaintext.toFields());
3661
+ }
3662
+ /**
3663
+ * Builds a Merkle tree from given leaves. The tree is built bottom-up, hashing pairs of elements at each level.
3664
+ *
3665
+ * @param leaves - Array of leaf elements (must have even number of elements).
3666
+ * @returns Array representing the complete Merkle tree as BigInts.
3667
+ * @throws {Error} If leaves array is empty or has odd number of elements.
3668
+ *
3669
+ * @example
3670
+ * ```typescript
3671
+ * const leaves = ["0field", "1field", "2field", "3field"];
3672
+ * const tree = buildTree(leaves);
3673
+ * const root = tree[tree.length - 1]; // Get the Merkle root
3674
+ * ```
3675
+ */
3676
+ buildTree(leaves) {
3677
+ if (leaves.length === 0) {
3678
+ throw new Error("Leaves array cannot be empty");
3679
+ }
3680
+ if (leaves.length % 2 !== 0) {
3681
+ throw new Error("Leaves array must have even number of elements");
3682
+ }
3683
+ let currentLevel = leaves;
3684
+ let tree = [...currentLevel];
3685
+ let levelSize = currentLevel.length;
3686
+ while (levelSize > 1) {
3687
+ const nextLevel = [];
3688
+ for (let i = 0; i < levelSize; i += 2) {
3689
+ const left = currentLevel[i];
3690
+ const right = currentLevel[i + 1];
3691
+ const prefix = leaves.length === levelSize ? "1field" : "0field";
3692
+ const hash = this.hashTwoElements(prefix, left, right);
3693
+ nextLevel.push(hash.toString());
3694
+ }
3695
+ tree = [...tree, ...nextLevel];
3696
+ currentLevel = nextLevel;
3697
+ levelSize = currentLevel.length;
3698
+ }
3699
+ return tree.map(element => BigInt(element.slice(0, element.length - "field".length)));
3700
+ }
3701
+ /**
3702
+ * Converts Aleo addresses to field elements, sorts them, pads with zero fields, and returns an array. This prepares addresses for Merkle tree construction.
3703
+ *
3704
+ * @param addresses - Array of Aleo addresses.
3705
+ * @param maxTreeDepth - Maximum depth of the Merkle tree (default: 15).
3706
+ * @returns Array of field elements ready for Merkle tree construction.
3707
+ * @throws {Error} If the number of addresses exceeds the maximum capacity.
3708
+ *
3709
+ * @example
3710
+ * ```typescript
3711
+ * const addresses = [
3712
+ * "aleo1...",
3713
+ * "aleo1..."
3714
+ * ];
3715
+ * const leaves = generateLeaves(addresses, 15);
3716
+ * const tree = buildTree(leaves);
3717
+ * ```
3718
+ */
3719
+ generateLeaves(addresses, maxTreeDepth = 15) {
3720
+ const maxNumLeaves = Math.floor(2 ** (maxTreeDepth - 1));
3721
+ // Filter out zero addresses
3722
+ addresses = addresses.filter(addr => addr !== ZERO_ADDRESS);
3723
+ let numLeaves = 0;
3724
+ if (addresses.length === 0 || addresses.length === 1) {
3725
+ numLeaves = 2;
3726
+ }
3727
+ else {
3728
+ numLeaves = Math.pow(2, Math.ceil(Math.log2(addresses.length)));
3729
+ }
3730
+ if (addresses.length > maxNumLeaves) {
3731
+ throw new Error(`Leaves limit exceeded. Max: ${maxNumLeaves}, provided: ${addresses.length}`);
3732
+ }
3733
+ // Convert addresses to fields
3734
+ const addressFields = addresses.map(addr => ({
3735
+ address: addr,
3736
+ field: this.convertAddressToField(addr),
3737
+ }));
3738
+ // Sort by field value
3739
+ const sortedFields = addressFields.sort((a, b) => (a.field < b.field ? -1 : 1)).map(item => item.field);
3740
+ // Convert to field strings
3741
+ const sortedFieldElements = sortedFields.map(field => field.toString() + "field");
3742
+ // Pad with zeros to reach power of 2
3743
+ const fullTree = Array(Math.max(numLeaves - sortedFieldElements.length, 0)).fill("0field");
3744
+ return fullTree.concat(sortedFieldElements);
3745
+ }
3746
+ /**
3747
+ * Finds the leaf indices for non-inclusion proof of an address and returns the indices of the two adjacent leaves that surround the target address.
3748
+ *
3749
+ * @param merkleTree - The complete Merkle tree as array of BigInts.
3750
+ * @param address - The Aleo address for which to find indices.
3751
+ * @returns Tuple of [leftLeafIndex, rightLeafIndex].
3752
+ *
3753
+ * @example
3754
+ * ```typescript
3755
+ * const tree = buildTree(leaves);
3756
+ * const [leftIdx, rightIdx] = getLeafIndices(tree, "aleo1...");
3757
+ * ```
3758
+ */
3759
+ getLeafIndices(merkleTree, address) {
3760
+ const num_leaves = Math.floor((merkleTree.length + 1) / 2);
3761
+ const addressBigInt = this.convertAddressToField(address);
3762
+ const leaves = merkleTree.slice(0, num_leaves);
3763
+ let rightLeafIndex = leaves.findIndex((leaf) => addressBigInt <= leaf);
3764
+ let leftLeafIndex = rightLeafIndex - 1;
3765
+ if (rightLeafIndex === -1) {
3766
+ rightLeafIndex = leaves.length - 1;
3767
+ leftLeafIndex = leaves.length - 1;
3768
+ }
3769
+ if (rightLeafIndex === 0) {
3770
+ leftLeafIndex = 0;
3771
+ }
3772
+ return [leftLeafIndex, rightLeafIndex];
3773
+ }
3774
+ /**
3775
+ * Generates the sibling path (Merkle proof) for a given leaf index
3776
+ *
3777
+ * @param tree - The complete Merkle tree.
3778
+ * @param leafIndex - Index of the leaf for which to generate the proof.
3779
+ * @param depth - Maximum depth of the tree.
3780
+ * @returns Object containing siblings array and leaf_index.
3781
+ *
3782
+ * @example
3783
+ * ```typescript
3784
+ * const tree = buildTree(leaves);
3785
+ * const proof = getSiblingPath(tree, 0, 15);
3786
+ * // proof = { siblings: [0n, 1n, ...], leaf_index: 0 }
3787
+ * ```
3788
+ */
3789
+ getSiblingPath(tree, leafIndex, depth) {
3790
+ let num_leaves = Math.floor((tree.length + 1) / 2);
3791
+ const siblingPath = [];
3792
+ let index = leafIndex;
3793
+ let parentIndex = num_leaves;
3794
+ siblingPath.push(tree[index]);
3795
+ let level = 1;
3796
+ while (parentIndex < tree.length) {
3797
+ let siblingIndex = index % 2 === 0 ? index + 1 : index - 1; // Get the sibling index
3798
+ siblingPath.push(tree[siblingIndex]);
3799
+ index = parentIndex + Math.floor(leafIndex / 2 ** level); // Move up to the parent node
3800
+ parentIndex += Math.floor(num_leaves / 2 ** level); // Halve the number of nodes for the next level
3801
+ level++;
3802
+ }
3803
+ while (level < depth) {
3804
+ siblingPath.push(0n);
3805
+ level++;
3806
+ }
3807
+ return { siblings: siblingPath, leaf_index: leafIndex };
3808
+ }
3809
+ }
3810
+
3239
3811
  /**
3240
3812
  * The ProgramManager class is used to execute and deploy programs on the Aleo network and create value transfers.
3241
3813
  */
@@ -3245,6 +3817,7 @@ class ProgramManager {
3245
3817
  host;
3246
3818
  networkClient;
3247
3819
  recordProvider;
3820
+ inclusionKeysLoaded = false;
3248
3821
  /** Create a new instance of the ProgramManager
3249
3822
  *
3250
3823
  * @param { string | undefined } host A host uri running the official Aleo API
@@ -3610,9 +4183,146 @@ class ProgramManager {
3610
4183
  logAndThrow(`Error finding program imports. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
3611
4184
  }
3612
4185
  }
4186
+ if (offlineQuery && !this.inclusionKeysLoaded) {
4187
+ try {
4188
+ const inclusionKeys = await this.keyProvider.inclusionKeys();
4189
+ ProgramManager$1.loadInclusionProver(inclusionKeys[0]);
4190
+ this.inclusionKeysLoaded = true;
4191
+ console.log("Successfully loaded inclusion key");
4192
+ }
4193
+ catch {
4194
+ logAndThrow(`Inclusion key bytes not loaded, please ensure the program manager is initialized with a KeyProvider that includes the inclusion key.`);
4195
+ }
4196
+ }
3613
4197
  // Build an execution transaction
3614
4198
  return await ProgramManager$1.buildExecutionTransaction(executionPrivateKey, program, functionName, inputs, priorityFee, feeRecord, this.host, imports, provingKey, verifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery, edition);
3615
4199
  }
4200
+ /**
4201
+ * Builds an execution transaction for submission to the Aleo network from an Authorization and Fee Authorization.
4202
+ * This method is helpful if signing and authorization needs to be done in a secure environment separate from where
4203
+ * transactions are built.
4204
+ *
4205
+ * @param {ExecuteAuthorizationOptions} options - The options for executing the authorizations.
4206
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
4207
+ *
4208
+ * @example
4209
+ * /// Import the mainnet version of the sdk.
4210
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
4211
+ *
4212
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider.
4213
+ * const keyProvider = new AleoKeyProvider();
4214
+ * keyProvider.useCache(true);
4215
+ *
4216
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
4217
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider);
4218
+ *
4219
+ * // Build the `Authorization`.
4220
+ * const authorization = await programManager.buildAuthorization({
4221
+ * programName: "credits.aleo",
4222
+ * functionName: "transfer_public",
4223
+ * inputs: [
4224
+ * "aleo1vwls2ete8dk8uu2kmkmzumd7q38fvshrht8hlc0a5362uq8ftgyqnm3w08",
4225
+ * "10000000u64",
4226
+ * ],
4227
+ * });
4228
+ *
4229
+ * // Derive the execution ID and base fee.
4230
+ * const executionId = authorization.toExecutionId().toString();
4231
+ *
4232
+ * // Get the base fee in microcredits.
4233
+ * const baseFeeMicrocredits = ProgramManager.estimateFeeForAuthorization(authorization, "credits.aleo");
4234
+ * const baseFeeCredits = baseFeeMicrocredits/1000000;
4235
+ *
4236
+ * // Build a credits.aleo/fee_public `Authorization`.
4237
+ * const feeAuthorization = await programManager.buildFeeAuthorization({
4238
+ * deploymentOrExecutionId: executionId,
4239
+ * baseFeeCredits,
4240
+ * });
4241
+ *
4242
+ * // Build and execute the transaction
4243
+ * const tx = await programManager.buildTransactionFromAuthorization({
4244
+ * programName: "hello_hello.aleo",
4245
+ * authorization,
4246
+ * feeAuthorization,
4247
+ * });
4248
+ *
4249
+ * // Submit the transaction to the network
4250
+ * await programManager.networkClient.submitTransaction(tx.toString());
4251
+ *
4252
+ * // Verify the transaction was successful
4253
+ * setTimeout(async () => {
4254
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
4255
+ * assert(transaction.id() === tx.id());
4256
+ * }, 10000);
4257
+ */
4258
+ async buildTransactionFromAuthorization(options) {
4259
+ // Destructure the options object to access the parameters.
4260
+ const { programName, authorization, } = options;
4261
+ const feeAuthorization = options.feeAuthorization;
4262
+ const keySearchParams = options.keySearchParams;
4263
+ const offlineQuery = options.offlineQuery;
4264
+ let provingKey = options.provingKey;
4265
+ let verifyingKey = options.verifyingKey;
4266
+ let program = options.program;
4267
+ let imports = options.imports;
4268
+ // Ensure the function exists on the network.
4269
+ if (program === undefined) {
4270
+ try {
4271
+ program = (await this.networkClient.getProgram(programName));
4272
+ }
4273
+ catch (e) {
4274
+ logAndThrow(`Error finding ${programName}. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network the program is deployed to the network.`);
4275
+ }
4276
+ }
4277
+ else if (program instanceof Program) {
4278
+ program = program.toString();
4279
+ }
4280
+ // Get the fee proving and verifying keys from the key provider.
4281
+ let feeKeys;
4282
+ const privateFee = feeAuthorization ? feeAuthorization.isFeePrivate() : false;
4283
+ try {
4284
+ feeKeys = privateFee
4285
+ ? await this.keyProvider.feePrivateKeys()
4286
+ : await this.keyProvider.feePublicKeys();
4287
+ }
4288
+ catch (e) {
4289
+ logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
4290
+ }
4291
+ const [feeProvingKey, feeVerifyingKey] = feeKeys;
4292
+ // If the function proving and verifying keys are not provided, attempt to find them using the key provider.
4293
+ if (!provingKey || !verifyingKey) {
4294
+ try {
4295
+ [provingKey, verifyingKey] = (await this.keyProvider.functionKeys(keySearchParams));
4296
+ }
4297
+ catch (e) {
4298
+ console.log(`Function keys not found. Key finder response: '${e}'. The function keys will be synthesized`);
4299
+ }
4300
+ }
4301
+ // Resolve the program imports if they exist.
4302
+ const numberOfImports = Program.fromString(program).getImports().length;
4303
+ if (numberOfImports > 0 && !imports) {
4304
+ try {
4305
+ imports = (await this.networkClient.getProgramImports(programName));
4306
+ }
4307
+ catch (e) {
4308
+ logAndThrow(`Error finding program imports. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
4309
+ }
4310
+ }
4311
+ // If the offline query exists, add the inclusion key.
4312
+ if (offlineQuery && !this.inclusionKeysLoaded) {
4313
+ try {
4314
+ const inclusionKeys = await this.keyProvider.inclusionKeys();
4315
+ ProgramManager$1.loadInclusionProver(inclusionKeys[0]);
4316
+ this.inclusionKeysLoaded = true;
4317
+ console.log("Successfully loaded inclusion key");
4318
+ }
4319
+ catch {
4320
+ logAndThrow(`Inclusion key bytes not loaded, please ensure the program manager is initialized with a KeyProvider that includes the inclusion key.`);
4321
+ }
4322
+ }
4323
+ // Build an execution transaction from the authorization.
4324
+ return await ProgramManager$1.executeAuthorization(authorization, feeAuthorization, program, provingKey, verifyingKey, feeProvingKey, feeVerifyingKey, imports, this.host, offlineQuery);
4325
+ }
3616
4326
  /**
3617
4327
  * Builds a SnarkVM `Authorization` for a specific function.
3618
4328
  *
@@ -3895,14 +4605,14 @@ class ProgramManager {
3895
4605
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
3896
4606
  *
3897
4607
  * // Build a credits.aleo/fee_public `Authorization`.
3898
- * const feePublicAuthorization = await programManager.authorizeFee({
4608
+ * const feePublicAuthorization = await programManager.buildFeeAuthorization({
3899
4609
  * deploymentOrExecutionId: "2423957656946557501636078245035919227529640894159332581642187482178647335171field",
3900
4610
  * baseFeeCredits: 0.1,
3901
4611
  * });
3902
4612
  *
3903
4613
  * // Build a credits.aleo/fee_private `Authorization`.
3904
4614
  * const record = "{ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private, microcredits: 1500000000000000u64.private, _nonce: 3077450429259593211617823051143573281856129402760267155982965992208217472983group.public }";
3905
- * const feePrivateAuthorization = await programManager.authorizeFee({
4615
+ * const feePrivateAuthorization = await programManager.buildFeeAuthorization({
3906
4616
  * deploymentOrExecutionId: "2423957656946557501636078245035919227529640894159332581642187482178647335171field",
3907
4617
  * baseFeeCredits: 0.1,
3908
4618
  * feeRecord: record,
@@ -4116,6 +4826,18 @@ class ProgramManager {
4116
4826
  catch (e) {
4117
4827
  logAndThrow("Records provided are not valid. Please ensure they are valid plaintext records.");
4118
4828
  }
4829
+ // Load the inclusion prover offline.
4830
+ if (offlineQuery && !this.inclusionKeysLoaded) {
4831
+ try {
4832
+ const inclusionKeys = await this.keyProvider.inclusionKeys();
4833
+ ProgramManager$1.loadInclusionProver(inclusionKeys[0]);
4834
+ this.inclusionKeysLoaded = true;
4835
+ console.log("Successfully loaded inclusion key");
4836
+ }
4837
+ catch {
4838
+ logAndThrow(`Inclusion key bytes not loaded, please ensure the program manager is initialized with a KeyProvider that includes the inclusion key.`);
4839
+ }
4840
+ }
4119
4841
  // Build an execution transaction and submit it to the network
4120
4842
  const tx = await ProgramManager$1.buildJoinTransaction(executionPrivateKey, recordOne, recordTwo, priorityFee, feeRecord, this.host, joinProvingKey, joinVerifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
4121
4843
  // Check if the account has sufficient credits to pay for the transaction
@@ -4180,6 +4902,18 @@ class ProgramManager {
4180
4902
  catch (e) {
4181
4903
  logAndThrow("Record provided is not valid. Please ensure it is a valid plaintext record.");
4182
4904
  }
4905
+ // Load the inclusion prover offline.
4906
+ if (offlineQuery && !this.inclusionKeysLoaded) {
4907
+ try {
4908
+ const inclusionKeys = await this.keyProvider.inclusionKeys();
4909
+ ProgramManager$1.loadInclusionProver(inclusionKeys[0]);
4910
+ this.inclusionKeysLoaded = true;
4911
+ console.log("Successfully loaded inclusion key");
4912
+ }
4913
+ catch {
4914
+ logAndThrow(`Inclusion key bytes not loaded, please ensure the program manager is initialized with a KeyProvider that includes the inclusion key.`);
4915
+ }
4916
+ }
4183
4917
  // Build an execution transaction and submit it to the network
4184
4918
  const tx = await ProgramManager$1.buildSplitTransaction(executionPrivateKey, splitAmount, amountRecord, this.host, splitProvingKey, splitVerifyingKey, offlineQuery);
4185
4919
  return await this.networkClient.submitTransaction(tx);
@@ -4299,6 +5033,20 @@ class ProgramManager {
4299
5033
  catch (e) {
4300
5034
  logAndThrow(`Error finding fee record. Record finder response: '${e.message}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
4301
5035
  }
5036
+ // Load the inclusion prover offline.
5037
+ if (offlineQuery && !this.inclusionKeysLoaded) {
5038
+ const inclusionKeys = await this.keyProvider.inclusionKeys();
5039
+ ProgramManager$1.loadInclusionProver(inclusionKeys[0]);
5040
+ try {
5041
+ const inclusionKeys = await this.keyProvider.inclusionKeys();
5042
+ ProgramManager$1.loadInclusionProver(inclusionKeys[0]);
5043
+ this.inclusionKeysLoaded = true;
5044
+ console.log("Successfully loaded inclusion key");
5045
+ }
5046
+ catch {
5047
+ logAndThrow(`Inclusion key bytes not loaded, please ensure the program manager is initialized with a KeyProvider that includes the inclusion key.`);
5048
+ }
5049
+ }
4302
5050
  // Build an execution transaction
4303
5051
  return await ProgramManager$1.buildTransferTransaction(executionPrivateKey, amount, recipient, transferType, amountRecord, priorityFee, feeRecord, this.host, transferProvingKey, transferVerifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
4304
5052
  }
@@ -4469,6 +5217,7 @@ class ProgramManager {
4469
5217
  privateFee,
4470
5218
  inputs,
4471
5219
  keySearchParams,
5220
+ program,
4472
5221
  ...additionalOptions,
4473
5222
  };
4474
5223
  return await this.buildExecutionTransaction(executeOptions);
@@ -4572,6 +5321,7 @@ class ProgramManager {
4572
5321
  privateFee,
4573
5322
  inputs,
4574
5323
  keySearchParams,
5324
+ program,
4575
5325
  ...additionalOptions,
4576
5326
  };
4577
5327
  return await this.buildExecutionTransaction(executeOptions);
@@ -4666,6 +5416,7 @@ class ProgramManager {
4666
5416
  privateFee,
4667
5417
  inputs,
4668
5418
  keySearchParams,
5419
+ program,
4669
5420
  ...additionalOptions,
4670
5421
  };
4671
5422
  return this.buildExecutionTransaction(executeOptions);
@@ -4763,6 +5514,7 @@ class ProgramManager {
4763
5514
  privateFee,
4764
5515
  inputs,
4765
5516
  keySearchParams,
5517
+ program,
4766
5518
  ...additionalOptions,
4767
5519
  };
4768
5520
  // Check if the account has sufficient credits to pay for the transaction
@@ -4856,7 +5608,7 @@ class ProgramManager {
4856
5608
  proverUri: CREDITS_PROGRAM_KEYS.set_validator_state.prover,
4857
5609
  verifierUri: CREDITS_PROGRAM_KEYS.set_validator_state.verifier,
4858
5610
  cacheKey: "credits.aleo/set_validator_state",
4859
- }), ...additionalOptions } = options;
5611
+ }), program = this.creditsProgram(), ...additionalOptions } = options;
4860
5612
  const executeOptions = {
4861
5613
  programName,
4862
5614
  functionName,
@@ -4864,6 +5616,7 @@ class ProgramManager {
4864
5616
  privateFee,
4865
5617
  inputs,
4866
5618
  keySearchParams,
5619
+ program,
4867
5620
  ...additionalOptions,
4868
5621
  };
4869
5622
  return await this.buildExecutionTransaction(executeOptions);
@@ -4966,6 +5719,15 @@ class ProgramManager {
4966
5719
  return false;
4967
5720
  }
4968
5721
  }
5722
+ /**
5723
+ * Set the inclusion key bytes.
5724
+ *
5725
+ * @param {executionResponse} executionResponse The response from an offline function execution (via the `programManager.run` method)
5726
+ * @param {ImportedPrograms} imports The imported programs used in the execution. Specified as { "programName": "programSourceCode", ... }
5727
+ * @param {ImportedVerifyingKeys} importedVerifyingKeys The verifying keys in the execution. Specified as { "programName": [["functionName", "verifyingKey"], ...], ... }
5728
+ * @returns {boolean} True if the proof is valid, false otherwise
5729
+ *
5730
+
4969
5731
  /**
4970
5732
  * Create a program object from a program's source code
4971
5733
  *
@@ -5039,5 +5801,5 @@ async function initializeWasm() {
5039
5801
  console.warn("initializeWasm is deprecated, you no longer need to use it");
5040
5802
  }
5041
5803
 
5042
- export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoNetworkClient, BlockHeightSearch, CREDITS_PROGRAM_KEYS, KEY_STORE, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TO_PRIVATE_TRANSFER, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, ProgramManager, VALID_TRANSFER_TYPES, initializeWasm, logAndThrow };
5804
+ export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoNetworkClient, BlockHeightSearch, CREDITS_PROGRAM_KEYS, KEY_STORE, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TO_PRIVATE_TRANSFER, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, ProgramManager, RECORD_DOMAIN, RecordScanner, SealanceMerkleTree, VALID_TRANSFER_TYPES, initializeWasm, logAndThrow };
5043
5805
  //# sourceMappingURL=browser.js.map