@provablehq/sdk 0.6.13 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +16 -16
  2. package/dist/{account.d.ts → mainnet/account.d.ts} +3 -3
  3. package/dist/{index.d.ts → mainnet/browser.d.ts} +5 -4
  4. package/dist/mainnet/browser.js +3127 -0
  5. package/dist/mainnet/browser.js.map +1 -0
  6. package/dist/{function-key-provider.d.ts → mainnet/function-key-provider.d.ts} +57 -57
  7. package/dist/{network-client.d.ts → mainnet/network-client.d.ts} +26 -26
  8. package/dist/{node-polyfill.d.ts → mainnet/node-polyfill.d.ts} +1 -0
  9. package/dist/{node-polyfill.js → mainnet/node-polyfill.js} +1 -0
  10. package/dist/mainnet/node-polyfill.js.map +1 -0
  11. package/dist/mainnet/node.d.ts +2 -0
  12. package/dist/{node.js → mainnet/node.js} +3 -2
  13. package/dist/{node.js.map → mainnet/node.js.map} +1 -1
  14. package/dist/{offline-key-provider.d.ts → mainnet/offline-key-provider.d.ts} +22 -22
  15. package/dist/mainnet/polyfill/shared.d.ts +1 -0
  16. package/dist/{program-manager.d.ts → mainnet/program-manager.d.ts} +59 -59
  17. package/dist/{record-provider.d.ts → mainnet/record-provider.d.ts} +22 -22
  18. package/dist/{utils.d.ts → mainnet/utils.d.ts} +1 -0
  19. package/dist/{worker.d.ts → mainnet/worker.d.ts} +2 -1
  20. package/dist/mainnet/worker.js +78 -0
  21. package/dist/mainnet/worker.js.map +1 -0
  22. package/dist/testnet/account.d.ts +137 -0
  23. package/dist/testnet/browser.d.ts +53 -0
  24. package/dist/{index.js → testnet/browser.js} +197 -186
  25. package/dist/testnet/browser.js.map +1 -0
  26. package/dist/testnet/function-key-provider.d.ts +348 -0
  27. package/dist/testnet/managed-worker.d.ts +3 -0
  28. package/dist/testnet/models/block.d.ts +21 -0
  29. package/dist/testnet/models/confirmed_transaction.d.ts +6 -0
  30. package/dist/testnet/models/execution.d.ts +5 -0
  31. package/dist/testnet/models/input.d.ts +10 -0
  32. package/dist/testnet/models/output.d.ts +6 -0
  33. package/dist/testnet/models/transactionModel.d.ts +6 -0
  34. package/dist/testnet/models/transition.d.ts +13 -0
  35. package/dist/testnet/network-client.d.ts +267 -0
  36. package/dist/testnet/node-polyfill.d.ts +5 -0
  37. package/dist/testnet/node-polyfill.js +303 -0
  38. package/dist/testnet/node-polyfill.js.map +1 -0
  39. package/dist/testnet/node.d.ts +2 -0
  40. package/dist/testnet/node.js +12 -0
  41. package/dist/testnet/node.js.map +1 -0
  42. package/dist/testnet/offline-key-provider.d.ts +347 -0
  43. package/dist/testnet/polyfill/crypto.d.ts +1 -0
  44. package/dist/testnet/polyfill/fetch.d.ts +1 -0
  45. package/dist/testnet/polyfill/shared.d.ts +1 -0
  46. package/dist/testnet/polyfill/worker.d.ts +1 -0
  47. package/dist/testnet/polyfill/xmlhttprequest.d.ts +1 -0
  48. package/dist/testnet/program-manager.d.ts +636 -0
  49. package/dist/testnet/record-provider.d.ts +236 -0
  50. package/dist/testnet/utils.d.ts +3 -0
  51. package/dist/testnet/worker.d.ts +9 -0
  52. package/dist/testnet/worker.js +78 -0
  53. package/dist/testnet/worker.js.map +1 -0
  54. package/package.json +23 -13
  55. package/dist/index.js.map +0 -1
  56. package/dist/node-polyfill.js.map +0 -1
  57. package/dist/node.d.ts +0 -2
  58. package/dist/worker.js +0 -74
  59. package/dist/worker.js.map +0 -1
  60. /package/dist/{managed-worker.d.ts → mainnet/managed-worker.d.ts} +0 -0
  61. /package/dist/{models → mainnet/models}/block.d.ts +0 -0
  62. /package/dist/{models → mainnet/models}/confirmed_transaction.d.ts +0 -0
  63. /package/dist/{models → mainnet/models}/execution.d.ts +0 -0
  64. /package/dist/{models → mainnet/models}/input.d.ts +0 -0
  65. /package/dist/{models → mainnet/models}/output.d.ts +0 -0
  66. /package/dist/{models → mainnet/models}/transactionModel.d.ts +0 -0
  67. /package/dist/{models → mainnet/models}/transition.d.ts +0 -0
  68. /package/dist/{polyfill → mainnet/polyfill}/crypto.d.ts +0 -0
  69. /package/dist/{polyfill → mainnet/polyfill}/fetch.d.ts +0 -0
  70. /package/dist/{polyfill → mainnet/polyfill}/worker.d.ts +0 -0
  71. /package/dist/{polyfill → mainnet/polyfill}/xmlhttprequest.d.ts +0 -0
@@ -1,5 +1,6 @@
1
- import { ViewKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, Program, Transaction, ProvingKey, VerifyingKey, ProgramManager as ProgramManager$1, RecordPlaintext, verifyFunctionExecution, Metadata } from '@provablehq/wasm';
2
- export { Address, ExecutionResponse, Field, Execution as FunctionExecution, OfflineQuery, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Transaction, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm';
1
+ import 'core-js/proposals/json-parse-with-source.js';
2
+ import { ViewKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, Program, Transaction, ProvingKey, VerifyingKey, ProgramManager as ProgramManager$1, RecordPlaintext, verifyFunctionExecution, Metadata } from '@provablehq/wasm/testnet.js';
3
+ export { Address, ExecutionResponse, Field, Execution as FunctionExecution, OfflineQuery, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Transaction, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
3
4
  import { wrap } from 'comlink';
4
5
 
5
6
  /**
@@ -50,7 +51,7 @@ class Account {
50
51
  * Attempts to create an account from a private key ciphertext
51
52
  * @param {PrivateKeyCiphertext | string} ciphertext
52
53
  * @param {string} password
53
- * @returns {PrivateKey | Error}
54
+ * @returns {PrivateKey}
54
55
  *
55
56
  * @example
56
57
  * const ciphertext = PrivateKey.newEncrypted("password");
@@ -130,7 +131,7 @@ class Account {
130
131
  *
131
132
  * @example
132
133
  * // Create a connection to the Aleo network and an account
133
- * const connection = new NodeConnection("vm.aleo.org/api");
134
+ * const connection = new AleoNetworkClient("https://api.explorer.provable.com/v1");
134
135
  * const account = Account.fromCiphertext("ciphertext", "password");
135
136
  *
136
137
  * // Get a record from the network
@@ -192,6 +193,17 @@ class Account {
192
193
  }
193
194
  }
194
195
 
196
+ function parseJSON(json) {
197
+ function revive(key, value, context) {
198
+ if (Number.isInteger(value)) {
199
+ return BigInt(context.source);
200
+ }
201
+ else {
202
+ return value;
203
+ }
204
+ }
205
+ return JSON.parse(json, revive);
206
+ }
195
207
  async function get(url, options) {
196
208
  const response = await fetch(url, options);
197
209
  if (!response.ok) {
@@ -218,7 +230,7 @@ async function post(url, options) {
218
230
  * const localNetworkClient = new AleoNetworkClient("http://localhost:3030");
219
231
  *
220
232
  * // Connection to a public beacon node
221
- * const publicnetworkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
233
+ * const publicnetworkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
222
234
  */
223
235
  class AleoNetworkClient {
224
236
  host;
@@ -232,7 +244,7 @@ class AleoNetworkClient {
232
244
  else {
233
245
  this.headers = {
234
246
  // This is replaced by the actual version by a Rollup plugin
235
- "X-Aleo-SDK-Version": "0.6.12",
247
+ "X-Aleo-SDK-Version": "0.7.0",
236
248
  };
237
249
  }
238
250
  }
@@ -270,7 +282,8 @@ class AleoNetworkClient {
270
282
  const response = await get(this.host + url, {
271
283
  headers: this.headers
272
284
  });
273
- return await response.json();
285
+ const text = await response.text();
286
+ return parseJSON(text);
274
287
  }
275
288
  catch (error) {
276
289
  throw new Error("Error fetching data.");
@@ -365,49 +378,63 @@ class AleoNetworkClient {
365
378
  // Get 50 blocks (or the difference between the start and end if less than 50)
366
379
  const blocks = await this.getBlockRange(start, end);
367
380
  end = start;
368
- if (!(blocks instanceof Error)) {
369
- // Iterate through blocks to find unspent records
370
- for (let i = 0; i < blocks.length; i++) {
371
- const block = blocks[i];
372
- const transactions = block.transactions;
373
- if (!(typeof transactions === "undefined")) {
374
- for (let j = 0; j < transactions.length; j++) {
375
- const confirmedTransaction = transactions[j];
376
- // Search for unspent records in execute transactions of credits.aleo
377
- if (confirmedTransaction.type == "execute") {
378
- const transaction = confirmedTransaction.transaction;
379
- if (transaction.execution && !(typeof transaction.execution.transitions == "undefined")) {
380
- for (let k = 0; k < transaction.execution.transitions.length; k++) {
381
- const transition = transaction.execution.transitions[k];
382
- // Only search for unspent records in credits.aleo (for now)
383
- if (transition.program !== "credits.aleo") {
384
- continue;
385
- }
386
- if (!(typeof transition.outputs == "undefined")) {
387
- for (let l = 0; l < transition.outputs.length; l++) {
388
- const output = transition.outputs[l];
389
- if (output.type === "record") {
390
- try {
391
- // Create a wasm record ciphertext object from the found output
392
- const record = RecordCiphertext.fromString(output.value);
393
- // Determine if the record is owned by the specified view key
394
- if (record.isOwner(viewKey)) {
395
- // Decrypt the record and get the serial number
396
- const recordPlaintext = record.decrypt(viewKey);
397
- // If the record has already been found, skip it
398
- const nonce = recordPlaintext.nonce();
399
- if (nonces.includes(nonce)) {
400
- continue;
401
- }
402
- // Otherwise record the nonce that has been found
403
- const serialNumber = recordPlaintext.serialNumberString(resolvedPrivateKey, "credits.aleo", "credits");
404
- // Attempt to see if the serial number is spent
405
- try {
406
- await this.getTransitionId(serialNumber);
381
+ // Iterate through blocks to find unspent records
382
+ for (let i = 0; i < blocks.length; i++) {
383
+ const block = blocks[i];
384
+ const transactions = block.transactions;
385
+ if (!(typeof transactions === "undefined")) {
386
+ for (let j = 0; j < transactions.length; j++) {
387
+ const confirmedTransaction = transactions[j];
388
+ // Search for unspent records in execute transactions of credits.aleo
389
+ if (confirmedTransaction.type == "execute") {
390
+ const transaction = confirmedTransaction.transaction;
391
+ if (transaction.execution && !(typeof transaction.execution.transitions == "undefined")) {
392
+ for (let k = 0; k < transaction.execution.transitions.length; k++) {
393
+ const transition = transaction.execution.transitions[k];
394
+ // Only search for unspent records in credits.aleo (for now)
395
+ if (transition.program !== "credits.aleo") {
396
+ continue;
397
+ }
398
+ if (!(typeof transition.outputs == "undefined")) {
399
+ for (let l = 0; l < transition.outputs.length; l++) {
400
+ const output = transition.outputs[l];
401
+ if (output.type === "record") {
402
+ try {
403
+ // Create a wasm record ciphertext object from the found output
404
+ const record = RecordCiphertext.fromString(output.value);
405
+ // Determine if the record is owned by the specified view key
406
+ if (record.isOwner(viewKey)) {
407
+ // Decrypt the record and get the serial number
408
+ const recordPlaintext = record.decrypt(viewKey);
409
+ // If the record has already been found, skip it
410
+ const nonce = recordPlaintext.nonce();
411
+ if (nonces.includes(nonce)) {
412
+ continue;
413
+ }
414
+ // Otherwise record the nonce that has been found
415
+ const serialNumber = recordPlaintext.serialNumberString(resolvedPrivateKey, "credits.aleo", "credits");
416
+ // Attempt to see if the serial number is spent
417
+ try {
418
+ await this.getTransitionId(serialNumber);
419
+ }
420
+ catch (error) {
421
+ // If it's not found, add it to the list of unspent records
422
+ if (!amounts) {
423
+ records.push(recordPlaintext);
424
+ // If the user specified a maximum number of microcredits, check if the search has found enough
425
+ if (typeof maxMicrocredits === "number") {
426
+ totalRecordValue += recordPlaintext.microcredits();
427
+ // Exit if the search has found the amount specified
428
+ if (totalRecordValue >= BigInt(maxMicrocredits)) {
429
+ return records;
430
+ }
431
+ }
407
432
  }
408
- catch (error) {
409
- // If it's not found, add it to the list of unspent records
410
- if (!amounts) {
433
+ // If the user specified a list of amounts, check if the search has found them
434
+ if (!(typeof amounts === "undefined") && amounts.length > 0) {
435
+ let amounts_found = 0;
436
+ if (recordPlaintext.microcredits() > amounts[amounts_found]) {
437
+ amounts_found += 1;
411
438
  records.push(recordPlaintext);
412
439
  // If the user specified a maximum number of microcredits, check if the search has found enough
413
440
  if (typeof maxMicrocredits === "number") {
@@ -417,31 +444,15 @@ class AleoNetworkClient {
417
444
  return records;
418
445
  }
419
446
  }
420
- }
421
- // If the user specified a list of amounts, check if the search has found them
422
- if (!(typeof amounts === "undefined") && amounts.length > 0) {
423
- let amounts_found = 0;
424
- if (recordPlaintext.microcredits() > amounts[amounts_found]) {
425
- amounts_found += 1;
426
- records.push(recordPlaintext);
427
- // If the user specified a maximum number of microcredits, check if the search has found enough
428
- if (typeof maxMicrocredits === "number") {
429
- totalRecordValue += recordPlaintext.microcredits();
430
- // Exit if the search has found the amount specified
431
- if (totalRecordValue >= BigInt(maxMicrocredits)) {
432
- return records;
433
- }
434
- }
435
- if (records.length >= amounts.length) {
436
- return records;
437
- }
447
+ if (records.length >= amounts.length) {
448
+ return records;
438
449
  }
439
450
  }
440
451
  }
441
452
  }
442
453
  }
443
- catch (error) {
444
- }
454
+ }
455
+ catch (error) {
445
456
  }
446
457
  }
447
458
  }
@@ -495,7 +506,7 @@ class AleoNetworkClient {
495
506
  return await this.fetchData("/blocks?start=" + start + "&end=" + end);
496
507
  }
497
508
  catch (error) {
498
- const errorMessage = "Error fetching blocks between " + start + " and " + end + ".";
509
+ const errorMessage = `Error fetching blocks between ${start} and ${end}.`;
499
510
  throw new Error(errorMessage);
500
511
  }
501
512
  }
@@ -503,7 +514,7 @@ class AleoNetworkClient {
503
514
  * Returns the deployment transaction id associated with the specified program
504
515
  *
505
516
  * @param {Program | string} program
506
- * @returns {TransactionModel | Error}
517
+ * @returns {TransactionModel}
507
518
  */
508
519
  async getDeploymentTransactionIDForProgram(program) {
509
520
  if (program instanceof Program) {
@@ -521,7 +532,7 @@ class AleoNetworkClient {
521
532
  * Returns the deployment transaction associated with a specified program
522
533
  *
523
534
  * @param {Program | string} program
524
- * @returns {TransactionModel | Error}
535
+ * @returns {TransactionModel}
525
536
  */
526
537
  async getDeploymentTransactionForProgram(program) {
527
538
  try {
@@ -567,7 +578,7 @@ class AleoNetworkClient {
567
578
  */
568
579
  async getLatestHeight() {
569
580
  try {
570
- return await this.fetchData("/latest/height");
581
+ return Number(await this.fetchData("/latest/height"));
571
582
  }
572
583
  catch (error) {
573
584
  throw new Error("Error fetching latest height.");
@@ -596,7 +607,7 @@ class AleoNetworkClient {
596
607
  * Returns a program object from a program ID or program source code
597
608
  *
598
609
  * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network
599
- * @return {Promise<Program | Error>} Source code of the program
610
+ * @return {Promise<Program>} Source code of the program
600
611
  *
601
612
  * @example
602
613
  * const programID = "hello_hello.aleo";
@@ -671,7 +682,7 @@ class AleoNetworkClient {
671
682
  return imports;
672
683
  }
673
684
  catch (error) {
674
- throw logAndThrow("Error fetching program imports: " + error);
685
+ logAndThrow("Error fetching program imports: " + error.message);
675
686
  }
676
687
  }
677
688
  /**
@@ -691,7 +702,7 @@ class AleoNetworkClient {
691
702
  return program.getImports();
692
703
  }
693
704
  catch (error) {
694
- throw new Error("Error fetching program imports with error: " + error);
705
+ throw new Error("Error fetching program imports with error: " + error.message);
695
706
  }
696
707
  }
697
708
  /**
@@ -810,7 +821,7 @@ class AleoNetworkClient {
810
821
  * Submit an execute or deployment transaction to the Aleo network
811
822
  *
812
823
  * @param {Transaction | string} transaction - The transaction to submit to the network
813
- * @returns {string | Error} - The transaction id of the submitted transaction or the resulting error
824
+ * @returns {string} - The transaction id of the submitted transaction or the resulting error
814
825
  */
815
826
  async submitTransaction(transaction) {
816
827
  const transaction_string = transaction instanceof Transaction ? transaction.toString() : transaction;
@@ -822,7 +833,8 @@ class AleoNetworkClient {
822
833
  }),
823
834
  });
824
835
  try {
825
- return await response.json();
836
+ const text = await response.text();
837
+ return parseJSON(text);
826
838
  }
827
839
  catch (error) {
828
840
  throw new Error(`Error posting transaction. Aleo network response: ${error.message}`);
@@ -874,7 +886,7 @@ class AleoKeyProvider {
874
886
  return new Uint8Array(data);
875
887
  }
876
888
  catch (error) {
877
- throw new Error("Error fetching data." + error);
889
+ throw new Error("Error fetching data." + error.message);
878
890
  }
879
891
  }
880
892
  constructor() {
@@ -929,7 +941,7 @@ class AleoKeyProvider {
929
941
  * Get a set of keys from the cache
930
942
  * @param keyId keyId of a proving and verifying key pair
931
943
  *
932
- * @returns {FunctionKeyPair | Error} Proving and verifying keys for the specified program
944
+ * @returns {FunctionKeyPair} Proving and verifying keys for the specified program
933
945
  */
934
946
  getKeys(keyId) {
935
947
  console.debug(`Checking if key exists in cache. KeyId: ${keyId}`);
@@ -938,23 +950,23 @@ class AleoKeyProvider {
938
950
  return [ProvingKey.fromBytes(provingKeyBytes), VerifyingKey.fromBytes(verifyingKeyBytes)];
939
951
  }
940
952
  else {
941
- return new Error("Key not found in cache.");
953
+ throw new Error("Key not found in cache.");
942
954
  }
943
955
  }
944
956
  /**
945
957
  * Get arbitrary function keys from a provider
946
958
  *
947
959
  * @param {KeySearchParams} params parameters for the key search in form of: {proverUri: string, verifierUri: string, cacheKey: string}
948
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the specified program
960
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program
949
961
  *
950
962
  * @example
951
963
  * // Create a new object which implements the KeyProvider interface
952
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
964
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
953
965
  * const keyProvider = new AleoKeyProvider();
954
966
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
955
967
  *
956
968
  * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
957
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
969
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
958
970
  * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
959
971
  *
960
972
  * // Keys can also be fetched manually using the key provider
@@ -968,9 +980,7 @@ class AleoKeyProvider {
968
980
  let cacheKey;
969
981
  if ("name" in params && typeof params["name"] == "string") {
970
982
  let key = CREDITS_PROGRAM_KEYS.getKey(params["name"]);
971
- if (!(key instanceof Error)) {
972
- return this.fetchCreditsKeys(key);
973
- }
983
+ return this.fetchCreditsKeys(key);
974
984
  }
975
985
  if ("proverUri" in params && typeof params["proverUri"] == "string") {
976
986
  proverUrl = params["proverUri"];
@@ -988,7 +998,7 @@ class AleoKeyProvider {
988
998
  return this.getKeys(cacheKey);
989
999
  }
990
1000
  }
991
- throw Error("Invalid parameters provided, must provide either a cacheKey and/or a proverUrl and a verifierUrl");
1001
+ throw new Error("Invalid parameters provided, must provide either a cacheKey and/or a proverUrl and a verifierUrl");
992
1002
  }
993
1003
  /**
994
1004
  * Returns the proving and verifying keys for a specified program from a specified url.
@@ -997,16 +1007,16 @@ class AleoKeyProvider {
997
1007
  * @param {string} proverUrl Url the verifying key
998
1008
  * @param {string} cacheKey Key to store the keys in the cache
999
1009
  *
1000
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the specified program
1010
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program
1001
1011
  *
1002
1012
  * @example
1003
1013
  * // Create a new AleoKeyProvider object
1004
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
1014
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
1005
1015
  * const keyProvider = new AleoKeyProvider();
1006
1016
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
1007
1017
  *
1008
1018
  * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
1009
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
1019
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
1010
1020
  * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
1011
1021
  *
1012
1022
  * // Keys can also be fetched manually
@@ -1043,7 +1053,7 @@ class AleoKeyProvider {
1043
1053
  }
1044
1054
  }
1045
1055
  catch (error) {
1046
- throw new Error(`Error: ${error} fetching fee proving and verifying keys from ${proverUrl} and ${verifierUrl}.`);
1056
+ throw new Error(`Error: ${error.message} fetching fee proving and verifying keys from ${proverUrl} and ${verifierUrl}.`);
1047
1057
  }
1048
1058
  }
1049
1059
  /***
@@ -1052,7 +1062,7 @@ class AleoKeyProvider {
1052
1062
  * @param proverUrl
1053
1063
  * @param cacheKey
1054
1064
  *
1055
- * @returns {Promise<ProvingKey | Error>} Proving key for the specified program
1065
+ * @returns {Promise<ProvingKey>} Proving key for the specified program
1056
1066
  */
1057
1067
  async fetchProvingKey(proverUrl, cacheKey) {
1058
1068
  try {
@@ -1077,7 +1087,7 @@ class AleoKeyProvider {
1077
1087
  }
1078
1088
  }
1079
1089
  catch (error) {
1080
- throw new Error(`Error: ${error} fetching fee proving keys from ${proverUrl}`);
1090
+ throw new Error(`Error: ${error.message} fetching fee proving keys from ${proverUrl}`);
1081
1091
  }
1082
1092
  }
1083
1093
  async fetchCreditsKeys(key) {
@@ -1096,7 +1106,7 @@ class AleoKeyProvider {
1096
1106
  }
1097
1107
  }
1098
1108
  catch (error) {
1099
- throw new Error(`Error: fetching credits.aleo keys: ${error}`);
1109
+ throw new Error(`Error: fetching credits.aleo keys: ${error.message}`);
1100
1110
  }
1101
1111
  }
1102
1112
  async bondPublicKeys() {
@@ -1111,16 +1121,16 @@ class AleoKeyProvider {
1111
1121
  /**
1112
1122
  * Returns the proving and verifying keys for the transfer functions in the credits.aleo program
1113
1123
  * @param {string} visibility Visibility of the transfer function
1114
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the transfer functions
1124
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the transfer functions
1115
1125
  *
1116
1126
  * @example
1117
1127
  * // Create a new AleoKeyProvider
1118
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
1128
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
1119
1129
  * const keyProvider = new AleoKeyProvider();
1120
1130
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
1121
1131
  *
1122
1132
  * // Initialize a program manager with the key provider to automatically fetch keys for value transfers
1123
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
1133
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
1124
1134
  * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
1125
1135
  *
1126
1136
  * // Keys can also be fetched manually
@@ -1149,7 +1159,7 @@ class AleoKeyProvider {
1149
1159
  /**
1150
1160
  * Returns the proving and verifying keys for the join function in the credits.aleo program
1151
1161
  *
1152
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
1162
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
1153
1163
  */
1154
1164
  async joinKeys() {
1155
1165
  return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.join);
@@ -1157,7 +1167,7 @@ class AleoKeyProvider {
1157
1167
  /**
1158
1168
  * Returns the proving and verifying keys for the split function in the credits.aleo program
1159
1169
  *
1160
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the split function
1170
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the split function
1161
1171
  * */
1162
1172
  async splitKeys() {
1163
1173
  return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.split);
@@ -1165,7 +1175,7 @@ class AleoKeyProvider {
1165
1175
  /**
1166
1176
  * Returns the proving and verifying keys for the fee_private function in the credits.aleo program
1167
1177
  *
1168
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the fee function
1178
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the fee function
1169
1179
  */
1170
1180
  async feePrivateKeys() {
1171
1181
  return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.fee_private);
@@ -1173,7 +1183,7 @@ class AleoKeyProvider {
1173
1183
  /**
1174
1184
  * Returns the proving and verifying keys for the fee_public function in the credits.aleo program
1175
1185
  *
1176
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the fee function
1186
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the fee function
1177
1187
  */
1178
1188
  async feePublicKeys() {
1179
1189
  return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.fee_public);
@@ -1181,7 +1191,7 @@ class AleoKeyProvider {
1181
1191
  /**
1182
1192
  * Gets a verifying key. If the verifying key is for a credits.aleo function, get it from the wasm cache otherwise
1183
1193
  *
1184
- * @returns {Promise<VerifyingKey | Error>} Verifying key for the function
1194
+ * @returns {Promise<VerifyingKey>} Verifying key for the function
1185
1195
  */
1186
1196
  // attempt to fetch it from the network
1187
1197
  async getVerifyingKey(verifierUri) {
@@ -1229,7 +1239,7 @@ class AleoKeyProvider {
1229
1239
  return VerifyingKey.fromBytes(await this.fetchBytes(verifierUri));
1230
1240
  }
1231
1241
  catch (inner) {
1232
- return new Error("Invalid verifying key. Error: " + inner);
1242
+ throw new Error("Invalid verifying key. Error: " + inner.message);
1233
1243
  }
1234
1244
  }
1235
1245
  }
@@ -1404,7 +1414,7 @@ class OfflineSearchParams {
1404
1414
  * const offlineExecuteTx = <Transaction>await this.buildExecutionTransaction("hello_hello.aleo", "hello", 1, false, ["5u32", "5u32"], undefined, offlineSearchParams, undefined, undefined, undefined, undefined, offlineQuery, program);
1405
1415
  *
1406
1416
  * // Broadcast the transaction later on a machine with internet access
1407
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
1417
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
1408
1418
  * const txId = await networkClient.broadcastTransaction(offlineExecuteTx);
1409
1419
  */
1410
1420
  class OfflineKeyProvider {
@@ -1416,7 +1426,7 @@ class OfflineKeyProvider {
1416
1426
  * Get bond_public function keys from the credits.aleo program. The keys must be cached prior to calling this
1417
1427
  * method for it to work.
1418
1428
  *
1419
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the bond_public function
1429
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_public function
1420
1430
  */
1421
1431
  bondPublicKeys() {
1422
1432
  return this.functionKeys(OfflineSearchParams.bondPublicKeyParams());
@@ -1426,7 +1436,7 @@ class OfflineKeyProvider {
1426
1436
  * Get bond_validator function keys from the credits.aleo program. The keys must be cached prior to calling this
1427
1437
  * method for it to work.
1428
1438
  *
1429
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the bond_public function
1439
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_public function
1430
1440
  */
1431
1441
  bondValidatorKeys() {
1432
1442
  return this.functionKeys(OfflineSearchParams.bondValidatorKeyParams());
@@ -1448,7 +1458,7 @@ class OfflineKeyProvider {
1448
1458
  * Get unbond_public function keys from the credits.aleo program. The keys must be cached prior to calling this
1449
1459
  * method for it to work.
1450
1460
  *
1451
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the unbond_public function
1461
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the unbond_public function
1452
1462
  */
1453
1463
  claimUnbondPublicKeys() {
1454
1464
  return this.functionKeys(OfflineSearchParams.claimUnbondPublicKeyParams());
@@ -1458,7 +1468,7 @@ class OfflineKeyProvider {
1458
1468
  * Get arbitrary function key from the offline key provider cache.
1459
1469
  *
1460
1470
  * @param {KeySearchParams | undefined} params - Optional search parameters for the key provider
1461
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the specified program
1471
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program
1462
1472
  *
1463
1473
  * @example
1464
1474
  * /// First cache the keys from local offline resources
@@ -1546,7 +1556,7 @@ class OfflineKeyProvider {
1546
1556
  * Get fee_private function keys from the credits.aleo program. The keys must be cached prior to calling this
1547
1557
  * method for it to work.
1548
1558
  *
1549
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
1559
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
1550
1560
  */
1551
1561
  feePrivateKeys() {
1552
1562
  return this.functionKeys(OfflineSearchParams.feePrivateKeyParams());
@@ -1556,7 +1566,7 @@ class OfflineKeyProvider {
1556
1566
  * Get fee_public function keys from the credits.aleo program. The keys must be cached prior to calling this
1557
1567
  * method for it to work.
1558
1568
  *
1559
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
1569
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
1560
1570
  */
1561
1571
  feePublicKeys() {
1562
1572
  return this.functionKeys(OfflineSearchParams.feePublicKeyParams());
@@ -1566,7 +1576,7 @@ class OfflineKeyProvider {
1566
1576
  * Get join function keys from the credits.aleo program. The keys must be cached prior to calling this
1567
1577
  * method for it to work.
1568
1578
  *
1569
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
1579
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
1570
1580
  */
1571
1581
  joinKeys() {
1572
1582
  return this.functionKeys(OfflineSearchParams.joinKeyParams());
@@ -1576,7 +1586,7 @@ class OfflineKeyProvider {
1576
1586
  * Get split function keys from the credits.aleo program. The keys must be cached prior to calling this
1577
1587
  * method for it to work.
1578
1588
  *
1579
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
1589
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
1580
1590
  */
1581
1591
  splitKeys() {
1582
1592
  return this.functionKeys(OfflineSearchParams.splitKeyParams());
@@ -1587,7 +1597,7 @@ class OfflineKeyProvider {
1587
1597
  *
1588
1598
  *
1589
1599
  * @param {string} visibility Visibility of the transfer function (private, public, privateToPublic, publicToPrivate)
1590
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the specified transfer function
1600
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified transfer function
1591
1601
  *
1592
1602
  * @example
1593
1603
  * // Create a new OfflineKeyProvider
@@ -1628,7 +1638,7 @@ class OfflineKeyProvider {
1628
1638
  /**
1629
1639
  * Get unbond_public function keys from the credits.aleo program
1630
1640
  *
1631
- * @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
1641
+ * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function
1632
1642
  */
1633
1643
  async unBondPublicKeys() {
1634
1644
  return this.functionKeys(OfflineSearchParams.unbondPublicKeyParams());
@@ -1835,11 +1845,11 @@ class NetworkRecordProvider {
1835
1845
  * @param {boolean} unspent Whether or not the record is unspent
1836
1846
  * @param {string[]} nonces Nonces of records already found so that they are not found again
1837
1847
  * @param {RecordSearchParams} searchParameters Additional parameters to search for
1838
- * @returns {Promise<RecordPlaintext | Error>} The record if found, otherwise an error
1848
+ * @returns {Promise<RecordPlaintext>} The record if found, otherwise an error
1839
1849
  *
1840
1850
  * @example
1841
1851
  * // Create a new NetworkRecordProvider
1842
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
1852
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
1843
1853
  * const keyProvider = new AleoKeyProvider();
1844
1854
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
1845
1855
  *
@@ -1852,7 +1862,7 @@ class NetworkRecordProvider {
1852
1862
  *
1853
1863
  * // When the program manager is initialized with the record provider it will be used to find automatically find
1854
1864
  * // fee records and amount records for value transfers so that they do not need to be specified manually
1855
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
1865
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
1856
1866
  * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
1857
1867
  *
1858
1868
  * */
@@ -1870,14 +1880,11 @@ class NetworkRecordProvider {
1870
1880
  // If the end height is not specified, use the current block height
1871
1881
  if (endHeight == 0) {
1872
1882
  const end = await this.networkClient.getLatestHeight();
1873
- if (end instanceof Error) {
1874
- throw logAndThrow("Unable to get current block height from the network");
1875
- }
1876
1883
  endHeight = end;
1877
1884
  }
1878
1885
  // If the start height is greater than the end height, throw an error
1879
1886
  if (startHeight >= endHeight) {
1880
- throw logAndThrow("Start height must be less than end height");
1887
+ logAndThrow("Start height must be less than end height");
1881
1888
  }
1882
1889
  return await this.networkClient.findUnspentRecords(startHeight, endHeight, this.account.privateKey(), microcredits, undefined, nonces);
1883
1890
  }
@@ -1888,11 +1895,11 @@ class NetworkRecordProvider {
1888
1895
  * @param {boolean} unspent Whether or not the record is unspent
1889
1896
  * @param {string[]} nonces Nonces of records already found so that they are not found again
1890
1897
  * @param {RecordSearchParams} searchParameters Additional parameters to search for
1891
- * @returns {Promise<RecordPlaintext | Error>} The record if found, otherwise an error
1898
+ * @returns {Promise<RecordPlaintext>} The record if found, otherwise an error
1892
1899
  *
1893
1900
  * @example
1894
1901
  * // Create a new NetworkRecordProvider
1895
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
1902
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
1896
1903
  * const keyProvider = new AleoKeyProvider();
1897
1904
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
1898
1905
  *
@@ -1905,16 +1912,20 @@ class NetworkRecordProvider {
1905
1912
  *
1906
1913
  * // When the program manager is initialized with the record provider it will be used to find automatically find
1907
1914
  * // fee records and amount records for value transfers so that they do not need to be specified manually
1908
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
1915
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
1909
1916
  * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
1910
1917
  */
1911
1918
  async findCreditsRecord(microcredits, unspent, nonces, searchParameters) {
1912
- const records = await this.findCreditsRecords([microcredits], unspent, nonces, searchParameters);
1913
- if (!(records instanceof Error) && records.length > 0) {
1919
+ let records = null;
1920
+ try {
1921
+ records = await this.findCreditsRecords([microcredits], unspent, nonces, searchParameters);
1922
+ }
1923
+ catch (e) { }
1924
+ if (records && records.length > 0) {
1914
1925
  return records[0];
1915
1926
  }
1916
1927
  console.error("Record not found with error:", records);
1917
- return new Error("Record not found");
1928
+ throw new Error("Record not found");
1918
1929
  }
1919
1930
  /**
1920
1931
  * Find an arbitrary record. WARNING: This function is not implemented yet and will throw an error.
@@ -1938,7 +1949,7 @@ class NetworkRecordProvider {
1938
1949
  * const params = new BlockHeightSearch(89995, 99995);
1939
1950
  *
1940
1951
  * // Create a new NetworkRecordProvider
1941
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
1952
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
1942
1953
  * const keyProvider = new AleoKeyProvider();
1943
1954
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
1944
1955
  *
@@ -1984,7 +1995,7 @@ class ProgramManager {
1984
1995
  * @param { RecordProvider | undefined } recordProvider A record provider that implements {@link RecordProvider} interface
1985
1996
  */
1986
1997
  constructor(host, keyProvider, recordProvider) {
1987
- this.host = host ? host : 'https://api.explorer.aleo.org/v1';
1998
+ this.host = host ? host : 'https://api.explorer.provable.com/v1';
1988
1999
  this.networkClient = new AleoNetworkClient(this.host);
1989
2000
  this.keyProvider = keyProvider ? keyProvider : new AleoKeyProvider();
1990
2001
  this.recordProvider = recordProvider;
@@ -2032,17 +2043,17 @@ class ProgramManager {
2032
2043
  * pay the deployment fee
2033
2044
  * @param {string | RecordPlaintext | undefined} feeRecord Optional Fee record to use for the transaction
2034
2045
  * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
2035
- * @returns {string | Error} The transaction id of the deployed program or a failure message from the network
2046
+ * @returns {string} The transaction id of the deployed program or a failure message from the network
2036
2047
  *
2037
2048
  * @example
2038
2049
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
2039
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
2050
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
2040
2051
  * const keyProvider = new AleoKeyProvider();
2041
2052
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
2042
2053
  *
2043
2054
  * // Initialize a program manager with the key provider to automatically fetch keys for deployments
2044
2055
  * 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";
2045
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
2056
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
2046
2057
  *
2047
2058
  * // Define a fee in credits
2048
2059
  * const fee = 1.2;
@@ -2070,7 +2081,7 @@ class ProgramManager {
2070
2081
  }
2071
2082
  }
2072
2083
  catch (e) {
2073
- throw logAndThrow(`Error validating program: ${e}`);
2084
+ logAndThrow(`Error validating program: ${e.message}`);
2074
2085
  }
2075
2086
  // Get the private key from the account if it is not provided in the parameters
2076
2087
  let deploymentPrivateKey = privateKey;
@@ -2085,7 +2096,7 @@ class ProgramManager {
2085
2096
  feeRecord = privateFee ? await this.getCreditsRecord(fee, [], feeRecord, recordSearchParams) : undefined;
2086
2097
  }
2087
2098
  catch (e) {
2088
- throw logAndThrow(`Error finding fee record. Record finder response: '${e}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
2099
+ 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.`);
2089
2100
  }
2090
2101
  // Get the proving and verifying keys from the key provider
2091
2102
  let feeKeys;
@@ -2093,7 +2104,7 @@ class ProgramManager {
2093
2104
  feeKeys = privateFee ? await this.keyProvider.feePrivateKeys() : await this.keyProvider.feePublicKeys();
2094
2105
  }
2095
2106
  catch (e) {
2096
- throw logAndThrow(`Error finding fee keys. Key finder response: '${e}'. Please ensure your key provider is configured correctly.`);
2107
+ logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
2097
2108
  }
2098
2109
  const [feeProvingKey, feeVerifyingKey] = feeKeys;
2099
2110
  // Resolve the program imports if they exist
@@ -2102,7 +2113,7 @@ class ProgramManager {
2102
2113
  imports = await this.networkClient.getProgramImports(program);
2103
2114
  }
2104
2115
  catch (e) {
2105
- throw logAndThrow(`Error finding program imports. Network response: '${e}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
2116
+ 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.`);
2106
2117
  }
2107
2118
  // Build a deployment transaction and submit it to the network
2108
2119
  const tx = await ProgramManager$1.buildDeploymentTransaction(deploymentPrivateKey, program, fee, feeRecord, this.host, imports, feeProvingKey, feeVerifyingKey);
@@ -2112,17 +2123,17 @@ class ProgramManager {
2112
2123
  * Builds an execution transaction for submission to the Aleo network.
2113
2124
  *
2114
2125
  * @param {ExecuteOptions} options - The options for the execution transaction.
2115
- * @returns {Promise<Transaction | Error>} - A promise that resolves to the transaction or an error.
2126
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
2116
2127
  *
2117
2128
  * @example
2118
2129
  * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
2119
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
2130
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
2120
2131
  * const keyProvider = new AleoKeyProvider();
2121
2132
  * keyProvider.useCache = true;
2122
2133
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
2123
2134
  *
2124
2135
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
2125
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
2136
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
2126
2137
  *
2127
2138
  * // Build and execute the transaction
2128
2139
  * const transaction = await programManager.buildExecutionTransaction({
@@ -2149,7 +2160,7 @@ class ProgramManager {
2149
2160
  program = (await this.networkClient.getProgram(programName));
2150
2161
  }
2151
2162
  catch (e) {
2152
- throw logAndThrow(`Error finding ${programName}. Network response: '${e}'. Please ensure you're connected to a valid Aleo network the program is deployed to the network.`);
2163
+ 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.`);
2153
2164
  }
2154
2165
  }
2155
2166
  else if (program instanceof Program) {
@@ -2168,7 +2179,7 @@ class ProgramManager {
2168
2179
  feeRecord = privateFee ? await this.getCreditsRecord(fee, [], feeRecord, recordSearchParams) : undefined;
2169
2180
  }
2170
2181
  catch (e) {
2171
- throw logAndThrow(`Error finding fee record. Record finder response: '${e}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
2182
+ 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.`);
2172
2183
  }
2173
2184
  // Get the fee proving and verifying keys from the key provider
2174
2185
  let feeKeys;
@@ -2176,7 +2187,7 @@ class ProgramManager {
2176
2187
  feeKeys = privateFee ? await this.keyProvider.feePrivateKeys() : await this.keyProvider.feePublicKeys();
2177
2188
  }
2178
2189
  catch (e) {
2179
- throw logAndThrow(`Error finding fee keys. Key finder response: '${e}'. Please ensure your key provider is configured correctly.`);
2190
+ logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
2180
2191
  }
2181
2192
  const [feeProvingKey, feeVerifyingKey] = feeKeys;
2182
2193
  // If the function proving and verifying keys are not provided, attempt to find them using the key provider
@@ -2195,7 +2206,7 @@ class ProgramManager {
2195
2206
  imports = await this.networkClient.getProgramImports(programName);
2196
2207
  }
2197
2208
  catch (e) {
2198
- throw logAndThrow(`Error finding program imports. Network response: '${e}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
2209
+ 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.`);
2199
2210
  }
2200
2211
  }
2201
2212
  // Build an execution transaction and submit it to the network
@@ -2205,17 +2216,17 @@ class ProgramManager {
2205
2216
  * Builds an execution transaction for submission to the Aleo network.
2206
2217
  *
2207
2218
  * @param {ExecuteOptions} options - The options for the execution transaction.
2208
- * @returns {Promise<Transaction | Error>} - A promise that resolves to the transaction or an error.
2219
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
2209
2220
  *
2210
2221
  * @example
2211
2222
  * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
2212
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
2223
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
2213
2224
  * const keyProvider = new AleoKeyProvider();
2214
2225
  * keyProvider.useCache = true;
2215
2226
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
2216
2227
  *
2217
2228
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
2218
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
2229
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
2219
2230
  *
2220
2231
  * // Build and execute the transaction
2221
2232
  * const transaction = await programManager.execute({
@@ -2247,7 +2258,7 @@ class ProgramManager {
2247
2258
  * @param {VerifyingKey | undefined} verifyingKey Optional verifying key to use for the transaction
2248
2259
  * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
2249
2260
  * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
2250
- * @returns {Promise<string | Error>}
2261
+ * @returns {Promise<string>}
2251
2262
  *
2252
2263
  * @example
2253
2264
  * import { Account, Program } from '@provablehq/sdk';
@@ -2301,7 +2312,7 @@ class ProgramManager {
2301
2312
  * @param {RecordPlaintext | string | undefined} feeRecord Fee record to use for the join transaction
2302
2313
  * @param {PrivateKey | undefined} privateKey Private key to use for the join transaction
2303
2314
  * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
2304
- * @returns {Promise<string | Error>}
2315
+ * @returns {Promise<string>}
2305
2316
  */
2306
2317
  async join(recordOne, recordTwo, fee, privateFee, recordSearchParams, feeRecord, privateKey, offlineQuery) {
2307
2318
  // Get the private key from the account if it is not provided in the parameters
@@ -2320,7 +2331,7 @@ class ProgramManager {
2320
2331
  joinKeys = await this.keyProvider.joinKeys();
2321
2332
  }
2322
2333
  catch (e) {
2323
- throw logAndThrow(`Error finding fee keys. Key finder response: '${e}'. Please ensure your key provider is configured correctly.`);
2334
+ logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
2324
2335
  }
2325
2336
  const [feeProvingKey, feeVerifyingKey] = feeKeys;
2326
2337
  const [joinProvingKey, joinVerifyingKey] = joinKeys;
@@ -2329,7 +2340,7 @@ class ProgramManager {
2329
2340
  feeRecord = privateFee ? await this.getCreditsRecord(fee, [], feeRecord, recordSearchParams) : undefined;
2330
2341
  }
2331
2342
  catch (e) {
2332
- throw logAndThrow(`Error finding fee record. Record finder response: '${e}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
2343
+ 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.`);
2333
2344
  }
2334
2345
  // Validate the records provided are valid plaintext records
2335
2346
  try {
@@ -2337,7 +2348,7 @@ class ProgramManager {
2337
2348
  recordTwo = recordTwo instanceof RecordPlaintext ? recordTwo : RecordPlaintext.fromString(recordTwo);
2338
2349
  }
2339
2350
  catch (e) {
2340
- throw logAndThrow('Records provided are not valid. Please ensure they are valid plaintext records.');
2351
+ logAndThrow('Records provided are not valid. Please ensure they are valid plaintext records.');
2341
2352
  }
2342
2353
  // Build an execution transaction and submit it to the network
2343
2354
  const tx = await ProgramManager$1.buildJoinTransaction(executionPrivateKey, recordOne, recordTwo, fee, feeRecord, this.host, joinProvingKey, joinVerifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
@@ -2350,17 +2361,17 @@ class ProgramManager {
2350
2361
  * @param {RecordPlaintext | string} amountRecord Amount record to use for the split transaction
2351
2362
  * @param {PrivateKey | undefined} privateKey Optional private key to use for the split transaction
2352
2363
  * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
2353
- * @returns {Promise<string | Error>}
2364
+ * @returns {Promise<string>}
2354
2365
  *
2355
2366
  * @example
2356
2367
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
2357
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
2368
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
2358
2369
  * const keyProvider = new AleoKeyProvider();
2359
2370
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
2360
2371
  *
2361
2372
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
2362
2373
  * const programName = "hello_hello.aleo";
2363
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
2374
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
2364
2375
  * const record = "{ owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private, microcredits: 45000000u64.private, _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}"
2365
2376
  * const tx_id = await programManager.split(25000000, record);
2366
2377
  * const transaction = await programManager.networkClient.getTransaction(tx_id);
@@ -2380,7 +2391,7 @@ class ProgramManager {
2380
2391
  splitKeys = await this.keyProvider.splitKeys();
2381
2392
  }
2382
2393
  catch (e) {
2383
- throw logAndThrow(`Error finding fee keys. Key finder response: '${e}'. Please ensure your key provider is configured correctly.`);
2394
+ logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
2384
2395
  }
2385
2396
  const [splitProvingKey, splitVerifyingKey] = splitKeys;
2386
2397
  // Validate the record to be split
@@ -2388,7 +2399,7 @@ class ProgramManager {
2388
2399
  amountRecord = amountRecord instanceof RecordPlaintext ? amountRecord : RecordPlaintext.fromString(amountRecord);
2389
2400
  }
2390
2401
  catch (e) {
2391
- throw logAndThrow("Record provided is not valid. Please ensure it is a valid plaintext record.");
2402
+ logAndThrow("Record provided is not valid. Please ensure it is a valid plaintext record.");
2392
2403
  }
2393
2404
  // Build an execution transaction and submit it to the network
2394
2405
  const tx = await ProgramManager$1.buildSplitTransaction(executionPrivateKey, splitAmount, amountRecord, this.host, splitProvingKey, splitVerifyingKey, offlineQuery);
@@ -2402,7 +2413,7 @@ class ProgramManager {
2402
2413
  * @param inputs {Array<string>} Sample inputs to the function
2403
2414
  * @param privateKey {PrivateKey | undefined} Optional private key to use for the key synthesis
2404
2415
  *
2405
- * @returns {Promise<FunctionKeyPair | Error>}
2416
+ * @returns {Promise<FunctionKeyPair>}
2406
2417
  */
2407
2418
  async synthesizeKeys(program, function_id, inputs, privateKey) {
2408
2419
  // Resolve the program imports if they exist
@@ -2423,7 +2434,7 @@ class ProgramManager {
2423
2434
  return [keyPair.provingKey(), keyPair.verifyingKey()];
2424
2435
  }
2425
2436
  catch (e) {
2426
- throw logAndThrow(`Could not synthesize keys - error ${e}. Please ensure the program is valid and the inputs are correct.`);
2437
+ logAndThrow(`Could not synthesize keys - error ${e.message}. Please ensure the program is valid and the inputs are correct.`);
2427
2438
  }
2428
2439
  }
2429
2440
  /**
@@ -2440,17 +2451,17 @@ class ProgramManager {
2440
2451
  * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
2441
2452
  * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
2442
2453
  * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
2443
- * @returns {Promise<string | Error>} The transaction id of the transfer transaction
2454
+ * @returns {Promise<string>} The transaction id of the transfer transaction
2444
2455
  *
2445
2456
  * @example
2446
2457
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
2447
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
2458
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
2448
2459
  * const keyProvider = new AleoKeyProvider();
2449
2460
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
2450
2461
  *
2451
2462
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
2452
2463
  * const programName = "hello_hello.aleo";
2453
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
2464
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
2454
2465
  * await programManager.initialize();
2455
2466
  * const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
2456
2467
  * const transaction = await programManager.networkClient.getTransaction(tx_id);
@@ -2474,7 +2485,7 @@ class ProgramManager {
2474
2485
  transferKeys = await this.keyProvider.transferKeys(transferType);
2475
2486
  }
2476
2487
  catch (e) {
2477
- throw logAndThrow(`Error finding fee keys. Key finder response: '${e}'. Please ensure your key provider is configured correctly.`);
2488
+ logAndThrow(`Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`);
2478
2489
  }
2479
2490
  const [feeProvingKey, feeVerifyingKey] = feeKeys;
2480
2491
  const [transferProvingKey, transferVerifyingKey] = transferKeys;
@@ -2493,7 +2504,7 @@ class ProgramManager {
2493
2504
  feeRecord = privateFee ? await this.getCreditsRecord(fee, nonces, feeRecord, recordSearchParams) : undefined;
2494
2505
  }
2495
2506
  catch (e) {
2496
- throw logAndThrow(`Error finding fee record. Record finder response: '${e}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
2507
+ 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.`);
2497
2508
  }
2498
2509
  // Build an execution transaction and submit it to the network
2499
2510
  return await ProgramManager$1.buildTransferTransaction(executionPrivateKey, amount, recipient, transferType, amountRecord, fee, feeRecord, this.host, transferProvingKey, transferVerifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
@@ -2512,7 +2523,7 @@ class ProgramManager {
2512
2523
  * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
2513
2524
  * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
2514
2525
  * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
2515
- * @returns {Promise<string | Error>} The transaction id of the transfer transaction
2526
+ * @returns {Promise<string>} The transaction id of the transfer transaction
2516
2527
  */
2517
2528
  async buildTransferPublicTransaction(amount, recipient, fee, privateKey, offlineQuery) {
2518
2529
  return this.buildTransferTransaction(amount, recipient, "public", fee, false, undefined, undefined, undefined, privateKey, offlineQuery);
@@ -2531,7 +2542,7 @@ class ProgramManager {
2531
2542
  * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
2532
2543
  * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
2533
2544
  * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
2534
- * @returns {Promise<string | Error>} The transaction id of the transfer transaction
2545
+ * @returns {Promise<string>} The transaction id of the transfer transaction
2535
2546
  */
2536
2547
  async buildTransferPublicAsSignerTransaction(amount, recipient, fee, privateKey, offlineQuery) {
2537
2548
  return this.buildTransferTransaction(amount, recipient, "public", fee, false, undefined, undefined, undefined, privateKey, offlineQuery);
@@ -2550,16 +2561,16 @@ class ProgramManager {
2550
2561
  * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
2551
2562
  * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
2552
2563
  * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
2553
- * @returns {Promise<string | Error>} The transaction id of the transfer transaction
2564
+ * @returns {Promise<string>} The transaction id of the transfer transaction
2554
2565
  *
2555
2566
  * @example
2556
2567
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
2557
- * const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
2568
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
2558
2569
  * const keyProvider = new AleoKeyProvider();
2559
2570
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
2560
2571
  *
2561
2572
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
2562
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
2573
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
2563
2574
  * await programManager.initialize();
2564
2575
  * const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "private", 0.2)
2565
2576
  * const transaction = await programManager.networkClient.getTransaction(tx_id);
@@ -2577,7 +2588,7 @@ class ProgramManager {
2577
2588
  * keyProvider.useCache = true;
2578
2589
  *
2579
2590
  * // Create a new ProgramManager with the key that will be used to bond credits
2580
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2591
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2581
2592
  * programManager.setAccount(new Account("YourPrivateKey"));
2582
2593
  *
2583
2594
  * // Create the bonding transaction object for later submission
@@ -2625,7 +2636,7 @@ class ProgramManager {
2625
2636
  * keyProvider.useCache = true;
2626
2637
  *
2627
2638
  * // Create a new ProgramManager with the key that will be used to bond credits
2628
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2639
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2629
2640
  * programManager.setAccount(new Account("YourPrivateKey"));
2630
2641
  *
2631
2642
  * // Create the bonding transaction
@@ -2655,7 +2666,7 @@ class ProgramManager {
2655
2666
  * keyProvider.useCache = true;
2656
2667
  *
2657
2668
  * // Create a new ProgramManager with the key that will be used to bond credits
2658
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2669
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2659
2670
  * programManager.setAccount(new Account("YourPrivateKey"));
2660
2671
  *
2661
2672
  * // Create the bond validator transaction object for later use.
@@ -2704,7 +2715,7 @@ class ProgramManager {
2704
2715
  * keyProvider.useCache = true;
2705
2716
  *
2706
2717
  * // Create a new ProgramManager with the key that will be used to bond credits
2707
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2718
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2708
2719
  * programManager.setAccount(new Account("YourPrivateKey"));
2709
2720
  *
2710
2721
  * // Create the bonding transaction
@@ -2731,7 +2742,7 @@ class ProgramManager {
2731
2742
  * @param {string} staker_address - The address of the staker who is unbonding the credits.
2732
2743
  * @param {number} amount - The amount of credits to unbond (scaled by 1,000,000).
2733
2744
  * @param {Partial<ExecuteOptions>} options - Override default execution options.
2734
- * @returns {Promise<Transaction | Error>} - A promise that resolves to the transaction or an error message.
2745
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.
2735
2746
  *
2736
2747
  * @example
2737
2748
  * // Create a keyProvider to handle key management.
@@ -2739,7 +2750,7 @@ class ProgramManager {
2739
2750
  * keyProvider.useCache = true;
2740
2751
  *
2741
2752
  * // Create a new ProgramManager with the key that will be used to unbond credits.
2742
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2753
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2743
2754
  * const tx = await programManager.buildUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 2000000);
2744
2755
  * console.log(tx);
2745
2756
  *
@@ -2773,7 +2784,7 @@ class ProgramManager {
2773
2784
  * keyProvider.useCache = true;
2774
2785
  *
2775
2786
  * // Create a new ProgramManager with the key that will be used to bond credits
2776
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2787
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2777
2788
  * programManager.setAccount(new Account("YourPrivateKey"));
2778
2789
  *
2779
2790
  * // Create the bonding transaction and send it to the network
@@ -2798,7 +2809,7 @@ class ProgramManager {
2798
2809
  *
2799
2810
  * @param {string} staker_address - The address of the staker who is claiming the credits.
2800
2811
  * @param {Partial<ExecuteOptions>} options - Override default execution options.
2801
- * @returns {Promise<Transaction | Error>} - A promise that resolves to the transaction or an error message.
2812
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.
2802
2813
  *
2803
2814
  * @example
2804
2815
  * // Create a keyProvider to handle key management
@@ -2806,7 +2817,7 @@ class ProgramManager {
2806
2817
  * keyProvider.useCache = true;
2807
2818
  *
2808
2819
  * // Create a new ProgramManager with the key that will be used to claim unbonded credits.
2809
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2820
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2810
2821
  *
2811
2822
  * // Create the claim unbonded transaction object for later use.
2812
2823
  * const tx = await programManager.buildClaimUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");
@@ -2842,7 +2853,7 @@ class ProgramManager {
2842
2853
  * keyProvider.useCache = true;
2843
2854
  *
2844
2855
  * // Create a new ProgramManager with the key that will be used to bond credits
2845
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2856
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2846
2857
  * programManager.setAccount(new Account("YourPrivateKey"));
2847
2858
  *
2848
2859
  * // Create the bonding transaction
@@ -2873,7 +2884,7 @@ class ProgramManager {
2873
2884
  * keyProvider.useCache = true;
2874
2885
  *
2875
2886
  * // Create a new ProgramManager with the key that will be used to bond credits
2876
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2887
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2877
2888
  * programManager.setAccount(new Account("ValidatorPrivateKey"));
2878
2889
  *
2879
2890
  * // Create the bonding transaction
@@ -2920,7 +2931,7 @@ class ProgramManager {
2920
2931
  * keyProvider.useCache = true;
2921
2932
  *
2922
2933
  * // Create a new ProgramManager with the key that will be used to bond credits
2923
- * const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, undefined);
2934
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
2924
2935
  * programManager.setAccount(new Account("ValidatorPrivateKey"));
2925
2936
  *
2926
2937
  * // Create the bonding transaction
@@ -2957,7 +2968,7 @@ class ProgramManager {
2957
2968
  * Create a program object from a program's source code
2958
2969
  *
2959
2970
  * @param {string} program Program source code
2960
- * @returns {Program | Error} The program object
2971
+ * @returns {Program} The program object
2961
2972
  */
2962
2973
  createProgramFromSource(program) {
2963
2974
  return Program.fromString(program);
@@ -2995,7 +3006,7 @@ class ProgramManager {
2995
3006
  return (await recordProvider.findCreditsRecord(amount, true, nonces, params));
2996
3007
  }
2997
3008
  catch (e) {
2998
- throw logAndThrow(`Error finding fee record. Record finder response: '${e}'. Please ensure you're connected to a valid Aleo network and a record with enough balance exists.`);
3009
+ 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.`);
2999
3010
  }
3000
3011
  }
3001
3012
  }
@@ -3046,7 +3057,7 @@ const CREDITS_PROGRAM_KEYS = {
3046
3057
  return this[key];
3047
3058
  }
3048
3059
  else {
3049
- return new Error(`Key "${key}" not found.`);
3060
+ throw new Error(`Key "${key}" not found.`);
3050
3061
  }
3051
3062
  }
3052
3063
  };
@@ -3105,7 +3116,7 @@ const PUBLIC_TO_PRIVATE_TRANSFER = new Set([
3105
3116
  ]);
3106
3117
  function logAndThrow(message) {
3107
3118
  console.error(message);
3108
- throw message;
3119
+ throw new Error(message);
3109
3120
  }
3110
3121
  // @TODO: This function is no longer needed, remove it.
3111
3122
  async function initializeWasm() {
@@ -3113,4 +3124,4 @@ async function initializeWasm() {
3113
3124
  }
3114
3125
 
3115
3126
  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, createAleoWorker, initializeWasm, logAndThrow };
3116
- //# sourceMappingURL=index.js.map
3127
+ //# sourceMappingURL=browser.js.map