@provablehq/sdk 0.9.1 → 0.9.3

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 (83) hide show
  1. package/dist/mainnet/account.d.ts +36 -1
  2. package/dist/mainnet/browser.d.ts +35 -35
  3. package/dist/mainnet/browser.js +52 -4
  4. package/dist/mainnet/browser.js.map +1 -1
  5. package/dist/mainnet/constants.d.ts +1 -1
  6. package/dist/mainnet/function-key-provider.d.ts +2 -2
  7. package/dist/mainnet/managed-worker.d.ts +1 -1
  8. package/dist/mainnet/models/authorization.d.ts +6 -0
  9. package/dist/mainnet/models/blockJSON.d.ts +3 -3
  10. package/dist/mainnet/models/confirmed_transaction.d.ts +2 -2
  11. package/dist/mainnet/models/deployment/deploymentObject.d.ts +1 -1
  12. package/dist/mainnet/models/execution/executionJSON.d.ts +1 -1
  13. package/dist/mainnet/models/execution/executionObject.d.ts +1 -1
  14. package/dist/mainnet/models/functionObject.d.ts +1 -1
  15. package/dist/mainnet/models/input/inputObject.d.ts +2 -2
  16. package/dist/mainnet/models/inputID.d.ts +4 -0
  17. package/dist/mainnet/models/output/outputObject.d.ts +2 -2
  18. package/dist/mainnet/models/owner/ownerObject.d.ts +1 -1
  19. package/dist/mainnet/models/plaintext/array.d.ts +2 -2
  20. package/dist/mainnet/models/plaintext/plaintext.d.ts +4 -4
  21. package/dist/mainnet/models/plaintext/struct.d.ts +2 -2
  22. package/dist/mainnet/models/request.d.ts +14 -0
  23. package/dist/mainnet/models/transaction/transactionJSON.d.ts +3 -3
  24. package/dist/mainnet/models/transaction/transactionObject.d.ts +3 -3
  25. package/dist/mainnet/models/transition/transitionJSON.d.ts +2 -2
  26. package/dist/mainnet/models/transition/transitionObject.d.ts +3 -3
  27. package/dist/mainnet/network-client.d.ts +5 -19
  28. package/dist/mainnet/node-polyfill.d.ts +5 -5
  29. package/dist/mainnet/node-polyfill.js.map +1 -1
  30. package/dist/mainnet/node.d.ts +2 -2
  31. package/dist/mainnet/node.js +2 -2
  32. package/dist/mainnet/offline-key-provider.d.ts +2 -2
  33. package/dist/mainnet/{program-manager-DMDKstZ8.js → program-manager-BfZnPCKl.js} +119 -18
  34. package/dist/mainnet/program-manager-BfZnPCKl.js.map +1 -0
  35. package/dist/mainnet/program-manager.d.ts +105 -9
  36. package/dist/mainnet/record-provider.d.ts +3 -3
  37. package/dist/mainnet/wasm.d.ts +1 -1
  38. package/dist/mainnet/worker.d.ts +2 -2
  39. package/dist/mainnet/worker.js +1 -1
  40. package/dist/mainnet/worker.js.map +1 -1
  41. package/dist/testnet/account.d.ts +36 -1
  42. package/dist/testnet/browser.d.ts +35 -35
  43. package/dist/testnet/browser.js +52 -4
  44. package/dist/testnet/browser.js.map +1 -1
  45. package/dist/testnet/constants.d.ts +1 -1
  46. package/dist/testnet/function-key-provider.d.ts +2 -2
  47. package/dist/testnet/managed-worker.d.ts +1 -1
  48. package/dist/testnet/models/authorization.d.ts +6 -0
  49. package/dist/testnet/models/blockJSON.d.ts +3 -3
  50. package/dist/testnet/models/confirmed_transaction.d.ts +2 -2
  51. package/dist/testnet/models/deployment/deploymentObject.d.ts +1 -1
  52. package/dist/testnet/models/execution/executionJSON.d.ts +1 -1
  53. package/dist/testnet/models/execution/executionObject.d.ts +1 -1
  54. package/dist/testnet/models/functionObject.d.ts +1 -1
  55. package/dist/testnet/models/input/inputObject.d.ts +2 -2
  56. package/dist/testnet/models/inputID.d.ts +4 -0
  57. package/dist/testnet/models/output/outputObject.d.ts +2 -2
  58. package/dist/testnet/models/owner/ownerObject.d.ts +1 -1
  59. package/dist/testnet/models/plaintext/array.d.ts +2 -2
  60. package/dist/testnet/models/plaintext/plaintext.d.ts +4 -4
  61. package/dist/testnet/models/plaintext/struct.d.ts +2 -2
  62. package/dist/testnet/models/request.d.ts +14 -0
  63. package/dist/testnet/models/transaction/transactionJSON.d.ts +3 -3
  64. package/dist/testnet/models/transaction/transactionObject.d.ts +3 -3
  65. package/dist/testnet/models/transition/transitionJSON.d.ts +2 -2
  66. package/dist/testnet/models/transition/transitionObject.d.ts +3 -3
  67. package/dist/testnet/network-client.d.ts +5 -19
  68. package/dist/testnet/node-polyfill.d.ts +5 -5
  69. package/dist/testnet/node-polyfill.js.map +1 -1
  70. package/dist/testnet/node.d.ts +2 -2
  71. package/dist/testnet/node.js +2 -2
  72. package/dist/testnet/offline-key-provider.d.ts +2 -2
  73. package/dist/testnet/{program-manager-BTHjM8b7.js → program-manager-kuhVcNPN.js} +119 -18
  74. package/dist/testnet/program-manager-kuhVcNPN.js.map +1 -0
  75. package/dist/testnet/program-manager.d.ts +105 -9
  76. package/dist/testnet/record-provider.d.ts +3 -3
  77. package/dist/testnet/wasm.d.ts +1 -1
  78. package/dist/testnet/worker.d.ts +2 -2
  79. package/dist/testnet/worker.js +1 -1
  80. package/dist/testnet/worker.js.map +1 -1
  81. package/package.json +2 -2
  82. package/dist/mainnet/program-manager-DMDKstZ8.js.map +0 -1
  83. package/dist/testnet/program-manager-BTHjM8b7.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program-manager-BfZnPCKl.js","sources":["../../src/utils.ts","../../src/network-client.ts","../../src/constants.ts","../../src/function-key-provider.ts","../../src/program-manager.ts"],"sourcesContent":["function detectBrowser() {\n const userAgent = navigator.userAgent;\n\n if (/chrome|crios|crmo/i.test(userAgent) && !/edge|edg|opr/i.test(userAgent)) {\n return \"chrome\";\n } else if (/firefox|fxios/i.test(userAgent)) {\n return \"firefox\";\n } else if (/safari/i.test(userAgent) && !/chrome|crios|crmo|android/i.test(userAgent)) {\n return \"safari\";\n } else if (/edg/i.test(userAgent)) {\n return \"edge\";\n } else if (/opr\\//i.test(userAgent)) {\n return \"opera\";\n } else {\n return \"browser\";\n }\n}\n\nexport function environment() {\n if ((typeof process !== 'undefined') &&\n (process.release?.name === 'node')) {\n return 'node';\n } else if (typeof window !== 'undefined') {\n return detectBrowser();\n } else {\n return 'unknown';\n }\n}\n\nexport function logAndThrow(message: string): never {\n console.error(message);\n throw new Error(message);\n}\n\nexport function parseJSON(json: string): any {\n function revive(key: string, value: any, context: any) {\n if (Number.isInteger(value)) {\n return BigInt(context.source);\n } else {\n return value;\n }\n }\n\n return JSON.parse(json, revive as any);\n}\n\nexport async function get(url: URL | string, options?: RequestInit) {\n const response = await fetch(url, options);\n\n if (!response.ok) {\n throw new Error(response.status + \" could not get URL \" + url);\n }\n\n return response;\n}\n\nexport async function post(url: URL | string, options: RequestInit) {\n options.method = \"POST\";\n\n const response = await fetch(url, options);\n\n if (!response.ok) {\n throw new Error(response.status + \" could not post URL \" + url);\n }\n\n return response;\n}\n\ntype RetryOptions = {\n maxAttempts?: number;\n baseDelay?: number;\n jitter?: number;\n retryOnStatus?: number[]; // e.g. [500, 502, 503]\n shouldRetry?: (err: any) => boolean;\n};\n\nexport async function retryWithBackoff<T>(\n fn: () => Promise<T>,\n {\n maxAttempts = 5,\n baseDelay = 100,\n jitter,\n retryOnStatus = [],\n shouldRetry,\n }: RetryOptions = {},\n): Promise<T> {\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n return await fn();\n } catch (err: any) {\n const isLast = attempt === maxAttempts;\n const error = err as Error & { code?: string; status?: number };\n\n let retryable = false;\n\n if (typeof error.status === \"number\") {\n if (error.status >= 500) {\n retryable = true;\n } else if (error.status >= 400 && shouldRetry) {\n retryable = shouldRetry(error);\n }\n } else if (shouldRetry) {\n retryable = shouldRetry(error);\n }\n\n if (!retryable || isLast) throw error;\n\n const jitterAmount = jitter ?? baseDelay;\n const actualJitter = Math.floor(Math.random() * jitterAmount);\n const delay = baseDelay * 2 ** (attempt - 1) + actualJitter;\n console.warn(\n `Retry ${attempt}/${maxAttempts} failed. Retrying in ${delay}ms...`,\n );\n\n await new Promise((res) => setTimeout(res, delay));\n }\n }\n\n throw new Error(\"retryWithBackoff: unreachable\");\n}\n","import { get, post, parseJSON, logAndThrow, retryWithBackoff, environment } from \"./utils.js\";\nimport { Account } from \"./account.js\";\nimport { BlockJSON } from \"./models/blockJSON.js\";\nimport { TransactionJSON } from \"./models/transaction/transactionJSON.js\";\nimport {\n Address,\n Plaintext,\n RecordCiphertext,\n Program,\n RecordPlaintext,\n PrivateKey,\n Transaction,\n} from \"./wasm.js\";\nimport { ConfirmedTransactionJSON } from \"./models/confirmed_transaction.js\";\n\ntype ProgramImports = { [key: string]: string | Program };\n\ninterface AleoNetworkClientOptions {\n headers?: { [key: string]: string };\n}\n\n/**\n * Client library that encapsulates REST calls to publicly exposed endpoints of Aleo nodes. The methods provided in this\n * allow users to query public information from the Aleo blockchain and submit transactions to the network.\n *\n * @param {string} host\n * @example\n * // Connection to a local node.\n * const localNetworkClient = new AleoNetworkClient(\"http://0.0.0.0:3030\", undefined, account);\n *\n * // Connection to a public beacon node\n * const account = Account.fromCiphertext(process.env.ciphertext, process.env.password);\n * const publicNetworkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined, account);\n */\nclass AleoNetworkClient {\n host: string;\n headers: { [key: string]: string };\n account: Account | undefined;\n ctx: { [key: string]: string };\n readonly network: string;\n\n constructor(host: string, options?: AleoNetworkClientOptions) {\n this.host = host + \"/%%NETWORK%%\";\n this.network = \"%%NETWORK%%\";\n this.ctx = {};\n\n if (options && options.headers) {\n this.headers = options.headers;\n } else {\n this.headers = {\n // This is replaced by the actual version by a Rollup plugin\n \"X-Aleo-SDK-Version\": \"%%VERSION%%\",\n \"X-Aleo-environment\" : environment(),\n };\n }\n }\n\n /**\n * Set an account to use in networkClient calls\n *\n * @param {Account} account Set an account to use for record scanning functions.\n * @example\n * import { Account, AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\");\n * const account = new Account();\n * networkClient.setAccount(account);\n */\n setAccount(account: Account) {\n this.account = account;\n }\n\n /**\n * Return the Aleo account used in the networkClient\n *\n * @example\n * const account = networkClient.getAccount();\n */\n getAccount(): Account | undefined {\n return this.account;\n }\n\n /**\n * Set a new host for the networkClient\n *\n * @param {string} host The address of a node hosting the Aleo API\n * @param host\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a networkClient that connects to a local node.\n * const networkClient = new AleoNetworkClient(\"http://0.0.0.0:3030\", undefined);\n *\n * // Set the host to a public node.\n * networkClient.setHost(\"http://api.explorer.provable.com/v1\");\n */\n setHost(host: string) {\n this.host = host + \"/%%NETWORK%%\";\n }\n\n /**\n * Set a header in the `AleoNetworkClient`s header map\n *\n * @param {string} headerName The name of the header to set\n * @param {string} value The header value\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a networkClient\n * const networkClient = new AleoNetworkClient();\n *\n * // Set the value of the `Accept-Language` header to `en-US`\n * networkClient.setHeader('Accept-Language', 'en-US');\n */\n setHeader(headerName: string, value: string) {\n this.headers[headerName] = value;\n }\n\n removeHeader(headerName: string) {\n delete this.headers[headerName];\n }\n\n /**\n * Fetches data from the Aleo network and returns it as a JSON object.\n *\n * @param url The URL to fetch data from.\n */\n async fetchData<Type>(url = \"/\"): Promise<Type> {\n try {\n const raw = await this.fetchRaw(url);\n return parseJSON(raw);\n } catch (error) {\n throw new Error(`Error fetching data: ${error}`);\n }\n }\n\n /**\n * Fetches data from the Aleo network and returns it as an unparsed string.\n *\n * This method should be used when it is desired to reconstitute data returned\n * from the network into a WASM object.\n *\n * @param url\n */\n async fetchRaw(url = \"/\"): Promise<string> {\n try {\n const ctx = {...this.ctx};\n return await retryWithBackoff(async () => {\n const response = await get(this.host + url, {\n headers: {\n ...this.headers,\n ...ctx,\n },\n });\n return await response.text();\n });\n } catch (error) {\n throw new Error(`Error fetching data: ${error}`);\n }\n }\n\n /**\n * Wrapper around the POST helper to allow mocking in tests. Not meant for use in production.\n *\n * @param url The URL to POST to.\n * @param options The RequestInit options for the POST request.\n * @returns The Response object from the POST request.\n */\n private async _sendPost(url: string, options: RequestInit) {\n return post(url, options);\n }\n\n /**\n * Attempt to find records in the Aleo blockchain.\n *\n * @param {number} startHeight - The height at which to start searching for unspent records\n * @param {number} endHeight - The height at which to stop searching for unspent records\n * @param {boolean} unspent - Whether to search for unspent records only\n * @param {string[]} programs - The program(s) to search for unspent records in\n * @param {number[]} amounts - The amounts (in microcredits) to search for (eg. [100, 200, 3000])\n * @param {number} maxMicrocredits - The maximum number of microcredits to search for\n * @param {string[]} nonces - The nonces of already found records to exclude from the search\n * @param {string | PrivateKey} privateKey - An optional private key to use to find unspent records.\n * @returns {Promise<Array<RecordPlaintext>>} An array of records belonging to the account configured in the network client.\n *\n * @example\n * import { Account, AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Import an account from a ciphertext and password.\n * const account = Account.fromCiphertext(process.env.ciphertext, process.env.password);\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * networkClient.setAccount(account);\n *\n * // Find specific amounts\n * const startHeight = 500000;\n * const amounts = [600000, 1000000];\n * const records = networkClient.findRecords(startHeight, undefined, true, [\"credits.aleo\"] amounts);\n *\n * // Find specific amounts with a maximum number of cumulative microcredits\n * const maxMicrocredits = 100000;\n * const records = networkClient.findRecords(startHeight, undefined, true, [\"credits.aleo\"] undefined, maxMicrocredits);\n */\n async findRecords(\n startHeight: number,\n endHeight: number | undefined,\n unspent: boolean = false,\n programs?: string[],\n amounts?: number[] | undefined,\n maxMicrocredits?: number | undefined,\n nonces?: string[] | undefined,\n privateKey?: string | PrivateKey | undefined,\n ): Promise<Array<RecordPlaintext>> {\n nonces = nonces || [];\n // Ensure start height is not negative\n if (startHeight < 0) {\n throw new Error(\"Start height must be greater than or equal to 0\");\n }\n\n // Initialize search parameters\n const records = new Array<RecordPlaintext>();\n let start;\n let end;\n let resolvedPrivateKey: PrivateKey;\n let failures = 0;\n let totalRecordValue = BigInt(0);\n let latestHeight: number;\n\n // Ensure a private key is present to find owned records\n if (typeof privateKey === \"undefined\") {\n if (typeof this.account === \"undefined\") {\n throw new Error(\n \"Private key must be specified in an argument to findOwnedRecords or set in the AleoNetworkClient\",\n );\n } else {\n resolvedPrivateKey = this.account._privateKey;\n }\n } else {\n try {\n resolvedPrivateKey =\n privateKey instanceof PrivateKey\n ? privateKey\n : PrivateKey.from_string(privateKey);\n } catch (error) {\n throw new Error(\"Error parsing private key provided.\");\n }\n }\n const viewKey = resolvedPrivateKey.to_view_key();\n\n // Get the latest height to ensure the range being searched is valid\n try {\n const blockHeight = await this.getLatestHeight();\n if (typeof blockHeight === \"number\") {\n latestHeight = blockHeight;\n } else {\n throw new Error(\n `Error fetching latest block height: Expected type 'number' got '${typeof blockHeight}'`,\n );\n }\n } catch (error) {\n throw new Error(`Error fetching latest block height: ${error}`);\n }\n\n // If no end height is specified or is greater than the latest height, set the end height to the latest height\n if (typeof endHeight === \"number\" && endHeight <= latestHeight) {\n end = endHeight;\n } else {\n end = latestHeight;\n }\n\n // If the starting is greater than the ending height, return an error\n if (startHeight > end) {\n throw new Error(\n \"Start height must be less than or equal to end height.\",\n );\n }\n\n // Iterate through blocks in reverse order in chunks of 50\n while (end > startHeight) {\n start = end - 50;\n if (start < startHeight) {\n start = startHeight;\n }\n try {\n // Get 50 blocks (or the difference between the start and end if less than 50)\n const blocks = await this.getBlockRange(start, end);\n end = start;\n // Iterate through blocks to find unspent records\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const transactions = block.transactions;\n if (!(typeof transactions === \"undefined\")) {\n for (let j = 0; j < transactions.length; j++) {\n const confirmedTransaction = transactions[j];\n // Search for unspent records in execute transactions of credits.aleo\n if (confirmedTransaction.type == \"execute\") {\n const transaction =\n confirmedTransaction.transaction;\n if (\n transaction.execution &&\n !(\n typeof transaction.execution\n .transitions == \"undefined\"\n )\n ) {\n for (\n let k = 0;\n k <\n transaction.execution.transitions\n .length;\n k++\n ) {\n const transition =\n transaction.execution.transitions[\n k\n ];\n // Only search for unspent records in the specified programs.\n if (\n !(typeof programs === \"undefined\")\n ) {\n if (\n !programs.includes(\n transition.program,\n )\n ) {\n continue;\n }\n }\n if (\n !(\n typeof transition.outputs ==\n \"undefined\"\n )\n ) {\n for (\n let l = 0;\n l < transition.outputs.length;\n l++\n ) {\n const output =\n transition.outputs[l];\n if (output.type === \"record\") {\n try {\n // Create a wasm record ciphertext object from the found output\n const record =\n RecordCiphertext.fromString(\n output.value,\n );\n // Determine if the record is owned by the specified view key\n if (\n record.isOwner(\n viewKey,\n )\n ) {\n // Decrypt the record and get the serial number\n const recordPlaintext =\n record.decrypt(\n viewKey,\n );\n\n // If the record has already been found, skip it\n const nonce =\n recordPlaintext.nonce();\n if (\n nonces.includes(\n nonce,\n )\n ) {\n continue;\n }\n\n if (unspent) {\n // Otherwise record the nonce that has been found\n const serialNumber =\n recordPlaintext.serialNumberString(\n resolvedPrivateKey,\n \"credits.aleo\",\n \"credits\",\n );\n // Attempt to see if the serial number is spent\n try {\n await retryWithBackoff(\n () =>\n this.getTransitionId(\n serialNumber,\n ),\n );\n continue;\n } catch (error) {\n console.log(\n \"Found unspent record!\",\n );\n }\n }\n\n // Add the record to the list of records if the user did not specify amounts.\n if (!amounts) {\n records.push(\n recordPlaintext,\n );\n // If the user specified a maximum number of microcredits, check if the search has found enough\n if (\n typeof maxMicrocredits ===\n \"number\"\n ) {\n totalRecordValue +=\n recordPlaintext.microcredits();\n // Exit if the search has found the amount specified\n if (\n totalRecordValue >=\n BigInt(\n maxMicrocredits,\n )\n ) {\n return records;\n }\n }\n }\n\n // If the user specified a list of amounts, check if the search has found them\n if (\n !(\n typeof amounts ===\n \"undefined\"\n ) &&\n amounts.length >\n 0\n ) {\n let amounts_found = 0;\n if (\n recordPlaintext.microcredits() >\n amounts[\n amounts_found\n ]\n ) {\n amounts_found += 1;\n records.push(\n recordPlaintext,\n );\n // If the user specified a maximum number of microcredits, check if the search has found enough\n if (\n typeof maxMicrocredits ===\n \"number\"\n ) {\n totalRecordValue +=\n recordPlaintext.microcredits();\n // Exit if the search has found the amount specified\n if (\n totalRecordValue >=\n BigInt(\n maxMicrocredits,\n )\n ) {\n return records;\n }\n }\n if (\n records.length >=\n amounts.length\n ) {\n return records;\n }\n }\n }\n }\n } catch (error) {}\n }\n }\n }\n }\n }\n }\n }\n }\n }\n } catch (error) {\n // If there is an error fetching blocks, log it and keep searching\n console.warn(\n \"Error fetching blocks in range: \" +\n start.toString() +\n \"-\" +\n end.toString(),\n );\n console.warn(\"Error: \", error);\n failures += 1;\n if (failures > 10) {\n console.warn(\n \"10 failures fetching records reached. Returning records fetched so far\",\n );\n return records;\n }\n }\n }\n return records;\n }\n\n /**\n * Attempts to find unspent records in the Aleo blockchain.\n *\n * @param {number} startHeight - The height at which to start searching for unspent records\n * @param {number} endHeight - The height at which to stop searching for unspent records\n * @param {string[]} programs - The program(s) to search for unspent records in\n * @param {number[]} amounts - The amounts (in microcredits) to search for (eg. [100, 200, 3000])\n * @param {number} maxMicrocredits - The maximum number of microcredits to search for\n * @param {string[]} nonces - The nonces of already found records to exclude from the search\n * @param {string | PrivateKey} privateKey - An optional private key to use to find unspent records.\n * @returns {Promise<Array<RecordPlaintext>>} An array of unspent records belonging to the account configured in the network client.\n *\n * @example\n * import { Account, AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * const account = Account.fromCiphertext(process.env.ciphertext, process.env.password);\n *\n * // Create a network client and set an account to search for records with.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * networkClient.setAccount(account);\n *\n * // Find specific amounts\n * const startHeight = 500000;\n * const endHeight = 550000;\n * const amounts = [600000, 1000000];\n * const records = networkClient.findUnspentRecords(startHeight, endHeight, [\"credits.aleo\"], amounts);\n *\n * // Find specific amounts with a maximum number of cumulative microcredits\n * const maxMicrocredits = 100000;\n * const records = networkClient.findUnspentRecords(startHeight, undefined, [\"credits.aleo\"], undefined, maxMicrocredits);\n */\n async findUnspentRecords(\n startHeight: number,\n endHeight: number | undefined,\n programs?: string[],\n amounts?: number[] | undefined,\n maxMicrocredits?: number | undefined,\n nonces?: string[] | undefined,\n privateKey?: string | PrivateKey | undefined,\n ): Promise<Array<RecordPlaintext>> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"findUnspentRecords\" };\n return await this.findRecords(\n startHeight,\n endHeight,\n true,\n programs,\n amounts,\n maxMicrocredits,\n nonces,\n privateKey,\n );\n } catch (error) {\n throw new Error(\"Error finding unspent records: \" + error);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the contents of the block at the specified block height.\n *\n * @param {number} blockHeight - The height of the block to fetch\n * @returns {Promise<BlockJSON>} A javascript object containing the block at the specified height\n *\n * @example\n * const block = networkClient.getBlock(1234);\n */\n async getBlock(blockHeight: number): Promise<BlockJSON> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getBlock\" };\n const block = await this.fetchData<BlockJSON>(\n \"/block/\" + blockHeight,\n );\n return block;\n } catch (error) {\n throw new Error(`Error fetching block ${blockHeight}: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the contents of the block with the specified hash.\n *\n * @param {string} blockHash The hash of the block to fetch.\n * @returns {Promise<BlockJSON>} A javascript object representation of the block matching the hash.\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * const block = networkClient.getBlockByHash(\"ab19dklwl9vp63zu3hwg57wyhvmqf92fx5g8x0t6dr72py8r87pxupqfne5t9\");\n */\n async getBlockByHash(blockHash: string): Promise<BlockJSON> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getBlockByHash\" };\n const block = await this.fetchData<BlockJSON>(\n `/block/${blockHash}`,\n );\n return block;\n } catch (error) {\n throw new Error(`Error fetching block ${blockHash}: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns a range of blocks between the specified block heights. A maximum of 50 blocks can be fetched at a time.\n *\n * @param {number} start Starting block to fetch.\n * @param {number} end Ending block to fetch. This cannot be more than 50 blocks ahead of the start block.\n * @returns {Promise<Array<BlockJSON>>} An array of block objects\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Fetch 50 blocks.\n * const (start, end) = (2050, 2100);\n * const blockRange = networkClient.getBlockRange(start, end);\n *\n * let cursor = start;\n * blockRange.forEach((block) => {\n * assert(block.height == cursor);\n * cursor += 1;\n * }\n */\n async getBlockRange(start: number, end: number): Promise<Array<BlockJSON>> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getBlockRange\" };\n return await this.fetchData<Array<BlockJSON>>(\n \"/blocks?start=\" + start + \"&end=\" + end,\n );\n } catch (error) {\n throw new Error(\n `Error fetching blocks between ${start} and ${end}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the deployment transaction id associated with the specified program.\n *\n * @param {Program | string} program The name of the deployed program OR a wasm Program object.\n * @returns {Promise<string>} The transaction ID of the deployment transaction.\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/testnet.js\";\n *\n * // Get the transaction ID of the deployment transaction for a program.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * const transactionId = networkClient.getDeploymentTransactionIDForProgram(\"hello_hello.aleo\");\n *\n * // Get the transaction data for the deployment transaction.\n * const transaction = networkClient.getTransactionObject(transactionId);\n *\n * // Get the verifying keys for the functions in the deployed program.\n * const verifyingKeys = transaction.verifyingKeys();\n */\n async getDeploymentTransactionIDForProgram(\n program: Program | string,\n ): Promise<string> {\n this.ctx = { \"X-ALEO-METHOD\": \"getDeploymentTransactionIDForProgram\" };\n if (program instanceof Program) {\n program = program.id();\n }\n try {\n const id = await this.fetchData<string>(\n \"/find/transactionID/deployment/\" + program,\n );\n return id.replace('\"', \"\");\n } catch (error) {\n throw new Error(\n `Error fetching deployment transaction for program ${program}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the deployment transaction associated with a specified program as a JSON object.\n *\n * @param {Program | string} program The name of the deployed program OR a wasm Program object.\n * @returns {Promise<Transaction>} JSON representation of the deployment transaction.\n *\n * @example\n * import { AleoNetworkClient, DeploymentJSON } from \"@provablehq/sdk/testnet.js\";\n *\n * // Get the transaction ID of the deployment transaction for a program.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * const transaction = networkClient.getDeploymentTransactionForProgram(\"hello_hello.aleo\");\n *\n * // Get the verifying keys for each function in the deployment.\n * const deployment = <DeploymentJSON>transaction.deployment;\n * const verifyingKeys = deployment.verifying_keys;\n */\n async getDeploymentTransactionForProgram(\n program: Program | string,\n ): Promise<TransactionJSON> {\n if (program instanceof Program) {\n program = program.id();\n }\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getDeploymentTransactionForProgram\" };\n const transaction_id = <string>(\n await this.getDeploymentTransactionIDForProgram(program)\n );\n return <TransactionJSON>await this.getTransaction(transaction_id);\n } catch (error) {\n throw new Error(\n `Error fetching deployment transaction for program ${program}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the deployment transaction associated with a specified program as a wasm object.\n *\n * @param {Program | string} program The name of the deployed program OR a wasm Program object.\n * @returns {Promise<Transaction>} Wasm object representation of the deployment transaction.\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/testnet.js\";\n *\n * // Get the transaction ID of the deployment transaction for a program.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * const transactionId = networkClient.getDeploymentTransactionIDForProgram(\"hello_hello.aleo\");\n *\n * // Get the transaction data for the deployment transaction.\n * const transaction = networkClient.getDeploymentTransactionObjectForProgram(transactionId);\n *\n * // Get the verifying keys for the functions in the deployed program.\n * const verifyingKeys = transaction.verifyingKeys();\n */\n async getDeploymentTransactionObjectForProgram(\n program: Program | string,\n ): Promise<Transaction> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getDeploymentTransactionObjectForProgram\" };\n const transaction_id = <string>(\n await this.getDeploymentTransactionIDForProgram(program)\n );\n return await this.getTransactionObject(transaction_id);\n } catch (error) {\n throw new Error(\n `Error fetching deployment transaction for program ${program}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the contents of the latest block as JSON.\n *\n * @returns {Promise<BlockJSON>} A javascript object containing the latest block\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/testnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const latestHeight = networkClient.getLatestBlock();\n */\n async getLatestBlock(): Promise<BlockJSON> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getLatestBlock\" };\n return (await this.fetchData<BlockJSON>(\n \"/block/latest\",\n )) as BlockJSON;\n } catch (error) {\n throw new Error(`Error fetching latest block: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the latest committee.\n *\n * @returns {Promise<object>} A javascript object containing the latest committee\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Create a network client and get the latest committee.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * const latestCommittee = await networkClient.getLatestCommittee();\n */\n async getLatestCommittee(): Promise<object> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getLatestCommittee\" };\n return await this.fetchData<object>(\"/committee/latest\");\n } catch (error) {\n throw new Error(`Error fetching latest committee: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the committee at the specified block height.\n *\n * @param {number} blockHeight - The height of the block to fetch the committee for\n * @returns {Promise<object>} A javascript object containing the committee\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Create a network client and get the committee for a specific block.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * const committee = await networkClient.getCommitteeByBlockHeight(1234);\n */\n async getCommitteeByBlockHeight(blockHeight: number): Promise<object> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getCommitteeByBlockHeight\" };\n return await this.fetchData<object>(`/committee/${blockHeight}`);\n } catch (error) {\n throw new Error(\n `Error fetching committee at height ${blockHeight}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the latest block height.\n *\n * @returns {Promise<number>} The latest block height.\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const latestHeight = networkClient.getLatestHeight();\n */\n async getLatestHeight(): Promise<number> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getLatestHeight\" };\n return Number(await this.fetchData<bigint>(\"/block/height/latest\"));\n } catch (error) {\n throw new Error(`Error fetching latest height: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the latest block hash.\n *\n * @returns {Promise<string>} The latest block hash.\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Get the latest block hash.\n * const latestHash = networkClient.getLatestBlockHash();\n */\n async getLatestBlockHash(): Promise<string> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getLatestBlockHash\" };\n return String(await this.fetchData<string>(\"/block/hash/latest\"));\n } catch (error) {\n throw new Error(`Error fetching latest hash: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the source code of a program given a program ID.\n *\n * @param {string} programId The program ID of a program deployed to the Aleo Network\n * @returns {Promise<string>} Source code of the program\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const program = networkClient.getProgram(\"hello_hello.aleo\");\n * const expectedSource = \"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\"\n * assert.equal(program, expectedSource);\n */\n async getProgram(programId: string): Promise<string> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getProgram\" };\n return await this.fetchData<string>(\"/program/\" + programId);\n } catch (error) {\n throw new Error(`Error fetching program ${programId}: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns a program object from a program ID or program source code.\n *\n * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network\n * @returns {Promise<Program>} Source code of the program\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const programID = \"hello_hello.aleo\";\n * const programSource = \"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\"\n *\n * // Get program object from program ID or program source code\n * const programObjectFromID = await networkClient.getProgramObject(programID);\n * const programObjectFromSource = await networkClient.getProgramObject(programSource);\n *\n * // Both program objects should be equal\n * assert(programObjectFromID.to_string() === programObjectFromSource.to_string());\n */\n async getProgramObject(inputProgram: string): Promise<Program> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getProgramObject\" };\n return Program.fromString(inputProgram);\n } catch (error) {\n try {\n return Program.fromString(\n <string>await this.getProgram(inputProgram),\n );\n } catch (error) {\n throw new Error(\n `${inputProgram} is neither a program name or a valid program: ${error}`,\n );\n }\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns an object containing the source code of a program and the source code of all programs it imports\n *\n * @param {Program | string} inputProgram The program ID or program source code of a program deployed to the Aleo Network\n * @returns {Promise<ProgramImports>} Object of the form { \"program_id\": \"program_source\", .. } containing program id & source code for all program imports\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * const double_test_source = \"import multiply_test.aleo;\\n\\nprogram double_test.aleo;\\n\\nfunction double_it:\\n input r0 as u32.private;\\n call multiply_test.aleo/multiply 2u32 r0 into r1;\\n output r1 as u32.private;\\n\"\n * const double_test = Program.fromString(double_test_source);\n * const expectedImports = {\n * \"multiply_test.aleo\": \"program multiply_test.aleo;\\n\\nfunction multiply:\\n input r0 as u32.public;\\n input r1 as u32.private;\\n mul r0 r1 into r2;\\n output r2 as u32.private;\\n\"\n * }\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Imports can be fetched using the program ID, source code, or program object\n * let programImports = await networkClient.getProgramImports(\"double_test.aleo\");\n * assert.deepStrictEqual(programImports, expectedImports);\n *\n * // Using the program source code\n * programImports = await networkClient.getProgramImports(double_test_source);\n * assert.deepStrictEqual(programImports, expectedImports);\n *\n * // Using the program object\n * programImports = await networkClient.getProgramImports(double_test);\n * assert.deepStrictEqual(programImports, expectedImports);\n */\n async getProgramImports(\n inputProgram: Program | string,\n ): Promise<ProgramImports> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getProgramImports\" };\n const imports: ProgramImports = {};\n\n // Get the program object or fail if the program is not valid or does not exist\n const program =\n inputProgram instanceof Program\n ? inputProgram\n : <Program>await this.getProgramObject(inputProgram);\n\n // Get the list of programs that the program imports\n const importList = program.getImports();\n\n // Recursively get any imports that the imported programs have in a depth first search order\n for (let i = 0; i < importList.length; i++) {\n const import_id = importList[i];\n if (!imports.hasOwnProperty(import_id)) {\n const programSource = <string>(\n await this.getProgram(import_id)\n );\n const nestedImports = <ProgramImports>(\n await this.getProgramImports(import_id)\n );\n for (const key in nestedImports) {\n if (!imports.hasOwnProperty(key)) {\n imports[key] = nestedImports[key];\n }\n }\n imports[import_id] = programSource;\n }\n }\n return imports;\n } catch (error: any) {\n logAndThrow(\"Error fetching program imports: \" + error.message);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Get a list of the program names that a program imports.\n *\n * @param {Program | string} inputProgram - The program id or program source code to get the imports of\n * @returns {string[]} - The list of program names that the program imports\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const programImportsNames = networkClient.getProgramImports(\"wrapped_credits.aleo\");\n * const expectedImportsNames = [\"credits.aleo\"];\n * assert.deepStrictEqual(programImportsNames, expectedImportsNames);\n */\n async getProgramImportNames(\n inputProgram: Program | string,\n ): Promise<string[]> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getProgramImportNames\" };\n const program =\n inputProgram instanceof Program\n ? inputProgram\n : <Program>await this.getProgramObject(inputProgram);\n return program.getImports();\n } catch (error: any) {\n throw new Error(\n `Error fetching imports for program ${inputProgram instanceof Program ? inputProgram.id() : inputProgram}: ${error.message}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the names of the mappings of a program.\n *\n * @param {string} programId - The program ID to get the mappings of (e.g. \"credits.aleo\")\n * @returns {Promise<Array<string>>} - The names of the mappings of the program.\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const mappings = networkClient.getProgramMappingNames(\"credits.aleo\");\n * const expectedMappings = [\n * \"committee\",\n * \"delegated\",\n * \"metadata\",\n * \"bonded\",\n * \"unbonding\",\n * \"account\",\n * \"withdraw\"\n * ];\n * assert.deepStrictEqual(mappings, expectedMappings);\n */\n async getProgramMappingNames(programId: string): Promise<Array<string>> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getProgramMappingNames\" };\n return await this.fetchData<Array<string>>(\n `/program/${programId}/mappings`,\n );\n } catch (error) {\n throw new Error(\n `Error fetching mappings for program ${programId} - ensure the program exists on chain before trying again`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the value of a program's mapping for a specific key.\n *\n * @param {string} programId - The program ID to get the mapping value of (e.g. \"credits.aleo\")\n * @param {string} mappingName - The name of the mapping to get the value of (e.g. \"account\")\n * @param {string | Plaintext} key - The key to look up in the mapping (e.g. an address for the \"account\" mapping)\n * @returns {Promise<string>} String representation of the value of the mapping\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Get public balance of an account\n * const mappingValue = networkClient.getMappingValue(\"credits.aleo\", \"account\", \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\");\n * const expectedValue = \"0u64\";\n * assert(mappingValue === expectedValue);\n */\n async getProgramMappingValue(\n programId: string,\n mappingName: string,\n key: string | Plaintext,\n ): Promise<string> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getProgramMappingValue\" };\n const keyString = key instanceof Plaintext ? key.toString() : key;\n return await this.fetchData<string>(\n `/program/${programId}/mapping/${mappingName}/${keyString}`,\n );\n } catch (error) {\n throw new Error(\n `Error fetching value for key '${key}' in mapping '${mappingName}' in program '${programId}' - ensure the mapping exists and the key is correct`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the value of a mapping as a wasm Plaintext object. Returning an object in this format allows it to be converted to a Js type and for its internal members to be inspected if it's a struct or array.\n *\n * @param {string} programId - The program ID to get the mapping value of (e.g. \"credits.aleo\")\n * @param {string} mappingName - The name of the mapping to get the value of (e.g. \"bonded\")\n * @param {string | Plaintext} key - The key to look up in the mapping (e.g. an address for the \"bonded\" mapping)\n * @returns {Promise<Plaintext>} String representation of the value of the mapping\n *\n * @example\n * import { AleoNetworkClient } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Get the bond state as an account.\n * const unbondedState = networkClient.getMappingPlaintext(\"credits.aleo\", \"bonded\", \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\");\n *\n * // Get the two members of the object individually.\n * const validator = unbondedState.getMember(\"validator\");\n * const microcredits = unbondedState.getMember(\"microcredits\");\n *\n * // Ensure the expected values are correct.\n * assert.equal(validator, \"aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd\");\n * assert.equal(microcredits, BigInt(\"9007199254740991\"));\n *\n * // Get a JS object representation of the unbonded state.\n * const unbondedStateObject = unbondedState.toObject();\n *\n * const expectedState = {\n * validator: \"aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd\",\n * microcredits: BigInt(9007199254740991)\n * };\n * assert.equal(unbondedState, expectedState);\n */\n async getProgramMappingPlaintext(\n programId: string,\n mappingName: string,\n key: string | Plaintext,\n ): Promise<Plaintext> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getProgramMappingPlaintext\" };\n const keyString = key instanceof Plaintext ? key.toString() : key;\n const value = await this.fetchRaw(\n `/program/${programId}/mapping/${mappingName}/${keyString}`,\n );\n return Plaintext.fromString(JSON.parse(value));\n } catch (error) {\n throw new Error(\"Failed to fetch mapping value.\" + error);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the public balance of an address from the account mapping in credits.aleo\n *\n * @param {Address | string} address A string or wasm object representing an address.\n * @returns {Promise<number>} The public balance of the address in microcredits.\n *\n * @example\n * import { AleoNetworkClient, Account } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Get the balance of an account from either an address object or address string.\n * const account = Account.fromCiphertext(process.env.ciphertext, process.env.password);\n * const publicBalance = await networkClient.getPublicBalance(account.address());\n * const publicBalanceFromString = await networkClient.getPublicBalance(account.address().to_string());\n * assert(publicBalance === publicBalanceFromString);\n */\n async getPublicBalance(address: Address | string): Promise<number> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getPublicBalance\" };\n const addressString =\n address instanceof Address ? address.to_string() : address;\n const balanceStr = await this.getProgramMappingValue(\n \"credits.aleo\",\n \"account\",\n addressString,\n );\n return balanceStr ? parseInt(balanceStr) : 0;\n } catch (error) {\n throw new Error(\n `Error fetching public balance for ${address}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the latest state/merkle root of the Aleo blockchain.\n *\n * @returns {Promise<string>} A string representing the latest state root of the Aleo blockchain.\n *\n * @example\n * import { AleoNetworkClient, Account } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Get the latest state root.\n * const stateRoot = networkClient.getStateRoot();\n */\n async getStateRoot(): Promise<string> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getStateRoot\" };\n return await this.fetchData<string>(\"/stateRoot/latest\");\n } catch (error) {\n throw new Error(`Error fetching latest state root: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns a transaction by its unique identifier.\n *\n * @param {string} transactionId The transaction ID to fetch.\n * @returns {Promise<TransactionJSON>} A json representation of the transaction.\n *\n * @example\n * import { AleoNetworkClient, Account } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const transaction = networkClient.getTransaction(\"at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj\");\n */\n async getTransaction(transactionId: string): Promise<TransactionJSON> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getTransaction\" };\n return await this.fetchData<TransactionJSON>(\n \"/transaction/\" + transactionId,\n );\n } catch (error) {\n throw new Error(\n `Error fetching transaction ${transactionId}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns a confirmed transaction by its unique identifier.\n *\n * @param {string} transactionId The transaction ID to fetch.\n * @returns {Promise<ConfirmedTransactionJSON>} A json object containing the confirmed transaction.\n *\n * @example\n * import { AleoNetworkClient, Account } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const transaction = networkClient.getConfirmedTransaction(\"at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj\");\n * assert.equal(transaction.status, \"confirmed\");\n */\n async getConfirmedTransaction(\n transactionId: string,\n ): Promise<ConfirmedTransactionJSON> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getConfirmedTransaction\" };\n return await this.fetchData<ConfirmedTransactionJSON>(\n `/transaction/confirmed/${transactionId}`,\n );\n } catch (error) {\n throw new Error(\n `Error fetching confirmed transaction ${transactionId}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs,\n * outputs, and records to be searched for and displayed.\n *\n * @param {string} transactionId - The unique identifier of the transaction to fetch\n * @returns {Promise<Transaction>} A wasm object representation of the transaction.\n *\n * @example\n * const transactionObject = networkClient.getTransaction(\"at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj\");\n * // Get the transaction inputs as a JS array.\n * const transactionInputs = transactionObject.inputs(true);\n *\n * // Get the transaction outputs as a JS object.\n * const transactionOutputs = transactionObject.outputs(true);\n *\n * // Get any records generated in transitions in the transaction as a JS object.\n * const records = transactionObject.records();\n *\n * // Get the transaction type.\n * const transactionType = transactionObject.transactionType();\n * assert.equal(transactionType, \"Execute\");\n *\n * // Get a JS representation of all inputs, outputs, and transaction metadata.\n * const transactionSummary = transactionObject.summary();\n */\n async getTransactionObject(transactionId: string): Promise<Transaction> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getTransactionObject\" };\n const transaction = await this.fetchRaw(\n \"/transaction/\" + transactionId,\n );\n return Transaction.fromString(transaction);\n } catch (error) {\n throw new Error(\n `Error fetching transaction object ${transactionId}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the transactions present at the specified block height.\n *\n * @param {number} blockHeight The block height to fetch the confirmed transactions at.\n * @returns {Promise<Array<ConfirmedTransactionJSON>>} An array of confirmed transactions (in JSON format) for the block height.\n *\n * @example\n * import { AleoNetworkClient, Account } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const transactions = networkClient.getTransactions(654);\n */\n async getTransactions(\n blockHeight: number,\n ): Promise<Array<ConfirmedTransactionJSON>> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getTransactions\" };\n return await this.fetchData<Array<ConfirmedTransactionJSON>>(\n \"/block/\" + blockHeight.toString() + \"/transactions\",\n );\n } catch (error) {\n throw new Error(`Error fetching transactions: ${error}`);\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the confirmed transactions present in the block with the specified block hash.\n *\n * @param {string} blockHash The block hash to fetch the confirmed transactions at.\n * @returns {Promise<Array<ConfirmedTransactionJSON>>} An array of confirmed transactions (in JSON format) for the block hash.\n *\n * @example\n * import { AleoNetworkClient, Account } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * const transactions = networkClient.getTransactionsByBlockHash(\"ab19dklwl9vp63zu3hwg57wyhvmqf92fx5g8x0t6dr72py8r87pxupqfne5t9\");\n */\n async getTransactionsByBlockHash(\n blockHash: string,\n ): Promise<Array<ConfirmedTransactionJSON>> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getTransactionsByBlockHash\" };\n const block = await this.fetchData<BlockJSON>(\n `/block/${blockHash}`,\n );\n const height = block.header.metadata.height;\n return await this.getTransactions(Number(height));\n } catch (error) {\n throw new Error(\n `Error fetching transactions for block ${blockHash}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the transactions in the memory pool. This method requires access to a validator's REST API.\n *\n * @returns {Promise<Array<TransactionJSON>>} An array of transactions (in JSON format) currently in the mempool.\n *\n * @example\n * import { AleoNetworkClient, Account } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n *\n * // Get the current transactions in the mempool.\n * const transactions = networkClient.getTransactionsInMempool();\n */\n async getTransactionsInMempool(): Promise<Array<TransactionJSON>> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getTransactionsInMempool\" };\n return await this.fetchData<Array<TransactionJSON>>(\n \"/memoryPool/transactions\",\n );\n } catch (error) {\n throw new Error(\n `Error fetching transactions from mempool: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Returns the transition ID of the transition corresponding to the ID of the input or output.\n * @param {string} inputOrOutputID - The unique identifier of the input or output to find the transition ID for\n * @returns {Promise<string>} - The transition ID of the input or output ID.\n *\n * @example\n * const transitionId = networkClient.getTransitionId(\"2429232855236830926144356377868449890830704336664550203176918782554219952323field\");\n */\n async getTransitionId(inputOrOutputID: string): Promise<string> {\n try {\n this.ctx = { \"X-ALEO-METHOD\": \"getTransitionId\" };\n return await this.fetchData<string>(\n \"/find/transitionID/\" + inputOrOutputID,\n );\n } catch (error) {\n throw new Error(\n `Error fetching transition ID for input/output ${inputOrOutputID}: ${error}`,\n );\n } finally {\n this.ctx = {};\n }\n }\n\n /**\n * Submit an execute or deployment transaction to the Aleo network.\n *\n * @param {Transaction | string} transaction - The transaction to submit, either as a Transaction object or string representation\n * @returns {Promise<string>} - The transaction id of the submitted transaction or the resulting error\n */\n async submitTransaction(\n transaction: Transaction | string,\n ): Promise<string> {\n const transactionString =\n transaction instanceof Transaction\n ? transaction.toString()\n : transaction;\n try {\n const response = await retryWithBackoff(() =>\n this._sendPost(this.host + \"/transaction/broadcast\", {\n body: transactionString,\n headers: Object.assign({}, {...this.headers, \"X-ALEO-METHOD\" : \"submitTransaction\"}, {\n \"Content-Type\": \"application/json\",\n }),\n }),\n );\n\n try {\n const text = await response.text();\n return parseJSON(text);\n } catch (error: any) {\n throw new Error(\n `Error posting transaction. Aleo network response: ${error.message}`,\n );\n }\n } catch (error: any) {\n throw new Error(\n `Error posting transaction: No response received: ${error.message}`,\n );\n }\n }\n\n /**\n * Submit a solution to the Aleo network.\n *\n * @param {string} solution - The string representation of the solution to submit\n * @returns {Promise<string>} The solution id of the submitted solution or the resulting error.\n */\n async submitSolution(solution: string): Promise<string> {\n try {\n const response = await retryWithBackoff(() =>\n post(this.host + \"/solution/broadcast\", {\n body: solution,\n headers: Object.assign({}, {...this.headers, \"X-ALEO-METHOD\": \"submitSolution\"}, {\n \"Content-Type\": \"application/json\",\n }),\n }),\n );\n\n try {\n const text = await response.text();\n return parseJSON(text);\n } catch (error: any) {\n throw new Error(\n `Error posting solution. Aleo network response: ${error.message}`,\n );\n }\n } catch (error: any) {\n throw new Error(\n `Error posting solution: No response received: ${error.message}`,\n );\n }\n }\n\n /**\n * Await a submitted transaction to be confirmed or rejected on the Aleo network.\n *\n * @param {string} transactionId - The transaction ID to wait for confirmation\n * @param {number} checkInterval - The interval in milliseconds to check for confirmation (default: 2000)\n * @param {number} timeout - The maximum time in milliseconds to wait for confirmation (default: 45000)\n * @returns {Promise<Transaction>} The confirmed transaction object that returns if the transaction is confirmed.\n *\n * @example\n * import { AleoNetworkClient, Account, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a network client and program manager.\n * const networkClient = new AleoNetworkClient(\"http://api.explorer.provable.com/v1\", undefined);\n * const programManager = new ProgramManager(networkClient);\n *\n * // Set the account for the program manager.\n * programManager.setAccount(Account.fromCiphertext(process.env.ciphertext, process.env.password));\n *\n * // Build a transfer transaction.\n * const tx = await programManager.buildTransferPublicTransaction(100, \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", 0);\n *\n * // Submit the transaction to the network.\n * const transactionId = await networkClient.submitTransaction(tx);\n *\n * // Wait for the transaction to be confirmed.\n * const transaction = await networkClient.waitForTransactionConfirmation(transactionId);\n */\n async waitForTransactionConfirmation(\n transactionId: string,\n checkInterval: number = 2000,\n timeout: number = 45000,\n ): Promise<ConfirmedTransactionJSON> {\n const startTime = Date.now();\n\n return new Promise((resolve, reject) => {\n const interval = setInterval(async () => {\n const elapsed = Date.now() - startTime;\n\n if (elapsed > timeout) {\n clearInterval(interval);\n return reject(\n new Error(\n `Transaction ${transactionId} did not appear after the timeout period of ${interval}ms - consider resubmitting the transaction`,\n ),\n );\n }\n\n try {\n const res = await fetch(\n `${this.host}/transaction/confirmed/${transactionId}`,\n {\n headers: {\n ...this.headers,\n \"X-ALEO-METHOD\" : \"waitForTransactionConfirmation\",\n },\n },\n );\n if (!res.ok) {\n let text = \"\";\n try {\n text = await res.text();\n console.warn(\"Response text from server:\", text);\n } catch (err) {\n console.warn(\"Failed to read response text:\", err);\n }\n\n // If the transaction ID is malformed (e.g. invalid checksum, wrong length),\n // the API returns a 4XX with \"Invalid URL\" — we treat this as a fatal error and stop polling.\n if (\n res.status >= 400 &&\n res.status < 500 &&\n text.includes(\"Invalid URL\")\n ) {\n clearInterval(interval);\n return reject(\n new Error(`Malformed transaction ID: ${text}`),\n );\n }\n\n // Log and continue polling for 404s or 5XX errors in case a tx doesn't exist yet\n console.warn(\n \"Non-OK response (retrying):\",\n res.status,\n text,\n );\n return;\n }\n\n const data = parseJSON(await res.text());\n if (data?.status === \"accepted\") {\n clearInterval(interval);\n return resolve(data);\n }\n\n if (data?.status === \"rejected\") {\n clearInterval(interval);\n return reject(\n new Error(\n `Transaction ${transactionId} was rejected by the network. Ensure that the account paying the fee has enough credits and that the inputs to the on-chain function are valid.`,\n ),\n );\n }\n } catch (err) {\n console.error(\"Polling error:\", err);\n }\n }, checkInterval);\n });\n }\n}\n\nexport { AleoNetworkClient, AleoNetworkClientOptions, ProgramImports };\n","import {VerifyingKey, Metadata} from \"./wasm.js\";\n\nexport const KEY_STORE = Metadata.baseUrl();\n\nexport interface Key {\n name: string,\n locator: string,\n prover: string,\n verifier: string,\n verifyingKey: () => VerifyingKey,\n}\n\nfunction convert(metadata: Metadata): Key {\n // This looks up the method name in VerifyingKey\n const verifyingKey = (VerifyingKey as any)[metadata.verifyingKey];\n\n if (!verifyingKey) {\n throw new Error(\"Invalid method name: \" + metadata.verifyingKey);\n }\n\n return {\n name: metadata.name,\n locator: metadata.locator,\n prover: metadata.prover,\n verifier: metadata.verifier,\n verifyingKey,\n };\n}\n\nexport const CREDITS_PROGRAM_KEYS = {\n bond_public: convert(Metadata.bond_public()),\n bond_validator: convert(Metadata.bond_validator()),\n claim_unbond_public: convert(Metadata.claim_unbond_public()),\n fee_private: convert(Metadata.fee_private()),\n fee_public: convert(Metadata.fee_public()),\n inclusion: convert(Metadata.inclusion()),\n join: convert(Metadata.join()),\n set_validator_state: convert(Metadata.set_validator_state()),\n split: convert(Metadata.split()),\n transfer_private: convert(Metadata.transfer_private()),\n transfer_private_to_public: convert(Metadata.transfer_private_to_public()),\n transfer_public: convert(Metadata.transfer_public()),\n transfer_public_as_signer: convert(Metadata.transfer_public_as_signer()),\n transfer_public_to_private: convert(Metadata.transfer_public_to_private()),\n unbond_public: convert(Metadata.unbond_public()),\n getKey: function(key: string): Key {\n if (this.hasOwnProperty(key)) {\n return (this as any)[key] as Key;\n } else {\n throw new Error(`Key \"${key}\" not found.`);\n }\n }\n};\n\nexport const PRIVATE_TRANSFER_TYPES = new Set([\n \"transfer_private\",\n \"private\",\n \"transferPrivate\",\n \"transfer_private_to_public\",\n \"privateToPublic\",\n \"transferPrivateToPublic\",\n]);\n\nexport const VALID_TRANSFER_TYPES = new Set([\n \"transfer_private\",\n \"private\",\n \"transferPrivate\",\n \"transfer_private_to_public\",\n \"privateToPublic\",\n \"transferPrivateToPublic\",\n \"transfer_public\",\n \"transfer_public_as_signer\",\n \"public\",\n \"public_as_signer\",\n \"transferPublic\",\n \"transferPublicAsSigner\",\n \"transfer_public_to_private\",\n \"publicToPrivate\",\n \"publicAsSigner\",\n \"transferPublicToPrivate\",\n]);\n\nexport const PRIVATE_TRANSFER = new Set([\n \"private\",\n \"transfer_private\",\n \"transferPrivate\",\n]);\n\nexport const PRIVATE_TO_PUBLIC_TRANSFER = new Set([\n \"private_to_public\",\n \"privateToPublic\",\n \"transfer_private_to_public\",\n \"transferPrivateToPublic\",\n]);\n\nexport const PUBLIC_TRANSFER = new Set([\n \"public\",\n \"transfer_public\",\n \"transferPublic\",\n]);\n\nexport const PUBLIC_TRANSFER_AS_SIGNER = new Set([\n \"public_as_signer\",\n \"transfer_public_as_signer\",\n \"transferPublicAsSigner\",\n]);\n\nexport const PUBLIC_TO_PRIVATE_TRANSFER = new Set([\n \"public_to_private\",\n \"publicToPrivate\",\n \"transfer_public_to_private\",\n \"transferPublicToPrivate\",\n]);\n","import {\n CREDITS_PROGRAM_KEYS,\n KEY_STORE,\n Key,\n PRIVATE_TRANSFER,\n PRIVATE_TO_PUBLIC_TRANSFER,\n PUBLIC_TRANSFER,\n PUBLIC_TO_PRIVATE_TRANSFER,\n PUBLIC_TRANSFER_AS_SIGNER,\n} from \"./constants.js\";\n\nimport {\n ProvingKey,\n VerifyingKey,\n} from \"./wasm.js\";\n\nimport { get } from \"./utils.js\";\n\ntype FunctionKeyPair = [ProvingKey, VerifyingKey];\ntype CachedKeyPair = [Uint8Array, Uint8Array];\ntype AleoKeyProviderInitParams = {\n proverUri?: string;\n verifierUri?: string;\n cacheKey?: string;\n};\n\n/**\n * Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider\n * implementations.\n */\ninterface KeySearchParams {\n [key: string]: any; // This allows for arbitrary keys with any type values\n}\n\n/**\n * AleoKeyProviderParams search parameter for the AleoKeyProvider. It allows for the specification of a proverUri and\n * verifierUri to fetch keys via HTTP from a remote resource as well as a unique cacheKey to store the keys in memory.\n */\nclass AleoKeyProviderParams implements KeySearchParams {\n name: string | undefined;\n proverUri: string | undefined;\n verifierUri: string | undefined;\n cacheKey: string | undefined;\n\n /**\n * Create a new AleoKeyProviderParams object which implements the KeySearchParams interface. Users can optionally\n * specify a url for the proverUri & verifierUri to fetch keys via HTTP from a remote resource as well as a unique\n * cacheKey to store the keys in memory for future use. If no proverUri or verifierUri is specified, a cachekey must\n * be provided.\n *\n * @param { AleoKeyProviderInitParams } params - Optional search parameters\n */\n constructor(params: {proverUri?: string, verifierUri?: string, cacheKey?: string, name?: string}) {\n this.proverUri = params.proverUri;\n this.verifierUri = params.verifierUri;\n this.cacheKey = params.cacheKey;\n this.name = params.name;\n }\n}\n\n/**\n * KeyProvider interface. Enables the retrieval of public proving and verifying keys for Aleo Programs.\n */\ninterface FunctionKeyProvider {\n /**\n * Get bond_public function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_public function\n */\n bondPublicKeys(): Promise<FunctionKeyPair>;\n\n /**\n * Get bond_validator function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the bond_validator function\n */\n bondValidatorKeys(): Promise<FunctionKeyPair>;\n\n /**\n * Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId\n * exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.\n *\n * @param {string} keyId access key for the cache\n * @param {FunctionKeyPair} keys keys to cache\n */\n cacheKeys(keyId: string, keys: FunctionKeyPair): void;\n\n /**\n * Get unbond_public function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the unbond_public function\n */\n claimUnbondPublicKeys(): Promise<FunctionKeyPair>;\n\n /**\n * Get arbitrary function keys from a provider\n *\n * @param {KeySearchParams | undefined} params - Optional search parameters for the key provider\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program\n *\n * @example\n * // Create a search object which implements the KeySearchParams interface\n * class IndexDbSearch implements KeySearchParams {\n * db: string\n * keyId: string\n * constructor(params: {db: string, keyId: string}) {\n * this.db = params.db;\n * this.keyId = params.keyId;\n * }\n * }\n *\n * // Create a new object which implements the KeyProvider interface\n * class IndexDbKeyProvider implements FunctionKeyProvider {\n * async functionKeys(params: KeySearchParams): Promise<FunctionKeyPair> {\n * return new Promise((resolve, reject) => {\n * const request = indexedDB.open(params.db, 1);\n *\n * request.onupgradeneeded = function(e) {\n * const db = e.target.result;\n * if (!db.objectStoreNames.contains('keys')) {\n * db.createObjectStore('keys', { keyPath: 'id' });\n * }\n * };\n *\n * request.onsuccess = function(e) {\n * const db = e.target.result;\n * const transaction = db.transaction([\"keys\"], \"readonly\");\n * const store = transaction.objectStore(\"keys\");\n * const request = store.get(params.keyId);\n * request.onsuccess = function(e) {\n * if (request.result) {\n * resolve(request.result as FunctionKeyPair);\n * } else {\n * reject(new Error(\"Key not found\"));\n * }\n * };\n * request.onerror = function(e) { reject(new Error(\"Error fetching key\")); };\n * };\n *\n * request.onerror = function(e) { reject(new Error(\"Error opening database\")); };\n * });\n * }\n *\n * // implement the other methods...\n * }\n *\n *\n * const keyProvider = new AleoKeyProvider();\n * const networkClient = new AleoNetworkClient(\"https://api.explorer.provable.com/v1\");\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for value transfers\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * programManager.transfer(1, \"aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at\", \"public\", 0.5);\n *\n * // Keys can also be fetched manually\n * const searchParams = new IndexDbSearch({db: \"keys\", keyId: \"credits.aleo:transferPrivate\"});\n * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.functionKeys(searchParams);\n */\n functionKeys(params?: KeySearchParams): Promise<FunctionKeyPair>;\n\n /**\n * Get fee_private function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function\n */\n feePrivateKeys(): Promise<FunctionKeyPair>;\n\n /**\n * Get fee_public function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function\n */\n feePublicKeys(): Promise<FunctionKeyPair>;\n\n /**\n * Get join function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function\n */\n joinKeys(): Promise<FunctionKeyPair>;\n\n /**\n * Get split function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function\n */\n splitKeys(): Promise<FunctionKeyPair>;\n\n /**\n * Get keys for a variant of the transfer function from the credits.aleo program\n *\n * @param {string} visibility Visibility of the transfer function (private, public, privateToPublic, publicToPrivate)\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified transfer function\n *\n * @example\n * // Create a new object which implements the KeyProvider interface\n * const networkClient = new AleoNetworkClient(\"https://api.explorer.provable.com/v1\");\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for value transfers\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * programManager.transfer(1, \"aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at\", \"public\", 0.5);\n *\n * // Keys can also be fetched manually\n * const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys(\"public\");\n */\n transferKeys(visibility: string): Promise<FunctionKeyPair>;\n\n /**\n * Get unbond_public function keys from the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function\n */\n unBondPublicKeys(): Promise<FunctionKeyPair>;\n\n}\n\n\n/**\n * AleoKeyProvider class. Implements the KeyProvider interface. Enables the retrieval of Aleo program proving and\n * verifying keys for the credits.aleo program over http from official Aleo sources and storing and retrieving function\n * keys from a local memory cache.\n */\nclass AleoKeyProvider implements FunctionKeyProvider {\n cache: Map<string, CachedKeyPair>;\n cacheOption: boolean;\n keyUris: string;\n\n async fetchBytes(\n url = \"/\",\n ): Promise<Uint8Array> {\n try {\n const response = await get(url);\n const data = await response.arrayBuffer();\n return new Uint8Array(data);\n } catch (error: any) {\n throw new Error(\"Error fetching data.\" + error.message);\n }\n }\n\n constructor() {\n this.keyUris = KEY_STORE;\n this.cache = new Map<string, CachedKeyPair>();\n this.cacheOption = false;\n }\n\n /**\n * Use local memory to store keys\n *\n * @param {boolean} useCache whether to store keys in local memory\n */\n useCache(useCache: boolean) {\n this.cacheOption = useCache;\n }\n\n /**\n * Clear the key cache\n */\n clearCache() {\n this.cache.clear();\n }\n\n /**\n * Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId\n * exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.\n *\n * @param {string} keyId access key for the cache\n * @param {FunctionKeyPair} keys keys to cache\n */\n cacheKeys(keyId: string, keys: FunctionKeyPair) {\n const [provingKey, verifyingKey] = keys;\n this.cache.set(keyId, [provingKey.toBytes(), verifyingKey.toBytes()]);\n }\n\n /**\n * Determine if a keyId exists in the cache\n *\n * @param {string} keyId keyId of a proving and verifying key pair\n * @returns {boolean} true if the keyId exists in the cache, false otherwise\n */\n containsKeys(keyId: string): boolean {\n return this.cache.has(keyId)\n }\n\n /**\n * Delete a set of keys from the cache\n *\n * @param {string} keyId keyId of a proving and verifying key pair to delete from memory\n * @returns {boolean} true if the keyId exists in the cache and was deleted, false if the key did not exist\n */\n deleteKeys(keyId: string): boolean {\n return this.cache.delete(keyId)\n }\n\n /**\n * Get a set of keys from the cache\n * @param keyId keyId of a proving and verifying key pair\n *\n * @returns {FunctionKeyPair} Proving and verifying keys for the specified program\n */\n getKeys(keyId: string): FunctionKeyPair {\n console.debug(`Checking if key exists in cache. KeyId: ${keyId}`)\n if (this.cache.has(keyId)) {\n const [provingKeyBytes, verifyingKeyBytes] = <CachedKeyPair>this.cache.get(keyId);\n return [ProvingKey.fromBytes(provingKeyBytes), VerifyingKey.fromBytes(verifyingKeyBytes)];\n } else {\n throw new Error(\"Key not found in cache.\");\n }\n }\n\n /**\n * Get arbitrary function keys from a provider\n *\n * @param {KeySearchParams} params parameters for the key search in form of: {proverUri: string, verifierUri: string, cacheKey: string}\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program\n *\n * @example\n * // Create a new object which implements the KeyProvider interface\n * const networkClient = new AleoNetworkClient(\"https://api.explorer.provable.com/v1\");\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for value transfers\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * programManager.transfer(1, \"aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at\", \"public\", 0.5);\n *\n * // Keys can also be fetched manually using the key provider\n * const keySearchParams = { \"cacheKey\": \"myProgram:myFunction\" };\n * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.functionKeys(keySearchParams);\n */\n async functionKeys(params?: KeySearchParams): Promise<FunctionKeyPair> {\n if (params) {\n let proverUrl;\n let verifierUrl;\n let cacheKey;\n if (\"name\" in params && typeof params[\"name\"] == \"string\") {\n let key = CREDITS_PROGRAM_KEYS.getKey(params[\"name\"]);\n return this.fetchCreditsKeys(key);\n }\n\n if (\"proverUri\" in params && typeof params[\"proverUri\"] == \"string\") {\n proverUrl = params[\"proverUri\"];\n }\n\n if (\"verifierUri\" in params && typeof params[\"verifierUri\"] == \"string\") {\n verifierUrl = params[\"verifierUri\"];\n }\n\n if (\"cacheKey\" in params && typeof params[\"cacheKey\"] == \"string\") {\n cacheKey = params[\"cacheKey\"];\n }\n\n if (proverUrl && verifierUrl) {\n return await this.fetchRemoteKeys(proverUrl, verifierUrl, cacheKey);\n }\n\n if (cacheKey) {\n return this.getKeys(cacheKey);\n }\n }\n throw new Error(\"Invalid parameters provided, must provide either a cacheKey and/or a proverUrl and a verifierUrl\");\n }\n\n /**\n * Returns the proving and verifying keys for a specified program from a specified url.\n *\n * @param {string} verifierUrl Url of the proving key\n * @param {string} proverUrl Url the verifying key\n * @param {string} cacheKey Key to store the keys in the cache\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the specified program\n *\n * @example\n * // Create a new AleoKeyProvider object\n * const networkClient = new AleoNetworkClient(\"https://api.explorer.provable.com/v1\");\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for value transfers\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * programManager.transfer(1, \"aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at\", \"public\", 0.5);\n *\n * // Keys can also be fetched manually\n * const [transferPrivateProvingKey, transferPrivateVerifyingKey] = await keyProvider.fetchKeys(\n * CREDITS_PROGRAM_KEYS.transfer_private.prover,\n * CREDITS_PROGRAM_KEYS.transfer_private.verifier,\n * );\n */\n async fetchRemoteKeys(proverUrl: string, verifierUrl: string, cacheKey?: string): Promise<FunctionKeyPair> {\n try {\n // If cache is enabled, check if the keys have already been fetched and return them if they have\n if (this.cacheOption) {\n if (!cacheKey) {\n cacheKey = proverUrl;\n }\n const value = this.cache.get(cacheKey);\n if (typeof value !== \"undefined\") {\n return [ProvingKey.fromBytes(value[0]), VerifyingKey.fromBytes(value[1])];\n } else {\n console.debug(\"Fetching proving keys from url \" + proverUrl);\n const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl))\n console.debug(\"Fetching verifying keys \" + verifierUrl);\n const verifyingKey = <VerifyingKey>(await this.getVerifyingKey(verifierUrl));\n this.cache.set(cacheKey, [provingKey.toBytes(), verifyingKey.toBytes()]);\n return [provingKey, verifyingKey];\n }\n }\n else {\n // If cache is disabled, fetch the keys and return them\n const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl))\n const verifyingKey = <VerifyingKey>(await this.getVerifyingKey(verifierUrl));\n return [provingKey, verifyingKey];\n }\n } catch (error: any) {\n throw new Error(`Error: ${error.message} fetching fee proving and verifying keys from ${proverUrl} and ${verifierUrl}.`);\n }\n }\n\n /***\n * Fetches the proving key from a remote source.\n *\n * @param proverUrl\n * @param cacheKey\n *\n * @returns {Promise<ProvingKey>} Proving key for the specified program\n */\n async fetchProvingKey(proverUrl: string, cacheKey?: string): Promise<ProvingKey> {\n try {\n // If cache is enabled, check if the keys have already been fetched and return them if they have\n if (this.cacheOption) {\n if (!cacheKey) {\n cacheKey = proverUrl;\n }\n const value = this.cache.get(cacheKey);\n if (typeof value !== \"undefined\") {\n return ProvingKey.fromBytes(value[0]);\n } else {\n console.debug(\"Fetching proving keys from url \" + proverUrl);\n const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl));\n return provingKey;\n }\n }\n else {\n const provingKey = <ProvingKey>ProvingKey.fromBytes(await this.fetchBytes(proverUrl));\n return provingKey;\n }\n } catch (error: any) {\n throw new Error(`Error: ${error.message} fetching fee proving keys from ${proverUrl}`);\n }\n }\n\n async fetchCreditsKeys(key: Key): Promise<FunctionKeyPair> {\n try {\n if (!this.cache.has(key.locator) || !this.cacheOption) {\n const verifying_key = key.verifyingKey()\n const proving_key = <ProvingKey>await this.fetchProvingKey(key.prover, key.locator);\n if (this.cacheOption) {\n this.cache.set(CREDITS_PROGRAM_KEYS.bond_public.locator, [proving_key.toBytes(), verifying_key.toBytes()]);\n }\n return [proving_key, verifying_key];\n } else {\n const keyPair = <CachedKeyPair>this.cache.get(key.locator);\n return [ProvingKey.fromBytes(keyPair[0]), VerifyingKey.fromBytes(keyPair[1])];\n }\n } catch (error: any) {\n throw new Error(`Error: fetching credits.aleo keys: ${error.message}`);\n }\n }\n\n async bondPublicKeys(): Promise<FunctionKeyPair> {\n return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.bond_public);\n }\n\n bondValidatorKeys(): Promise<FunctionKeyPair> {\n return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.bond_validator);\n }\n\n claimUnbondPublicKeys(): Promise<FunctionKeyPair> {\n return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.claim_unbond_public)\n }\n\n /**\n * Returns the proving and verifying keys for the transfer functions in the credits.aleo program\n * @param {string} visibility Visibility of the transfer function\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the transfer functions\n *\n * @example\n * // Create a new AleoKeyProvider\n * const networkClient = new AleoNetworkClient(\"https://api.explorer.provable.com/v1\");\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for value transfers\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * programManager.transfer(1, \"aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at\", \"public\", 0.5);\n *\n * // Keys can also be fetched manually\n * const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys(\"public\");\n */\n async transferKeys(visibility: string): Promise<FunctionKeyPair> {\n if (PRIVATE_TRANSFER.has(visibility)) {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_private);\n } else if (PRIVATE_TO_PUBLIC_TRANSFER.has(visibility)) {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_private_to_public);\n } else if (PUBLIC_TRANSFER.has(visibility)) {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_public);\n } else if (PUBLIC_TRANSFER_AS_SIGNER.has(visibility)) {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_public_as_signer);\n } else if (PUBLIC_TO_PRIVATE_TRANSFER.has(visibility)) {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.transfer_public_to_private);\n } else {\n throw new Error(\"Invalid visibility type\");\n }\n }\n\n /**\n * Returns the proving and verifying keys for the join function in the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the join function\n */\n async joinKeys(): Promise<FunctionKeyPair> {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.join);\n }\n\n /**\n * Returns the proving and verifying keys for the split function in the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the split function\n * */\n async splitKeys(): Promise<FunctionKeyPair> {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.split);\n }\n\n /**\n * Returns the proving and verifying keys for the fee_private function in the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the fee function\n */\n async feePrivateKeys(): Promise<FunctionKeyPair> {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.fee_private);\n }\n\n /**\n * Returns the proving and verifying keys for the fee_public function in the credits.aleo program\n *\n * @returns {Promise<FunctionKeyPair>} Proving and verifying keys for the fee function\n */\n async feePublicKeys(): Promise<FunctionKeyPair> {\n return await this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.fee_public);\n }\n\n /**\n * Gets a verifying key. If the verifying key is for a credits.aleo function, get it from the wasm cache otherwise\n *\n * @returns {Promise<VerifyingKey>} Verifying key for the function\n */\n // attempt to fetch it from the network\n async getVerifyingKey(verifierUri: string): Promise<VerifyingKey> {\n switch (verifierUri) {\n case CREDITS_PROGRAM_KEYS.bond_public.verifier:\n return CREDITS_PROGRAM_KEYS.bond_public.verifyingKey();\n case CREDITS_PROGRAM_KEYS.bond_validator.verifier:\n return CREDITS_PROGRAM_KEYS.bond_validator.verifyingKey();\n case CREDITS_PROGRAM_KEYS.claim_unbond_public.verifier:\n return CREDITS_PROGRAM_KEYS.claim_unbond_public.verifyingKey();\n case CREDITS_PROGRAM_KEYS.fee_private.verifier:\n return CREDITS_PROGRAM_KEYS.fee_private.verifyingKey();\n case CREDITS_PROGRAM_KEYS.fee_public.verifier:\n return CREDITS_PROGRAM_KEYS.fee_public.verifyingKey();\n case CREDITS_PROGRAM_KEYS.inclusion.verifier:\n return CREDITS_PROGRAM_KEYS.inclusion.verifyingKey();\n case CREDITS_PROGRAM_KEYS.join.verifier:\n return CREDITS_PROGRAM_KEYS.join.verifyingKey();\n case CREDITS_PROGRAM_KEYS.set_validator_state.verifier:\n return CREDITS_PROGRAM_KEYS.set_validator_state.verifyingKey();\n case CREDITS_PROGRAM_KEYS.split.verifier:\n return CREDITS_PROGRAM_KEYS.split.verifyingKey();\n case CREDITS_PROGRAM_KEYS.transfer_private.verifier:\n return CREDITS_PROGRAM_KEYS.transfer_private.verifyingKey();\n case CREDITS_PROGRAM_KEYS.transfer_private_to_public.verifier:\n return CREDITS_PROGRAM_KEYS.transfer_private_to_public.verifyingKey();\n case CREDITS_PROGRAM_KEYS.transfer_public.verifier:\n return CREDITS_PROGRAM_KEYS.transfer_public.verifyingKey();\n case CREDITS_PROGRAM_KEYS.transfer_public_as_signer.verifier:\n return CREDITS_PROGRAM_KEYS.transfer_public_as_signer.verifyingKey();\n case CREDITS_PROGRAM_KEYS.transfer_public_to_private.verifier:\n return CREDITS_PROGRAM_KEYS.transfer_public_to_private.verifyingKey();\n case CREDITS_PROGRAM_KEYS.unbond_public.verifier:\n return CREDITS_PROGRAM_KEYS.unbond_public.verifyingKey();\n default:\n try {\n /// Try to fetch the verifying key from the network as a string\n const response = await get(verifierUri);\n const text = await response.text();\n return <VerifyingKey>VerifyingKey.fromString(text);\n } catch (e) {\n /// If that fails, try to fetch the verifying key from the network as bytes\n try {\n return <VerifyingKey>VerifyingKey.fromBytes(await this.fetchBytes(verifierUri));\n } catch (inner: any) {\n throw new Error(\"Invalid verifying key. Error: \" + inner.message);\n }\n }\n }\n }\n\n unBondPublicKeys(): Promise<FunctionKeyPair> {\n return this.fetchCreditsKeys(CREDITS_PROGRAM_KEYS.unbond_public);\n }\n}\n\nexport {AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, CachedKeyPair, FunctionKeyPair, FunctionKeyProvider, KeySearchParams}\n","import { Account } from \"./account.js\";\nimport { AleoNetworkClient, AleoNetworkClientOptions, ProgramImports } from \"./network-client.js\";\nimport { ImportedPrograms, ImportedVerifyingKeys } from \"./models/imports.js\";\nimport { RecordProvider, RecordSearchParams } from \"./record-provider.js\";\n\nimport {\n AleoKeyProvider,\n AleoKeyProviderParams,\n FunctionKeyPair,\n FunctionKeyProvider,\n KeySearchParams,\n} from \"./function-key-provider.js\";\n\nimport {\n Address,\n Authorization,\n ExecutionResponse,\n Execution as FunctionExecution,\n OfflineQuery,\n RecordPlaintext,\n PrivateKey,\n Program,\n ProvingKey,\n VerifyingKey,\n Transaction,\n ProgramManager as WasmProgramManager,\n verifyFunctionExecution,\n} from \"./wasm.js\";\n\nimport {\n CREDITS_PROGRAM_KEYS,\n PRIVATE_TRANSFER_TYPES,\n VALID_TRANSFER_TYPES,\n} from \"./constants.js\";\n\nimport { logAndThrow } from \"./utils.js\";\n\n/**\n * Represents the options for executing a transaction in the Aleo network.\n * This interface is used to specify the parameters required for building and submitting an execution transaction.\n *\n * @property {string} programName - The name of the program containing the function to be executed.\n * @property {string} functionName - The name of the function to execute within the program.\n * @property {number} priorityFee - The optional priority fee to be paid for the transaction.\n * @property {boolean} privateFee - If true, uses a private record to pay the fee; otherwise, uses the account's public credit balance.\n * @property {string[]} inputs - The inputs to the function being executed.\n * @property {RecordSearchParams} [recordSearchParams] - Optional parameters for searching for a record to pay the execution transaction fee.\n * @property {KeySearchParams} [keySearchParams] - Optional parameters for finding the matching proving & verifying keys for the function.\n * @property {string | RecordPlaintext} [feeRecord] - Optional fee record to use for the transaction.\n * @property {ProvingKey} [provingKey] - Optional proving key to use for the transaction.\n * @property {VerifyingKey} [verifyingKey] - Optional verifying key to use for the transaction.\n * @property {PrivateKey} [privateKey] - Optional private key to use for the transaction.\n * @property {OfflineQuery} [offlineQuery] - Optional offline query if creating transactions in an offline environment.\n * @property {string | Program} [program] - Optional program source code to use for the transaction.\n * @property {ProgramImports} [imports] - Optional programs that the program being executed imports.\n */\ninterface ExecuteOptions {\n programName: string;\n functionName: string;\n priorityFee: number;\n privateFee: boolean;\n inputs: string[];\n recordSearchParams?: RecordSearchParams;\n keySearchParams?: KeySearchParams;\n feeRecord?: string | RecordPlaintext;\n provingKey?: ProvingKey;\n verifyingKey?: VerifyingKey;\n privateKey?: PrivateKey;\n offlineQuery?: OfflineQuery;\n program?: string | Program;\n imports?: ProgramImports;\n}\n\n/**\n * Options for building an Authorization for a function.\n *\n * @property programName {string} Name of the program containing the function to build the authorization for.\n * @property functionName {string} Name of the function name to build the authorization for.\n * @property inputs {string[]} The inputs to the function.\n * @property programSource {string | Program} The optional source code for the program to build an execution for.\n * @property privateKey {PrivateKey} Optional private key to use to build the authorization.\n * @property programImports {ProgramImports} The other programs the program imports.\n */\ninterface AuthorizationOptions {\n programName: string;\n functionName: string;\n inputs: string[];\n programSource?: string | Program;\n privateKey?: PrivateKey;\n programImports?: ProgramImports;\n}\n\n/**\n * Options for executing a fee authorization.\n *\n * @property deploymentOrExecutionId {string} The id of a previously built Execution or Authorization.\n * @property baseFeeCredits {number} The number of Aleo Credits to pay for the base fee.\n * @property priorityFeeCredits {number} The number of Aleo Credits to pay for the priority fee.\n * @property privateKey {PrivateKey} Optional private key to specify for the authorization.\n * @property feeRecord {RecordPlaintext} A record to specify to pay the private fee. If this is specified a `fee_private` authorization will be built.\n */\ninterface FeeAuthorizationOptions {\n deploymentOrExecutionId: string,\n baseFeeCredits: number,\n priorityFeeCredits?: number,\n privateKey?: PrivateKey,\n feeRecord?: RecordPlaintext,\n}\n\n/**\n * The ProgramManager class is used to execute and deploy programs on the Aleo network and create value transfers.\n */\nclass ProgramManager {\n account: Account | undefined;\n keyProvider: FunctionKeyProvider;\n host: string;\n networkClient: AleoNetworkClient;\n recordProvider: RecordProvider | undefined;\n\n /** Create a new instance of the ProgramManager\n *\n * @param { string | undefined } host A host uri running the official Aleo API\n * @param { FunctionKeyProvider | undefined } keyProvider A key provider that implements {@link FunctionKeyProvider} interface\n * @param { RecordProvider | undefined } recordProvider A record provider that implements {@link RecordProvider} interface\n */\n constructor(\n host?: string | undefined,\n keyProvider?: FunctionKeyProvider | undefined,\n recordProvider?: RecordProvider | undefined,\n networkClientOptions?: AleoNetworkClientOptions | undefined,\n ) {\n this.host = host ? host : \"https://api.explorer.provable.com/v1\";\n this.networkClient = new AleoNetworkClient(this.host, networkClientOptions);\n\n this.keyProvider = keyProvider ? keyProvider : new AleoKeyProvider();\n this.recordProvider = recordProvider;\n }\n\n /**\n * Check if the fee is sufficient to pay for the transaction\n */\n async checkFee(address: string, feeAmount: bigint) {\n const balance =\n BigInt(await this.networkClient.getPublicBalance(address));\n if (feeAmount > balance) {\n throw Error(\n `The desired execution requires a fee of ${feeAmount} microcredits, but the account paying the fee has ${balance} microcredits available.`,\n );\n }\n }\n\n /**\n * Set the account to use for transaction submission to the Aleo network\n *\n * @param {Account} account Account to use for transaction submission\n */\n setAccount(account: Account) {\n this.account = account;\n }\n\n /**\n * Set the key provider that provides the proving and verifying keys for programs\n *\n * @param {FunctionKeyProvider} keyProvider\n */\n setKeyProvider(keyProvider: FunctionKeyProvider) {\n this.keyProvider = keyProvider;\n }\n\n /**\n * Set the host peer to use for transaction submission to the Aleo network\n *\n * @param host {string} Peer url to use for transaction submission\n */\n setHost(host: string) {\n this.host = host;\n this.networkClient.setHost(host);\n }\n\n /**\n * Set the record provider that provides records for transactions\n *\n * @param {RecordProvider} recordProvider\n */\n setRecordProvider(recordProvider: RecordProvider) {\n this.recordProvider = recordProvider;\n }\n\n /**\n * Set a header in the `AleoNetworkClient`s header map\n *\n * @param {string} headerName The name of the header to set\n * @param {string} value The header value\n *\n * @example\n * import { ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a ProgramManager\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\");\n *\n * // Set the value of the `Accept-Language` header to `en-US`\n * programManager.setHeader('Accept-Language', 'en-US');\n */\n setHeader(headerName: string, value: string) {\n this.networkClient.headers[headerName] = value;\n }\n\n /**\n * Remove a header from the `AleoNetworkClient`s header map\n *\n * @param {string} headerName The name of the header to be removed\n *\n * @example\n * import { ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a ProgramManager\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\");\n *\n * // Remove the default `X-Aleo-SDK-Version` header\n * programManager.removeHeader('X-Aleo-SDK-Version');\n */\n removeHeader(headerName: string) {\n delete this.networkClient.headers[headerName]\n }\n\n /**\n * Builds a deployment transaction for submission to the Aleo network.\n *\n * @param {string} program Program source code\n * @param {number} priorityFee The optional priority fee to be paid for that transaction.\n * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance\n * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for searching for a record to use pay the deployment fee\n * @param {string | RecordPlaintext | undefined} feeRecord Optional Fee record to use for the transaction\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction\n * @returns {string} The transaction id of the deployed program or a failure message from the network\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for deployments\n * 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\";\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * programManager.setAccount(Account);\n *\n * // Define a fee in credits\n * const priorityFee = 0.0;\n *\n * // Create the deployment transaction.\n * const tx = await programManager.buildDeploymentTransaction(program, fee, false);\n * await programManager.networkClient.submitTransaction(tx);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 20000);\n */\n async buildDeploymentTransaction(\n program: string,\n priorityFee: number,\n privateFee: boolean,\n recordSearchParams?: RecordSearchParams,\n feeRecord?: string | RecordPlaintext,\n privateKey?: PrivateKey,\n ): Promise<Transaction> {\n // Ensure the program is valid.\n let programObject;\n try {\n programObject = Program.fromString(program);\n } catch (e: any) {\n logAndThrow(\n `Error parsing program: '${e.message}'. Please ensure the program is valid.`,\n );\n }\n\n // Ensure the program is valid and does not exist on the network\n try {\n let programSource;\n try {\n programSource = await this.networkClient.getProgram(\n programObject.id(),\n );\n } catch (e) {\n // Program does not exist on the network, deployment can proceed\n console.log(\n `Program ${programObject.id()} does not exist on the network, deploying...`,\n );\n }\n if (typeof programSource === \"string\") {\n throw Error(`Program ${programObject.id()} already exists on the network, please rename your program`);\n }\n } catch (e: any) {\n logAndThrow(`Error validating program: ${e.message}`);\n }\n\n // Get the private key from the account if it is not provided in the parameters\n let deploymentPrivateKey = privateKey;\n if (\n typeof privateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n deploymentPrivateKey = this.account.privateKey();\n }\n\n if (typeof deploymentPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n\n // Get the fee record from the account if it is not provided in the parameters\n try {\n feeRecord = privateFee\n ? <RecordPlaintext>(\n await this.getCreditsRecord(\n priorityFee,\n [],\n feeRecord,\n recordSearchParams,\n )\n )\n : undefined;\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n\n // Get the proving and verifying keys from the key provider\n let feeKeys;\n try {\n feeKeys = privateFee\n ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys()\n : <FunctionKeyPair>await this.keyProvider.feePublicKeys();\n } catch (e: any) {\n logAndThrow(\n `Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`,\n );\n }\n const [feeProvingKey, feeVerifyingKey] = feeKeys;\n\n // Resolve the program imports if they exist\n let imports;\n try {\n imports = await this.networkClient.getProgramImports(program);\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n\n // Build a deployment transaction\n return await WasmProgramManager.buildDeploymentTransaction(\n deploymentPrivateKey,\n program,\n priorityFee,\n feeRecord,\n this.host,\n imports,\n feeProvingKey,\n feeVerifyingKey,\n );\n }\n\n /**\n * Deploy an Aleo program to the Aleo network\n *\n * @param {string} program Program source code\n * @param {number} priorityFee The optional fee to be paid for the transaction\n * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance\n * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for searching for a record to used pay the deployment fee\n * @param {string | RecordPlaintext | undefined} feeRecord Optional Fee record to use for the transaction\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction\n * @returns {string} The transaction id of the deployed program or a failure message from the network\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider.\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for deployments\n * 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\";\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n *\n * // Define a fee in credits\n * const priorityFee = 0.0;\n *\n * // Deploy the program\n * const tx_id = await programManager.deploy(program, fee, false);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 20000);\n */\n async deploy(\n program: string,\n priorityFee: number,\n privateFee: boolean,\n recordSearchParams?: RecordSearchParams,\n feeRecord?: string | RecordPlaintext,\n privateKey?: PrivateKey,\n ): Promise<string> {\n const tx = <Transaction>(\n await this.buildDeploymentTransaction(\n program,\n priorityFee,\n privateFee,\n recordSearchParams,\n feeRecord,\n privateKey,\n )\n );\n\n let feeAddress;\n\n if (typeof privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Builds an execution transaction for submission to the Aleo network.\n *\n * @param {ExecuteOptions} options - The options for the execution transaction.\n * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider.\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n *\n * // Build and execute the transaction\n * const tx = await programManager.buildExecutionTransaction({\n * programName: \"hello_hello.aleo\",\n * functionName: \"hello_hello\",\n * priorityFee: 0.0,\n * privateFee: false,\n * inputs: [\"5u32\", \"5u32\"],\n * keySearchParams: { \"cacheKey\": \"hello_hello:hello\" }\n * });\n *\n * // Submit the transaction to the network\n * await programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildExecutionTransaction(\n options: ExecuteOptions,\n ): Promise<Transaction> {\n // Destructure the options object to access the parameters\n const {\n programName,\n functionName,\n priorityFee,\n privateFee,\n inputs,\n recordSearchParams,\n keySearchParams,\n privateKey,\n offlineQuery,\n } = options;\n\n let feeRecord = options.feeRecord;\n let provingKey = options.provingKey;\n let verifyingKey = options.verifyingKey;\n let program = options.program;\n let imports = options.imports;\n\n // Ensure the function exists on the network\n if (program === undefined) {\n try {\n program = <string>(\n await this.networkClient.getProgram(programName)\n );\n } catch (e: any) {\n logAndThrow(\n `Error finding ${programName}. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network the program is deployed to the network.`,\n );\n }\n } else if (program instanceof Program) {\n program = program.toString();\n }\n\n // Get the private key from the account if it is not provided in the parameters\n let executionPrivateKey = privateKey;\n if (\n typeof privateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n executionPrivateKey = this.account.privateKey();\n }\n\n if (typeof executionPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n\n // Get the fee record from the account if it is not provided in the parameters\n try {\n feeRecord = privateFee\n ? <RecordPlaintext>(\n await this.getCreditsRecord(\n priorityFee,\n [],\n feeRecord,\n recordSearchParams,\n )\n )\n : undefined;\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n\n // Get the fee proving and verifying keys from the key provider\n let feeKeys;\n try {\n feeKeys = privateFee\n ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys()\n : <FunctionKeyPair>await this.keyProvider.feePublicKeys();\n } catch (e: any) {\n logAndThrow(\n `Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`,\n );\n }\n const [feeProvingKey, feeVerifyingKey] = feeKeys;\n\n // If the function proving and verifying keys are not provided, attempt to find them using the key provider\n if (!provingKey || !verifyingKey) {\n try {\n [provingKey, verifyingKey] = <FunctionKeyPair>(\n await this.keyProvider.functionKeys(keySearchParams)\n );\n } catch (e) {\n console.log(\n `Function keys not found. Key finder response: '${e}'. The function keys will be synthesized`,\n );\n }\n }\n\n // Resolve the program imports if they exist\n const numberOfImports = Program.fromString(program).getImports().length;\n if (numberOfImports > 0 && !imports) {\n try {\n imports = <ProgramImports>(\n await this.networkClient.getProgramImports(programName)\n );\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n }\n\n // Build an execution transaction\n return await WasmProgramManager.buildExecutionTransaction(\n executionPrivateKey,\n program,\n functionName,\n inputs,\n priorityFee,\n feeRecord,\n this.host,\n imports,\n provingKey,\n verifyingKey,\n feeProvingKey,\n feeVerifyingKey,\n offlineQuery,\n );\n }\n\n /**\n * Builds a SnarkVM `Authorization` for a specific function.\n *\n * @param {AuthorizationOptions} options - The options for building the `Authorization`\n * @returns {Promise<Authorization>} - A promise that resolves to an `Authorization` or throws an Error.\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider.\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a ProgramManager with the key and record providers.\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n *\n * // Build the `Authorization`.\n * const authorization = await programManager.buildAuthorization({\n * programName: \"credits.aleo\",\n * functionName: \"transfer_public\",\n * inputs: [\n * \"aleo1vwls2ete8dk8uu2kmkmzumd7q38fvshrht8hlc0a5362uq8ftgyqnm3w08\",\n * \"10000000u64\",\n * ],\n * });\n */\n async buildAuthorization(\n options: AuthorizationOptions,\n ): Promise<Authorization> {\n // Destructure the options object to access the parameters.\n const {\n programName,\n functionName,\n inputs,\n } = options;\n\n const privateKey = options.privateKey;\n let program = options.programSource;\n let imports = options.programImports;\n\n // Ensure the function exists on the network.\n if (program === undefined) {\n try {\n program = <string>(\n await this.networkClient.getProgram(programName)\n );\n } catch (e: any) {\n logAndThrow(\n `Error finding ${programName}. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network the program is deployed to the network.`,\n );\n }\n } else if (program instanceof Program) {\n program = program.toString();\n }\n\n // Get the private key from the account if it is not provided in the parameters.\n let executionPrivateKey = privateKey;\n if (\n typeof privateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n executionPrivateKey = this.account.privateKey();\n }\n\n if (typeof executionPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n\n // Resolve the program imports if they exist.\n const numberOfImports = Program.fromString(program).getImports().length;\n if (numberOfImports > 0 && !imports) {\n try {\n imports = <ProgramImports>(\n await this.networkClient.getProgramImports(programName)\n );\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n }\n\n // Build and return an `Authorization` for the desired function.\n return await WasmProgramManager.authorize(\n executionPrivateKey,\n program,\n functionName,\n inputs,\n imports\n );\n }\n\n /**\n * Builds a SnarkVM fee `Authorization` for `credits.aleo/fee_private` or `credits.aleo/fee_public`. If a record is provided `fee_private` will be executed, otherwise `fee_public` will be executed.\n *\n * @param {FeeAuthorizationOptions} options - The options for building the `Authorization`.\n * @returns {Promise<Authorization>} - A promise that resolves to an `Authorization` or throws an Error.\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider.\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a ProgramManager with the key and record providers.\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n *\n * // Build a credits.aleo/fee_public `Authorization`.\n * const feePublicAuthorization = await programManager.authorizeFee({\n * deploymentOrExecutionId: \"2423957656946557501636078245035919227529640894159332581642187482178647335171field\",\n * baseFeeCredits: 0.1,\n * });\n *\n * // Build a credits.aleo/fee_private `Authorization`.\n * const record = \"{ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private, microcredits: 1500000000000000u64.private, _nonce: 3077450429259593211617823051143573281856129402760267155982965992208217472983group.public }\";\n * const feePrivateAuthorization = await programManager.authorizeFee({\n * deploymentOrExecutionId: \"2423957656946557501636078245035919227529640894159332581642187482178647335171field\",\n * baseFeeCredits: 0.1,\n * feeRecord: record,\n * });\n */\n async buildFeeAuthorization(\n options: FeeAuthorizationOptions,\n ): Promise<Authorization> {\n // Destructure the options object to access the parameters.\n const {\n privateKey,\n deploymentOrExecutionId,\n baseFeeCredits,\n priorityFeeCredits,\n feeRecord,\n } = options;\n\n // Get the private key from the account if it is not provided in the parameters.\n let executionPrivateKey = privateKey;\n if (\n typeof privateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n executionPrivateKey = this.account.privateKey();\n }\n\n if (typeof executionPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n\n // Build and return the fee `Authorization`.\n return await WasmProgramManager.authorizeFee(\n executionPrivateKey,\n deploymentOrExecutionId,\n baseFeeCredits,\n priorityFeeCredits || 0,\n feeRecord,\n );\n }\n\n /**\n * Builds an execution transaction for submission to the Aleo network.\n *\n * @param {ExecuteOptions} options - The options for the execution transaction.\n * @returns {Promise<string>} - The transaction id\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n *\n * // Build and execute the transaction\n * const tx_id = await programManager.execute({\n * programName: \"hello_hello.aleo\",\n * functionName: \"hello_hello\",\n * priorityFee: 0.0,\n * privateFee: false,\n * inputs: [\"5u32\", \"5u32\"],\n * keySearchParams: { \"cacheKey\": \"hello_hello:hello\" }\n * });\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async execute(options: ExecuteOptions): Promise<string> {\n const tx = <Transaction>await this.buildExecutionTransaction(options);\n\n let feeAddress;\n\n if (typeof options.privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(options.privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Run an Aleo program in offline mode\n *\n * @param {string} program Program source code containing the function to be executed\n * @param {string} function_name Function name to execute\n * @param {string[]} inputs Inputs to the function\n * @param {number} proveExecution Whether to prove the execution of the function and return an execution transcript that contains the proof.\n * @param {string[] | undefined} imports Optional imports to the program\n * @param {KeySearchParams | undefined} keySearchParams Optional parameters for finding the matching proving & verifying keys for the function\n * @param {ProvingKey | undefined} provingKey Optional proving key to use for the transaction\n * @param {VerifyingKey | undefined} verifyingKey Optional verifying key to use for the transaction\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction\n * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment\n * @returns {Promise<ExecutionResponse>} The execution response containing the outputs of the function and the proof if the program is proved.\n *\n * @example\n * /// Import the mainnet version of the sdk used to build executions.\n * import { Account, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * /// Create the source for the \"helloworld\" program\n * const program = \"program helloworld.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\";\n * const programManager = new ProgramManager(undefined, undefined, undefined);\n *\n * /// Create a temporary account for the execution of the program\n * const account = new Account();\n * programManager.setAccount(account);\n *\n * /// Get the response and ensure that the program executed correctly\n * const executionResponse = await programManager.run(program, \"hello\", [\"5u32\", \"5u32\"]);\n * const result = executionResponse.getOutputs();\n * assert(result === [\"10u32\"]);\n */\n async run(\n program: string,\n function_name: string,\n inputs: string[],\n proveExecution: boolean,\n imports?: ProgramImports,\n keySearchParams?: KeySearchParams,\n provingKey?: ProvingKey,\n verifyingKey?: VerifyingKey,\n privateKey?: PrivateKey,\n offlineQuery?: OfflineQuery,\n ): Promise<ExecutionResponse> {\n // Get the private key from the account if it is not provided in the parameters\n let executionPrivateKey = privateKey;\n if (\n typeof privateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n executionPrivateKey = this.account.privateKey();\n }\n\n if (typeof executionPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n\n // If the function proving and verifying keys are not provided, attempt to find them using the key provider\n if (!provingKey || !verifyingKey) {\n try {\n [provingKey, verifyingKey] = <FunctionKeyPair>(\n await this.keyProvider.functionKeys(keySearchParams)\n );\n } catch (e) {\n console.log(\n `Function keys not found. Key finder response: '${e}'. The function keys will be synthesized`,\n );\n }\n }\n\n // Run the program offline and return the result\n console.log(\"Running program offline\");\n console.log(\"Proving key: \", provingKey);\n console.log(\"Verifying key: \", verifyingKey);\n return WasmProgramManager.executeFunctionOffline(\n executionPrivateKey,\n program,\n function_name,\n inputs,\n proveExecution,\n false,\n imports,\n provingKey,\n verifyingKey,\n this.host,\n offlineQuery,\n );\n }\n\n /**\n * Join two credits records into a single credits record\n *\n * @param {RecordPlaintext | string} recordOne First credits record to join\n * @param {RecordPlaintext | string} recordTwo Second credits record to join\n * @param {number} priorityFee The optional priority fee to be paid for the transaction\n * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance\n * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the fee record to use to pay the fee for the join transaction\n * @param {RecordPlaintext | string | undefined} feeRecord Fee record to use for the join transaction\n * @param {PrivateKey | undefined} privateKey Private key to use for the join transaction\n * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * const record_1 = \"{ owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private, microcredits: 45000000u64.private, _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}\"\n * const record_2 = \"{ owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private, microcredits: 45000000u64.private, _nonce: 1540945439182663264862696551825005342995406165131907382295858612069623286213group.public}\"\n * const tx_id = await programManager.join(record_1, record_2, 0.05, false);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async join(\n recordOne: RecordPlaintext | string,\n recordTwo: RecordPlaintext | string,\n priorityFee: number,\n privateFee: boolean,\n recordSearchParams?: RecordSearchParams | undefined,\n feeRecord?: RecordPlaintext | string | undefined,\n privateKey?: PrivateKey,\n offlineQuery?: OfflineQuery,\n ): Promise<string> {\n // Get the private key from the account if it is not provided in the parameters and assign the fee address\n let executionPrivateKey = privateKey;\n let feeAddress;\n if (\n typeof privateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n executionPrivateKey = this.account.privateKey();\n feeAddress = this.account?.address();\n }\n else if (typeof executionPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n else {\n feeAddress = Address.from_private_key(executionPrivateKey);\n }\n\n // Get the proving and verifying keys from the key provider\n let feeKeys;\n let joinKeys;\n try {\n feeKeys = privateFee\n ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys()\n : <FunctionKeyPair>await this.keyProvider.feePublicKeys();\n joinKeys = <FunctionKeyPair>await this.keyProvider.joinKeys();\n } catch (e: any) {\n logAndThrow(\n `Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`,\n );\n }\n const [feeProvingKey, feeVerifyingKey] = feeKeys;\n const [joinProvingKey, joinVerifyingKey] = joinKeys;\n\n // Get the fee record from the account if it is not provided in the parameters\n try {\n feeRecord = privateFee\n ? <RecordPlaintext>(\n await this.getCreditsRecord(\n priorityFee,\n [],\n feeRecord,\n recordSearchParams,\n )\n )\n : undefined;\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n\n // Validate the records provided are valid plaintext records\n try {\n recordOne =\n recordOne instanceof RecordPlaintext\n ? recordOne\n : RecordPlaintext.fromString(recordOne);\n recordTwo =\n recordTwo instanceof RecordPlaintext\n ? recordTwo\n : RecordPlaintext.fromString(recordTwo);\n } catch (e: any) {\n logAndThrow(\n \"Records provided are not valid. Please ensure they are valid plaintext records.\",\n );\n }\n\n // Build an execution transaction and submit it to the network\n const tx = await WasmProgramManager.buildJoinTransaction(\n executionPrivateKey,\n recordOne,\n recordTwo,\n priorityFee,\n feeRecord,\n this.host,\n joinProvingKey,\n joinVerifyingKey,\n feeProvingKey,\n feeVerifyingKey,\n offlineQuery,\n );\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Split credits into two new credits records\n *\n * @param {number} splitAmount Amount in microcredits to split from the original credits record\n * @param {RecordPlaintext | string} amountRecord Amount record to use for the split transaction\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the split transaction\n * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * const record = \"{ owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private, microcredits: 45000000u64.private, _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}\"\n * const tx_id = await programManager.split(25000000, record);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async split(\n splitAmount: number,\n amountRecord: RecordPlaintext | string,\n privateKey?: PrivateKey,\n offlineQuery?: OfflineQuery,\n ): Promise<string> {\n // Get the private key from the account if it is not provided in the parameters\n let executionPrivateKey = privateKey;\n if (\n typeof privateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n executionPrivateKey = this.account.privateKey();\n }\n\n if (typeof executionPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n\n // Get the split keys from the key provider\n let splitKeys;\n try {\n splitKeys = <FunctionKeyPair>await this.keyProvider.splitKeys();\n } catch (e: any) {\n logAndThrow(\n `Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`,\n );\n }\n const [splitProvingKey, splitVerifyingKey] = splitKeys;\n\n // Validate the record to be split\n try {\n amountRecord =\n amountRecord instanceof RecordPlaintext\n ? amountRecord\n : RecordPlaintext.fromString(amountRecord);\n } catch (e: any) {\n logAndThrow(\n \"Record provided is not valid. Please ensure it is a valid plaintext record.\",\n );\n }\n\n // Build an execution transaction and submit it to the network\n const tx = await WasmProgramManager.buildSplitTransaction(\n executionPrivateKey,\n splitAmount,\n amountRecord,\n this.host,\n splitProvingKey,\n splitVerifyingKey,\n offlineQuery,\n );\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Pre-synthesize proving and verifying keys for a program\n *\n * @param program {string} The program source code to synthesize keys for\n * @param function_id {string} The function id to synthesize keys for\n * @param inputs {Array<string>} Sample inputs to the function\n * @param privateKey {PrivateKey | undefined} Optional private key to use for the key synthesis\n *\n * @returns {Promise<FunctionKeyPair>}\n */\n async synthesizeKeys(\n program: string,\n function_id: string,\n inputs: Array<string>,\n privateKey?: PrivateKey,\n ): Promise<FunctionKeyPair> {\n // Resolve the program imports if they exist\n let imports;\n\n let executionPrivateKey = privateKey;\n if (typeof executionPrivateKey === \"undefined\") {\n if (typeof this.account !== \"undefined\") {\n executionPrivateKey = this.account.privateKey();\n } else {\n executionPrivateKey = new PrivateKey();\n }\n }\n\n // Attempt to run an offline execution of the program and extract the proving and verifying keys\n try {\n imports = await this.networkClient.getProgramImports(program);\n const keyPair = await WasmProgramManager.synthesizeKeyPair(\n executionPrivateKey,\n program,\n function_id,\n inputs,\n imports,\n );\n return [\n <ProvingKey>keyPair.provingKey(),\n <VerifyingKey>keyPair.verifyingKey(),\n ];\n } catch (e: any) {\n logAndThrow(\n `Could not synthesize keys - error ${e.message}. Please ensure the program is valid and the inputs are correct.`,\n );\n }\n }\n\n /**\n * Build a transaction to transfer credits to another account for later submission to the Aleo network\n *\n * @param {number} amount The amount of credits to transfer\n * @param {string} recipient The recipient of the transfer\n * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'\n * @param {number} priorityFee The optional priority fee to be paid for the transaction\n * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance\n * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee records for the transfer transaction\n * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer\n * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction\n * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment\n * @returns {Promise<Transaction>} The transaction object\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * const tx = await programManager.buildTransferTransaction(1, \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", \"public\", 0.2, false);\n * await programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildTransferTransaction(\n amount: number,\n recipient: string,\n transferType: string,\n priorityFee: number,\n privateFee: boolean,\n recordSearchParams?: RecordSearchParams,\n amountRecord?: RecordPlaintext | string,\n feeRecord?: RecordPlaintext | string,\n privateKey?: PrivateKey,\n offlineQuery?: OfflineQuery,\n ): Promise<Transaction> {\n // Validate the transfer type\n transferType = <string>validateTransferType(transferType);\n\n // Get the private key from the account if it is not provided in the parameters\n let executionPrivateKey = privateKey;\n if (\n typeof executionPrivateKey === \"undefined\" &&\n typeof this.account !== \"undefined\"\n ) {\n executionPrivateKey = this.account.privateKey();\n }\n\n if (typeof executionPrivateKey === \"undefined\") {\n throw \"No private key provided and no private key set in the ProgramManager\";\n }\n\n // Get the proving and verifying keys from the key provider\n let feeKeys;\n let transferKeys;\n try {\n feeKeys = privateFee\n ? <FunctionKeyPair>await this.keyProvider.feePrivateKeys()\n : <FunctionKeyPair>await this.keyProvider.feePublicKeys();\n transferKeys = <FunctionKeyPair>(\n await this.keyProvider.transferKeys(transferType)\n );\n } catch (e: any) {\n logAndThrow(\n `Error finding fee keys. Key finder response: '${e.message}'. Please ensure your key provider is configured correctly.`,\n );\n }\n const [feeProvingKey, feeVerifyingKey] = feeKeys;\n const [transferProvingKey, transferVerifyingKey] = transferKeys;\n\n // Get the amount and fee record from the account if it is not provided in the parameters\n try {\n // Track the nonces of the records found so no duplicate records are used\n const nonces: string[] = [];\n if (requiresAmountRecord(transferType)) {\n // If the transfer type is private and requires an amount record, get it from the record provider\n amountRecord = <RecordPlaintext>(\n await this.getCreditsRecord(\n priorityFee,\n [],\n amountRecord,\n recordSearchParams,\n )\n );\n nonces.push(amountRecord.nonce());\n } else {\n amountRecord = undefined;\n }\n feeRecord = privateFee\n ? <RecordPlaintext>(\n await this.getCreditsRecord(\n priorityFee,\n nonces,\n feeRecord,\n recordSearchParams,\n )\n )\n : undefined;\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n\n // Build an execution transaction\n return await WasmProgramManager.buildTransferTransaction(\n executionPrivateKey,\n amount,\n recipient,\n transferType,\n amountRecord,\n priorityFee,\n feeRecord,\n this.host,\n transferProvingKey,\n transferVerifyingKey,\n feeProvingKey,\n feeVerifyingKey,\n offlineQuery,\n );\n }\n\n /**\n * Build a transfer_public transaction to transfer credits to another account for later submission to the Aleo network\n *\n * @param {number} amount The amount of credits to transfer\n * @param {string} recipient The recipient of the transfer\n * @param {number} priorityFee The optional priority fee to be paid for the transfer\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction\n * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment\n * @returns {Promise<Transaction>} The transaction object\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * const tx = await programManager.buildTransferPublicTransaction(1, \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", 0.2);\n * await programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildTransferPublicTransaction(\n amount: number,\n recipient: string,\n priorityFee: number,\n privateKey?: PrivateKey,\n offlineQuery?: OfflineQuery,\n ): Promise<Transaction> {\n return this.buildTransferTransaction(\n amount,\n recipient,\n \"public\",\n priorityFee,\n false,\n undefined,\n undefined,\n undefined,\n privateKey,\n offlineQuery,\n );\n }\n\n /**\n * Build a transfer_public_as_signer transaction to transfer credits to another account for later submission to the Aleo network\n *\n * @param {number} amount The amount of credits to transfer\n * @param {string} recipient The recipient of the transfer\n * @param {number} priorityFee The optional priority fee to be paid for the transfer\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction\n * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment\n * @returns {Promise<Transaction>} The transaction object\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * const tx = await programManager.buildTransferPublicAsSignerTransaction(1, \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", 0.2);\n * await programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildTransferPublicAsSignerTransaction(\n amount: number,\n recipient: string,\n priorityFee: number,\n privateKey?: PrivateKey,\n offlineQuery?: OfflineQuery,\n ): Promise<Transaction> {\n return this.buildTransferTransaction(\n amount,\n recipient,\n \"public\",\n priorityFee,\n false,\n undefined,\n undefined,\n undefined,\n privateKey,\n offlineQuery,\n );\n }\n\n /**\n * Transfer credits to another account\n *\n * @param {number} amount The amount of credits to transfer\n * @param {string} recipient The recipient of the transfer\n * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'\n * @param {number} priorityFee The optional priority fee to be paid for the transfer\n * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance\n * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee records for the transfer transaction\n * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer\n * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer\n * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction\n * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * /// Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a new NetworkClient, KeyProvider, and RecordProvider\n * const keyProvider = new AleoKeyProvider();\n * const recordProvider = new NetworkRecordProvider(account, networkClient);\n * keyProvider.useCache = true;\n *\n * // Initialize a program manager with the key provider to automatically fetch keys for executions\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, recordProvider);\n * const tx_id = await programManager.transfer(1, \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", \"public\", 0.2, false);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async transfer(\n amount: number,\n recipient: string,\n transferType: string,\n priorityFee: number,\n privateFee: boolean,\n recordSearchParams?: RecordSearchParams,\n amountRecord?: RecordPlaintext | string,\n feeRecord?: RecordPlaintext | string,\n privateKey?: PrivateKey,\n offlineQuery?: OfflineQuery,\n ): Promise<string> {\n const tx = <Transaction>(\n await this.buildTransferTransaction(\n amount,\n recipient,\n transferType,\n priorityFee,\n privateFee,\n recordSearchParams,\n amountRecord,\n feeRecord,\n privateKey,\n offlineQuery,\n )\n );\n\n let feeAddress;\n\n if (typeof privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Build transaction to bond credits to a validator for later submission to the Aleo Network\n *\n * @param {string} validator_address Address of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.\n * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.\n * @param {number} amount The amount of credits to bond\n * @param {Partial<ExecuteOptions>} options - Override default execution options.\n * @returns {Promise<Transaction>} The transaction object\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n * programManager.setAccount(new Account(\"YourPrivateKey\"));\n *\n * // Create the bonding transaction object for later submission\n * const tx = await programManager.buildBondPublicTransaction(\"aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j\", \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", \"aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9\", 2000000);\n *\n * // The transaction can be later submitted to the network using the network client.\n * await programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildBondPublicTransaction(\n validator_address: string,\n withdrawal_address: string,\n amount: number,\n options: Partial<ExecuteOptions> = {},\n ) {\n const scaledAmount = Math.trunc(amount * 1000000);\n\n const {\n programName = \"credits.aleo\",\n functionName = \"bond_public\",\n priorityFee = options.priorityFee || 0,\n privateFee = false,\n inputs = [\n validator_address,\n withdrawal_address,\n `${scaledAmount.toString()}u64`,\n ],\n keySearchParams = new AleoKeyProviderParams({\n proverUri: CREDITS_PROGRAM_KEYS.bond_public.prover,\n verifierUri: CREDITS_PROGRAM_KEYS.bond_public.verifier,\n cacheKey: \"credits.aleo/bond_public\",\n }),\n program = this.creditsProgram(),\n ...additionalOptions\n } = options;\n\n const executeOptions: ExecuteOptions = {\n programName,\n functionName,\n priorityFee,\n privateFee,\n inputs,\n keySearchParams,\n ...additionalOptions,\n };\n\n return await this.buildExecutionTransaction(executeOptions);\n }\n\n /**\n * Bond credits to validator.\n *\n * @param {string} validator_address Address of the validator to bond to, if this address is the same as the signer (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 1,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.\n * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.\n * @param {number} amount The amount of credits to bond\n * @param {Options} options Options for the execution\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n *\n * // Create the bonding transaction\n * tx_id = await programManager.bondPublic(\"aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j\", \"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", \"aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9\", 2000000);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async bondPublic(\n validator_address: string,\n withdrawal_address: string,\n amount: number,\n options: Partial<ExecuteOptions> = {},\n ) {\n const tx = <Transaction>(\n await this.buildBondPublicTransaction(\n validator_address,\n withdrawal_address,\n amount,\n options,\n )\n );\n\n let feeAddress;\n\n if (typeof options.privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(options.privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Build a bond_validator transaction for later submission to the Aleo Network.\n *\n * @param {string} validator_address Address of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator.\n * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.\n * @param {number} amount The amount of credits to bond. A minimum of 10000 credits is required to bond as a delegator.\n * @param {number} commission The commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)\n * @param {Partial<ExecuteOptions>} options - Override default execution options.\n * @returns {Promise<Transaction>} The transaction object\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n * programManager.setAccount(new Account(\"YourPrivateKey\"));\n *\n * // Create the bond validator transaction object for later use.\n * const tx = await programManager.buildBondValidatorTransaction(\"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", \"aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9\", 2000000);\n *\n * // The transaction can later be submitted to the network using the network client.\n * const tx_id = await programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async buildBondValidatorTransaction(\n validator_address: string,\n withdrawal_address: string,\n amount: number,\n commission: number,\n options: Partial<ExecuteOptions> = {},\n ) {\n const scaledAmount = Math.trunc(amount * 1000000);\n\n const adjustedCommission = Math.trunc(commission);\n\n const {\n programName = \"credits.aleo\",\n functionName = \"bond_validator\",\n priorityFee = options.priorityFee || 0,\n privateFee = false,\n inputs = [\n validator_address,\n withdrawal_address,\n `${scaledAmount.toString()}u64`,\n `${adjustedCommission.toString()}u8`,\n ],\n keySearchParams = new AleoKeyProviderParams({\n proverUri: CREDITS_PROGRAM_KEYS.bond_validator.prover,\n verifierUri: CREDITS_PROGRAM_KEYS.bond_validator.verifier,\n cacheKey: \"credits.aleo/bond_validator\",\n }),\n program = this.creditsProgram(),\n ...additionalOptions\n } = options;\n\n const executeOptions: ExecuteOptions = {\n programName,\n functionName,\n priorityFee,\n privateFee,\n inputs,\n keySearchParams,\n ...additionalOptions,\n };\n\n return await this.buildExecutionTransaction(executeOptions);\n }\n\n /**\n * Build transaction to bond a validator.\n *\n * @param {string} validator_address Address of the validator to bond to, if this address is the same as the staker (i.e. the executor of this function), it will attempt to bond the credits as a validator. Bonding as a validator currently requires a minimum of 10,000,000 credits to bond (subject to change). If the address is specified is an existing validator and is different from the address of the executor of this function, it will bond the credits to that validator's staking committee as a delegator. A minimum of 10 credits is required to bond as a delegator.\n * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.\n * @param {number} amount The amount of credits to bond\n * @param {number} commission The commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)\n * @param {Partial<ExecuteOptions>} options - Override default execution options.\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n * programManager.setAccount(new Account(\"YourPrivateKey\"));\n *\n * // Create the bonding transaction\n * const tx_id = await programManager.bondValidator(\"aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px\", \"aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9\", 2000000);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async bondValidator(\n validator_address: string,\n withdrawal_address: string,\n amount: number,\n commission: number,\n options: Partial<ExecuteOptions> = {},\n ) {\n const tx = <Transaction>(\n await this.buildBondValidatorTransaction(\n validator_address,\n withdrawal_address,\n amount,\n commission,\n options,\n )\n );\n\n let feeAddress;\n\n if (typeof options.privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(options.privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Build an unbond_public execution transaction to unbond credits from a validator in the Aleo network.\n *\n * @param {string} staker_address - The address of the staker who is unbonding the credits.\n * @param {number} amount - The amount of credits to unbond (scaled by 1,000,000).\n * @param {Partial<ExecuteOptions>} options - Override default execution options.\n * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management.\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to unbond credits.\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n * const tx = await programManager.buildUnbondPublicTransaction(\"aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j\", 2000000);\n *\n * // The transaction can be submitted later to the network using the network client.\n * programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildUnbondPublicTransaction(\n staker_address: string,\n amount: number,\n options: Partial<ExecuteOptions> = {},\n ): Promise<Transaction> {\n const scaledAmount = Math.trunc(amount * 1000000);\n\n const {\n programName = \"credits.aleo\",\n functionName = \"unbond_public\",\n priorityFee = options.priorityFee || 0,\n privateFee = false,\n inputs = [staker_address, `${scaledAmount.toString()}u64`],\n keySearchParams = new AleoKeyProviderParams({\n proverUri: CREDITS_PROGRAM_KEYS.unbond_public.prover,\n verifierUri: CREDITS_PROGRAM_KEYS.unbond_public.verifier,\n cacheKey: \"credits.aleo/unbond_public\",\n }),\n program = this.creditsProgram(),\n ...additionalOptions\n } = options;\n\n const executeOptions: ExecuteOptions = {\n programName,\n functionName,\n priorityFee,\n privateFee,\n inputs,\n keySearchParams,\n ...additionalOptions,\n };\n\n return this.buildExecutionTransaction(executeOptions);\n }\n\n /**\n * Unbond a specified amount of staked credits. If the address of the executor of this function is an existing\n * validator, it will subtract this amount of credits from the validator's staked credits. If there are less than\n * 1,000,000 credits staked pool after the unbond, the validator will be removed from the validator set. If the\n * address of the executor of this function is not a validator and has credits bonded as a delegator, it will\n * subtract this amount of credits from the delegator's staked credits. If there are less than 10 credits bonded\n * after the unbond operation, the delegator will be removed from the validator's staking pool.\n *\n * @param {string} staker_address Address of the staker who is unbonding the credits\n * @param {number} amount Amount of credits to unbond.\n * @param {ExecuteOptions} options Options for the execution\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n * programManager.setAccount(new Account(\"YourPrivateKey\"));\n *\n * // Create the unbond_public transaction and send it to the network\n * const tx_id = await programManager.unbondPublic(\"aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j\", 10);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async unbondPublic(\n staker_address: string,\n amount: number,\n options: Partial<ExecuteOptions> = {},\n ): Promise<string> {\n const tx = <Transaction>(\n await this.buildUnbondPublicTransaction(\n staker_address,\n amount,\n options,\n )\n );\n\n let feeAddress;\n\n if (typeof options.privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(options.privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Build a transaction to claim unbonded public credits in the Aleo network.\n *\n * @param {string} staker_address - The address of the staker who is claiming the credits.\n * @param {Partial<ExecuteOptions>} options - Override default execution options.\n * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to claim unbonded credits.\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n *\n * // Create the claim_unbond_public transaction object for later use.\n * const tx = await programManager.buildClaimUnbondPublicTransaction(\"aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j\");\n *\n * // The transaction can be submitted later to the network using the network client.\n * programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildClaimUnbondPublicTransaction(\n staker_address: string,\n options: Partial<ExecuteOptions> = {},\n ): Promise<Transaction> {\n const {\n programName = \"credits.aleo\",\n functionName = \"claim_unbond_public\",\n priorityFee = options.priorityFee || 0,\n privateFee = false,\n inputs = [staker_address],\n keySearchParams = new AleoKeyProviderParams({\n proverUri: CREDITS_PROGRAM_KEYS.claim_unbond_public.prover,\n verifierUri: CREDITS_PROGRAM_KEYS.claim_unbond_public.verifier,\n cacheKey: \"credits.aleo/claim_unbond_public\",\n }),\n program = this.creditsProgram(),\n ...additionalOptions\n } = options;\n\n const executeOptions: ExecuteOptions = {\n programName,\n functionName,\n priorityFee,\n privateFee,\n inputs,\n keySearchParams,\n ...additionalOptions,\n };\n\n // Check if the account has sufficient credits to pay for the transaction\n return await this.buildExecutionTransaction(executeOptions);\n }\n\n /**\n * Claim unbonded credits. If credits have been unbonded by the account executing this function, this method will\n * claim them and add them to the public balance of the account.\n *\n * @param {string} staker_address Address of the staker who is claiming the credits\n * @param {ExecuteOptions} options\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n * programManager.setAccount(new Account(\"YourPrivateKey\"));\n *\n * // Create the claim_unbond_public transaction\n * const tx_id = await programManager.claimUnbondPublic(\"aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j\");\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async claimUnbondPublic(\n staker_address: string,\n options: Partial<ExecuteOptions> = {},\n ): Promise<string> {\n const tx = <Transaction>(\n await this.buildClaimUnbondPublicTransaction(\n staker_address,\n options,\n )\n );\n\n let feeAddress;\n\n if (typeof options.privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(options.privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return await this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Build a set_validator_state transaction for later usage.\n *\n * This function allows a validator to set their state to be either opened or closed to new stakers.\n * When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.\n * When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.\n *\n * This function serves two primary purposes:\n * 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.\n * 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.\n *\n * @param {boolean} validator_state\n * @param {Partial<ExecuteOptions>} options - Override default execution options\n * @returns {Promise<Transaction>} The transaction object\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n *\n * // Create the set_validator_state transaction\n * const tx = await programManager.buildSetValidatorStateTransaction(true);\n *\n * // The transaction can be submitted later to the network using the network client.\n * programManager.networkClient.submitTransaction(tx.toString());\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx.id());\n * assert(transaction.id() === tx.id());\n * }, 10000);\n */\n async buildSetValidatorStateTransaction(\n validator_state: boolean,\n options: Partial<ExecuteOptions> = {},\n ): Promise<Transaction> {\n const {\n programName = \"credits.aleo\",\n functionName = \"set_validator_state\",\n priorityFee = 0,\n privateFee = false,\n inputs = [validator_state.toString()],\n keySearchParams = new AleoKeyProviderParams({\n proverUri: CREDITS_PROGRAM_KEYS.set_validator_state.prover,\n verifierUri: CREDITS_PROGRAM_KEYS.set_validator_state.verifier,\n cacheKey: \"credits.aleo/set_validator_state\",\n }),\n ...additionalOptions\n } = options;\n\n const executeOptions: ExecuteOptions = {\n programName,\n functionName,\n priorityFee,\n privateFee,\n inputs,\n keySearchParams,\n ...additionalOptions,\n };\n\n return await this.buildExecutionTransaction(executeOptions);\n }\n\n /**\n * Submit a set_validator_state transaction to the Aleo Network.\n *\n * This function allows a validator to set their state to be either opened or closed to new stakers.\n * When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.\n * When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.\n *\n * This function serves two primary purposes:\n * 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.\n * 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.\n *\n * @param {boolean} validator_state\n * @param {Partial<ExecuteOptions>} options - Override default execution options\n * @returns {Promise<string>} The transaction id\n *\n * @example\n * // Import the mainnet version of the sdk.\n * import { AleoKeyProvider, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * // Create a keyProvider to handle key management\n * const keyProvider = new AleoKeyProvider();\n * keyProvider.useCache = true;\n *\n * // Create a new ProgramManager with the key that will be used to bond credits\n * const programManager = new ProgramManager(\"https://api.explorer.provable.com/v1\", keyProvider, undefined);\n *\n * // Create the set_validator_state transaction\n * const tx_id = await programManager.setValidatorState(true);\n *\n * // Verify the transaction was successful\n * setTimeout(async () => {\n * const transaction = await programManager.networkClient.getTransaction(tx_id);\n * assert(transaction.id() === tx_id);\n * }, 10000);\n */\n async setValidatorState(\n validator_state: boolean,\n options: Partial<ExecuteOptions> = {},\n ) {\n const tx = <Transaction>(\n await this.buildSetValidatorStateTransaction(\n validator_state,\n options,\n )\n );\n\n let feeAddress;\n\n if (typeof options.privateKey !== \"undefined\") {\n feeAddress = Address.from_private_key(options.privateKey);\n } else if (this.account !== undefined) {\n feeAddress = this.account?.address();\n } else {\n throw Error(\n \"No private key provided and no private key set in the ProgramManager. Please set an account or provide a private key.\",\n );\n }\n\n // Check if the account has sufficient credits to pay for the transaction\n await this.checkFee(feeAddress.to_string(), tx.feeAmount());\n\n return this.networkClient.submitTransaction(tx);\n }\n\n /**\n * Verify a proof from an offline execution. This is useful when it is desired to do offchain proving and verification.\n *\n * @param {executionResponse} executionResponse The response from an offline function execution (via the `programManager.run` method)\n * @param {ImportedPrograms} imports The imported programs used in the execution. Specified as { \"programName\": \"programSourceCode\", ... }\n * @param {ImportedVerifyingKeys} importedVerifyingKeys The verifying keys in the execution. Specified as { \"programName\": [[\"functionName\", \"verifyingKey\"], ...], ... }\n * @returns {boolean} True if the proof is valid, false otherwise\n *\n * @example\n * /// Import the mainnet version of the sdk used to build executions.\n * import { Account, ProgramManager } from \"@provablehq/sdk/mainnet.js\";\n *\n * /// Create the source for two programs.\n * const program = \"import add_it_up.aleo; \\n\\n program mul_add.aleo;\\n\\nfunction mul_and_add:\\n input r0 as u32.public;\\n input r1 as u32.private;\\n mul r0 r1 into r2;\\n call add_it_up.aleo/add_it r1 r2 into r3; output r3 as u32.private;\\n\";\n * const program_import = \"program add_it_up.aleo;\\n\\nfunction add_it:\\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\";\n * const programManager = new ProgramManager(undefined, undefined, undefined);\n *\n * /// Create a temporary account for the execution of the program\n * const account = Account.fromCipherText(process.env.ciphertext, process.env.password);\n * programManager.setAccount(account);\n *\n * /// Get the response and ensure that the program executed correctly\n * const executionResponse = await programManager.run(program, \"mul_and_add\", [\"5u32\", \"5u32\"], true);\n *\n * /// Construct the imports and verifying keys\n * const imports = { \"add_it_up.aleo\": program_import };\n * const importedVerifyingKeys = { \"add_it_up.aleo\": [[\"add_it\", \"verifyingKey1...\"]] };\n *\n * /// Verify the execution.\n * const isValid = programManager.verifyExecution(executionResponse, imports, importedVerifyingKeys);\n * assert(isValid);\n */\n verifyExecution(executionResponse: ExecutionResponse, imports?: ImportedPrograms, importedVerifyingKeys?: ImportedVerifyingKeys): boolean {\n try {\n const execution = <FunctionExecution>(\n executionResponse.getExecution()\n );\n const function_id = executionResponse.getFunctionId();\n const program = executionResponse.getProgram();\n const verifyingKey = executionResponse.getVerifyingKey();\n return verifyFunctionExecution(\n execution,\n verifyingKey,\n program,\n function_id,\n imports,\n importedVerifyingKeys,\n );\n } catch (e) {\n console.warn(\n \"The execution was not found in the response, cannot verify the execution\",\n );\n return false;\n }\n }\n\n /**\n * Create a program object from a program's source code\n *\n * @param {string} program Program source code\n * @returns {Program} The program object\n */\n createProgramFromSource(program: string): Program {\n return Program.fromString(program);\n }\n\n /**\n * Get the credits program object\n *\n * @returns {Program} The credits program object\n */\n creditsProgram(): Program {\n return Program.getCreditsProgram();\n }\n\n /**\n * Verify a program is valid\n *\n * @param {string} program The program source code\n */\n verifyProgram(program: string): boolean {\n try {\n <Program>Program.fromString(program);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n // Internal utility function for getting a credits.aleo record\n async getCreditsRecord(\n amount: number,\n nonces: string[],\n record?: RecordPlaintext | string,\n params?: RecordSearchParams,\n ): Promise<RecordPlaintext> {\n try {\n return record instanceof RecordPlaintext\n ? record\n : RecordPlaintext.fromString(<string>record);\n } catch (e) {\n try {\n const recordProvider = <RecordProvider>this.recordProvider;\n return <RecordPlaintext>(\n await recordProvider.findCreditsRecord(\n amount,\n true,\n nonces,\n params,\n )\n );\n } catch (e: any) {\n logAndThrow(\n `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.`,\n );\n }\n }\n }\n}\n\n// Ensure the transfer type requires an amount record\nfunction requiresAmountRecord(transferType: string): boolean {\n return PRIVATE_TRANSFER_TYPES.has(transferType);\n}\n\n// Validate the transfer type\nfunction validateTransferType(transferType: string): string {\n return VALID_TRANSFER_TYPES.has(transferType)\n ? transferType\n : logAndThrow(\n `Invalid transfer type '${transferType}'. Valid transfer types are 'private', 'privateToPublic', 'public', and 'publicToPrivate'.`,\n );\n}\n\nexport { ProgramManager, AuthorizationOptions, FeeAuthorizationOptions, ExecuteOptions };\n"],"names":["WasmProgramManager"],"mappings":";;AAAA,SAAS,aAAa,GAAA;AAClB,IAAA,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS;AAErC,IAAA,IAAI,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AAC1E,QAAA,OAAO,QAAQ;;AACZ,SAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AACzC,QAAA,OAAO,SAAS;;AACb,SAAA,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AACnF,QAAA,OAAO,QAAQ;;AACZ,SAAA,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AAC/B,QAAA,OAAO,MAAM;;AACV,SAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AACjC,QAAA,OAAO,OAAO;;SACX;AACH,QAAA,OAAO,SAAS;;AAExB;SAEgB,WAAW,GAAA;AACvB,IAAA,IAAI,CAAC,OAAO,OAAO,KAAK,WAAW;SAC9B,OAAO,CAAC,OAAO,EAAE,IAAI,KAAK,MAAM,CAAC,EAAE;AACpC,QAAA,OAAO,MAAM;;AACV,SAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACtC,OAAO,aAAa,EAAE;;SACnB;AACH,QAAA,OAAO,SAAS;;AAExB;AAEM,SAAU,WAAW,CAAC,OAAe,EAAA;AACvC,IAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;AACtB,IAAA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC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