@provablehq/sdk 0.9.6 → 0.9.8

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.
@@ -1,5 +1,5 @@
1
1
  import 'core-js/proposals/json-parse-with-source.js';
2
- import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, EncryptionToolkit, Group, Program, Plaintext, Transaction, Metadata, VerifyingKey, ProvingKey, ProgramManager as ProgramManager$1, RecordPlaintext, verifyFunctionExecution } from '@provablehq/wasm/mainnet.js';
2
+ import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, EncryptionToolkit, Group, Program, Plaintext, Transaction, ProvingRequest, Metadata, VerifyingKey, ProvingKey, ProgramManager as ProgramManager$1, RecordPlaintext, verifyFunctionExecution } from '@provablehq/wasm/mainnet.js';
3
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/mainnet.js';
4
4
 
5
5
  /**
@@ -478,18 +478,20 @@ class AleoNetworkClient {
478
478
  headers;
479
479
  account;
480
480
  ctx;
481
+ verboseErrors;
481
482
  network;
482
483
  constructor(host, options) {
483
484
  this.host = host + "/mainnet";
484
485
  this.network = "mainnet";
485
486
  this.ctx = {};
487
+ this.verboseErrors = true;
486
488
  if (options && options.headers) {
487
489
  this.headers = options.headers;
488
490
  }
489
491
  else {
490
492
  this.headers = {
491
493
  // This is replaced by the actual version by a Rollup plugin
492
- "X-Aleo-SDK-Version": "0.9.6",
494
+ "X-Aleo-SDK-Version": "0.9.8",
493
495
  "X-Aleo-environment": environment(),
494
496
  };
495
497
  }
@@ -521,7 +523,6 @@ class AleoNetworkClient {
521
523
  * Set a new host for the networkClient
522
524
  *
523
525
  * @param {string} host The address of a node hosting the Aleo API
524
- * @param host
525
526
  *
526
527
  * @example
527
528
  * import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
@@ -535,6 +536,22 @@ class AleoNetworkClient {
535
536
  setHost(host) {
536
537
  this.host = host + "/mainnet";
537
538
  }
539
+ /**
540
+ * Set verbose errors to true or false for the `AleoNetworkClient`. When set to true, if `submitTransaction` fails, the failure responses will report descriptive information as to why the transaction failed.
541
+ *
542
+ * @param {boolean} verboseErrors Set verbose error mode to true or false for the AleoNetworkClient.
543
+ * @example
544
+ * import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
545
+ *
546
+ * // Create a networkClient
547
+ * const networkClient = new AleoNetworkClient();
548
+ *
549
+ * // Set debug mode to true
550
+ * networkClient.setVerboseTransactionErrors(true);
551
+ **/
552
+ setVerboseErrors(verboseErrors) {
553
+ this.verboseErrors = verboseErrors;
554
+ }
538
555
  /**
539
556
  * Set a header in the `AleoNetworkClient`s header map
540
557
  *
@@ -1773,7 +1790,8 @@ class AleoNetworkClient {
1773
1790
  ? transaction.toString()
1774
1791
  : transaction;
1775
1792
  try {
1776
- const response = await retryWithBackoff(() => this._sendPost(this.host + "/transaction/broadcast", {
1793
+ const endpoint = this.verboseErrors ? "transaction/broadcast?check_transaction=true" : "transaction/broadcast";
1794
+ const response = await retryWithBackoff(() => this._sendPost(`${this.host}/${endpoint}`, {
1777
1795
  body: transactionString,
1778
1796
  headers: Object.assign({}, { ...this.headers, "X-ALEO-METHOD": "submitTransaction" }, {
1779
1797
  "Content-Type": "application/json",
@@ -1817,6 +1835,40 @@ class AleoNetworkClient {
1817
1835
  throw new Error(`Error posting solution: No response received: ${error.message}`);
1818
1836
  }
1819
1837
  }
1838
+ /**
1839
+ * Submit a `ProvingRequest` to a remote proving service for delegated proving. If the broadcast flag of the `ProvingRequest` is set to `true` the remote service will attempt to broadcast the result `Transaction` on behalf of the requestor.
1840
+ *
1841
+ * @param {DelegatedProvingParams} options - The optional parameters required to submit a proving request.
1842
+ * @returns {Promise<ProvingResponse>} The ProvingResponse containing the transaction result and the result of the broadcast if the `broadcast` flag was set to `true`.
1843
+ */
1844
+ async submitProvingRequest(options) {
1845
+ const proverUri = options.url ?? this.host;
1846
+ const provingRequestString = options.provingRequest instanceof ProvingRequest
1847
+ ? options.provingRequest.toString()
1848
+ : options.provingRequest;
1849
+ // Build headers with proper auth fallback
1850
+ const headers = {
1851
+ ...this.headers,
1852
+ "X-ALEO-METHOD": "submitProvingRequest",
1853
+ "Content-Type": "application/json"
1854
+ };
1855
+ // Add auth header based on what's available
1856
+ if (options.apiKey) {
1857
+ headers["X-Provable-API-Key"] = options.apiKey;
1858
+ }
1859
+ try {
1860
+ const response = await retryWithBackoff(() => post(`${proverUri}/prove`, {
1861
+ body: provingRequestString,
1862
+ headers
1863
+ }));
1864
+ const responseText = await response.text();
1865
+ return parseJSON(responseText);
1866
+ }
1867
+ catch (error) {
1868
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
1869
+ throw new Error(`Failed to submit proving request: ${errorMessage}`);
1870
+ }
1871
+ }
1820
1872
  /**
1821
1873
  * Await a submitted transaction to be confirmed or rejected on the Aleo network.
1822
1874
  *
@@ -3282,7 +3334,7 @@ class ProgramManager {
3282
3334
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
3283
3335
  * const keyProvider = new AleoKeyProvider();
3284
3336
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3285
- * keyProvider.useCache = true;
3337
+ * keyProvider.useCache(true);
3286
3338
  *
3287
3339
  * // Initialize a program manager with the key provider to automatically fetch keys for deployments
3288
3340
  * const program = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n";
@@ -3386,7 +3438,7 @@ class ProgramManager {
3386
3438
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
3387
3439
  * const keyProvider = new AleoKeyProvider();
3388
3440
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3389
- * keyProvider.useCache = true;
3441
+ * keyProvider.useCache(true);
3390
3442
  *
3391
3443
  * // Initialize a program manager with the key provider to automatically fetch keys for deployments
3392
3444
  * const program = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n";
@@ -3433,7 +3485,7 @@ class ProgramManager {
3433
3485
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
3434
3486
  * const keyProvider = new AleoKeyProvider();
3435
3487
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3436
- * keyProvider.useCache = true;
3488
+ * keyProvider.useCache(true);
3437
3489
  *
3438
3490
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
3439
3491
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -3459,11 +3511,12 @@ class ProgramManager {
3459
3511
  */
3460
3512
  async buildExecutionTransaction(options) {
3461
3513
  // Destructure the options object to access the parameters
3462
- const { programName, functionName, priorityFee, privateFee, inputs, recordSearchParams, keySearchParams, privateKey, offlineQuery, } = options;
3514
+ const { functionName, priorityFee, privateFee, inputs, recordSearchParams, keySearchParams, privateKey, offlineQuery, } = options;
3463
3515
  let feeRecord = options.feeRecord;
3464
3516
  let provingKey = options.provingKey;
3465
3517
  let verifyingKey = options.verifyingKey;
3466
3518
  let program = options.program;
3519
+ let programName = options.programName;
3467
3520
  let imports = options.imports;
3468
3521
  let edition = options.edition;
3469
3522
  // Ensure the function exists on the network
@@ -3478,6 +3531,10 @@ class ProgramManager {
3478
3531
  else if (program instanceof Program) {
3479
3532
  program = program.toString();
3480
3533
  }
3534
+ // Get the program name if it is not provided in the parameters.
3535
+ if (programName === undefined) {
3536
+ programName = Program.fromString(program).id();
3537
+ }
3481
3538
  if (edition == undefined) {
3482
3539
  try {
3483
3540
  edition = await this.networkClient.getLatestProgramEdition(programName);
@@ -3551,7 +3608,7 @@ class ProgramManager {
3551
3608
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
3552
3609
  * const keyProvider = new AleoKeyProvider();
3553
3610
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3554
- * keyProvider.useCache = true;
3611
+ * keyProvider.useCache(true);
3555
3612
  *
3556
3613
  * // Initialize a ProgramManager with the key and record providers.
3557
3614
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -3568,9 +3625,10 @@ class ProgramManager {
3568
3625
  */
3569
3626
  async buildAuthorization(options) {
3570
3627
  // Destructure the options object to access the parameters.
3571
- const { programName, functionName, inputs, } = options;
3628
+ const { functionName, inputs, } = options;
3572
3629
  const privateKey = options.privateKey;
3573
3630
  let program = options.programSource;
3631
+ let programName = options.programName;
3574
3632
  let imports = options.programImports;
3575
3633
  let edition = options.edition;
3576
3634
  // Ensure the function exists on the network.
@@ -3585,6 +3643,10 @@ class ProgramManager {
3585
3643
  else if (program instanceof Program) {
3586
3644
  program = program.toString();
3587
3645
  }
3646
+ // Get the program name if it is not provided in the parameters.
3647
+ if (programName === undefined) {
3648
+ programName = Program.fromString(program).id();
3649
+ }
3588
3650
  // Get the private key from the account if it is not provided in the parameters.
3589
3651
  let executionPrivateKey = privateKey;
3590
3652
  if (typeof privateKey === "undefined" &&
@@ -3629,7 +3691,7 @@ class ProgramManager {
3629
3691
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
3630
3692
  * const keyProvider = new AleoKeyProvider();
3631
3693
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3632
- * keyProvider.useCache = true;
3694
+ * keyProvider.useCache(true);
3633
3695
  *
3634
3696
  * // Initialize a ProgramManager with the key and record providers.
3635
3697
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -3646,9 +3708,10 @@ class ProgramManager {
3646
3708
  */
3647
3709
  async buildAuthorizationUnchecked(options) {
3648
3710
  // Destructure the options object to access the parameters.
3649
- const { programName, functionName, inputs, } = options;
3711
+ const { functionName, inputs, } = options;
3650
3712
  const privateKey = options.privateKey;
3651
3713
  let program = options.programSource;
3714
+ let programName = options.programName;
3652
3715
  let imports = options.programImports;
3653
3716
  let edition = options.edition;
3654
3717
  // Ensure the function exists on the network.
@@ -3663,6 +3726,10 @@ class ProgramManager {
3663
3726
  else if (program instanceof Program) {
3664
3727
  program = program.toString();
3665
3728
  }
3729
+ // Get the program name if it is not provided in the parameters.
3730
+ if (programName === undefined) {
3731
+ programName = Program.fromString(program).id();
3732
+ }
3666
3733
  // Get the private key from the account if it is not provided in the parameters.
3667
3734
  let executionPrivateKey = privateKey;
3668
3735
  if (typeof privateKey === "undefined" &&
@@ -3707,7 +3774,7 @@ class ProgramManager {
3707
3774
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
3708
3775
  * const keyProvider = new AleoKeyProvider();
3709
3776
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3710
- * keyProvider.useCache = true;
3777
+ * keyProvider.useCache(true);
3711
3778
  *
3712
3779
  * // Initialize a ProgramManager with the key and record providers.
3713
3780
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -3728,9 +3795,10 @@ class ProgramManager {
3728
3795
  */
3729
3796
  async provingRequest(options) {
3730
3797
  // Destructure the options object to access the parameters.
3731
- const { programName, functionName, baseFee, priorityFee, privateFee, inputs, recordSearchParams, broadcast = false, unchecked = false, } = options;
3798
+ const { functionName, baseFee, priorityFee, privateFee, inputs, recordSearchParams, broadcast = false, unchecked = false, } = options;
3732
3799
  const privateKey = options.privateKey;
3733
3800
  let program = options.programSource;
3801
+ let programName = options.programName;
3734
3802
  let feeRecord = options.feeRecord;
3735
3803
  let imports = options.programImports;
3736
3804
  let edition = options.edition;
@@ -3746,6 +3814,10 @@ class ProgramManager {
3746
3814
  else if (program instanceof Program) {
3747
3815
  program = program.toString();
3748
3816
  }
3817
+ // Get the program name if it is not provided in the parameters.
3818
+ if (programName === undefined) {
3819
+ programName = Program.fromString(program).id();
3820
+ }
3749
3821
  if (edition == undefined) {
3750
3822
  try {
3751
3823
  edition = await this.networkClient.getLatestProgramEdition(programName);
@@ -3799,7 +3871,7 @@ class ProgramManager {
3799
3871
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
3800
3872
  * const keyProvider = new AleoKeyProvider();
3801
3873
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3802
- * keyProvider.useCache = true;
3874
+ * keyProvider.useCache(true);
3803
3875
  *
3804
3876
  * // Initialize a ProgramManager with the key and record providers.
3805
3877
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -3846,7 +3918,7 @@ class ProgramManager {
3846
3918
  * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
3847
3919
  * const keyProvider = new AleoKeyProvider();
3848
3920
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3849
- * keyProvider.useCache = true;
3921
+ * keyProvider.useCache(true);
3850
3922
  *
3851
3923
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
3852
3924
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -3960,7 +4032,7 @@ class ProgramManager {
3960
4032
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
3961
4033
  * const keyProvider = new AleoKeyProvider();
3962
4034
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
3963
- * keyProvider.useCache = true;
4035
+ * keyProvider.useCache(true);
3964
4036
  *
3965
4037
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
3966
4038
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -4048,7 +4120,7 @@ class ProgramManager {
4048
4120
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
4049
4121
  * const keyProvider = new AleoKeyProvider();
4050
4122
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
4051
- * keyProvider.useCache = true;
4123
+ * keyProvider.useCache(true);
4052
4124
  *
4053
4125
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
4054
4126
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -4151,7 +4223,7 @@ class ProgramManager {
4151
4223
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
4152
4224
  * const keyProvider = new AleoKeyProvider();
4153
4225
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
4154
- * keyProvider.useCache = true;
4226
+ * keyProvider.useCache(true);
4155
4227
  *
4156
4228
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
4157
4229
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -4229,7 +4301,7 @@ class ProgramManager {
4229
4301
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
4230
4302
  * const keyProvider = new AleoKeyProvider();
4231
4303
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
4232
- * keyProvider.useCache = true;
4304
+ * keyProvider.useCache(true);
4233
4305
  *
4234
4306
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
4235
4307
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -4262,7 +4334,7 @@ class ProgramManager {
4262
4334
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
4263
4335
  * const keyProvider = new AleoKeyProvider();
4264
4336
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
4265
- * keyProvider.useCache = true;
4337
+ * keyProvider.useCache(true);
4266
4338
  *
4267
4339
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
4268
4340
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -4300,7 +4372,7 @@ class ProgramManager {
4300
4372
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
4301
4373
  * const keyProvider = new AleoKeyProvider();
4302
4374
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
4303
- * keyProvider.useCache = true;
4375
+ * keyProvider.useCache(true);
4304
4376
  *
4305
4377
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
4306
4378
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -4343,7 +4415,7 @@ class ProgramManager {
4343
4415
  *
4344
4416
  * // Create a keyProvider to handle key management
4345
4417
  * const keyProvider = new AleoKeyProvider();
4346
- * keyProvider.useCache = true;
4418
+ * keyProvider.useCache(true);
4347
4419
  *
4348
4420
  * // Create a new ProgramManager with the key that will be used to bond credits
4349
4421
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4398,7 +4470,7 @@ class ProgramManager {
4398
4470
  *
4399
4471
  * // Create a keyProvider to handle key management
4400
4472
  * const keyProvider = new AleoKeyProvider();
4401
- * keyProvider.useCache = true;
4473
+ * keyProvider.useCache(true);
4402
4474
  *
4403
4475
  * // Create a new ProgramManager with the key that will be used to bond credits
4404
4476
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4444,7 +4516,7 @@ class ProgramManager {
4444
4516
  *
4445
4517
  * // Create a keyProvider to handle key management
4446
4518
  * const keyProvider = new AleoKeyProvider();
4447
- * keyProvider.useCache = true;
4519
+ * keyProvider.useCache(true);
4448
4520
  *
4449
4521
  * // Create a new ProgramManager with the key that will be used to bond credits
4450
4522
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4502,7 +4574,7 @@ class ProgramManager {
4502
4574
  *
4503
4575
  * // Create a keyProvider to handle key management
4504
4576
  * const keyProvider = new AleoKeyProvider();
4505
- * keyProvider.useCache = true;
4577
+ * keyProvider.useCache(true);
4506
4578
  *
4507
4579
  * // Create a new ProgramManager with the key that will be used to bond credits
4508
4580
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4547,7 +4619,7 @@ class ProgramManager {
4547
4619
  *
4548
4620
  * // Create a keyProvider to handle key management.
4549
4621
  * const keyProvider = new AleoKeyProvider();
4550
- * keyProvider.useCache = true;
4622
+ * keyProvider.useCache(true);
4551
4623
  *
4552
4624
  * // Create a new ProgramManager with the key that will be used to unbond credits.
4553
4625
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4599,7 +4671,7 @@ class ProgramManager {
4599
4671
  *
4600
4672
  * // Create a keyProvider to handle key management
4601
4673
  * const keyProvider = new AleoKeyProvider();
4602
- * keyProvider.useCache = true;
4674
+ * keyProvider.useCache(true);
4603
4675
  *
4604
4676
  * // Create a new ProgramManager with the key that will be used to bond credits
4605
4677
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4643,7 +4715,7 @@ class ProgramManager {
4643
4715
  *
4644
4716
  * // Create a keyProvider to handle key management
4645
4717
  * const keyProvider = new AleoKeyProvider();
4646
- * keyProvider.useCache = true;
4718
+ * keyProvider.useCache(true);
4647
4719
  *
4648
4720
  * // Create a new ProgramManager with the key that will be used to claim unbonded credits.
4649
4721
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4692,7 +4764,7 @@ class ProgramManager {
4692
4764
  *
4693
4765
  * // Create a keyProvider to handle key management
4694
4766
  * const keyProvider = new AleoKeyProvider();
4695
- * keyProvider.useCache = true;
4767
+ * keyProvider.useCache(true);
4696
4768
  *
4697
4769
  * // Create a new ProgramManager with the key that will be used to bond credits
4698
4770
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4744,7 +4816,7 @@ class ProgramManager {
4744
4816
  *
4745
4817
  * // Create a keyProvider to handle key management
4746
4818
  * const keyProvider = new AleoKeyProvider();
4747
- * keyProvider.useCache = true;
4819
+ * keyProvider.useCache(true);
4748
4820
  *
4749
4821
  * // Create a new ProgramManager with the key that will be used to bond credits
4750
4822
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -4799,7 +4871,7 @@ class ProgramManager {
4799
4871
  *
4800
4872
  * // Create a keyProvider to handle key management
4801
4873
  * const keyProvider = new AleoKeyProvider();
4802
- * keyProvider.useCache = true;
4874
+ * keyProvider.useCache(true);
4803
4875
  *
4804
4876
  * // Create a new ProgramManager with the key that will be used to bond credits
4805
4877
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);