@provablehq/sdk 0.10.2 → 0.10.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 (217) hide show
  1. package/dist/dynamic/browser.cjs +12 -0
  2. package/dist/dynamic/browser.d.cts +8 -0
  3. package/dist/dynamic/browser.d.ts +2 -2
  4. package/dist/dynamic/node.cjs +12 -0
  5. package/dist/dynamic/node.d.cts +8 -0
  6. package/dist/dynamic/node.d.ts +2 -2
  7. package/dist/mainnet/account.d.cts +347 -0
  8. package/dist/mainnet/browser.cjs +8507 -0
  9. package/dist/mainnet/browser.cjs.map +1 -0
  10. package/dist/mainnet/browser.d.cts +72 -0
  11. package/dist/mainnet/browser.d.ts +2 -2
  12. package/dist/mainnet/browser.js +55 -31
  13. package/dist/mainnet/browser.js.map +1 -1
  14. package/dist/mainnet/constants.d.cts +40 -0
  15. package/dist/mainnet/external-signing.d.cts +76 -0
  16. package/dist/mainnet/integrations/sealance/merkle-tree.d.cts +192 -0
  17. package/dist/mainnet/keys/keystore/error.d.cts +24 -0
  18. package/dist/mainnet/keys/keystore/file.d.cts +177 -0
  19. package/dist/mainnet/keys/keystore/interface.d.cts +161 -0
  20. package/dist/mainnet/keys/provider/interface.d.cts +170 -0
  21. package/dist/mainnet/keys/provider/memory.d.cts +213 -0
  22. package/dist/mainnet/keys/provider/memory.d.ts +6 -2
  23. package/dist/mainnet/keys/provider/offline.d.cts +365 -0
  24. package/dist/mainnet/keys/verifier/interface.d.cts +70 -0
  25. package/dist/mainnet/keys/verifier/memory.d.cts +37 -0
  26. package/dist/mainnet/keys/verifier/memory.d.ts +1 -1
  27. package/dist/mainnet/models/authorization.d.cts +6 -0
  28. package/dist/mainnet/models/authorization.d.ts +2 -2
  29. package/dist/mainnet/models/blockJSON.d.cts +33 -0
  30. package/dist/mainnet/models/confirmed_transaction.d.cts +9 -0
  31. package/dist/mainnet/models/cryptoBoxPubkey.d.cts +4 -0
  32. package/dist/mainnet/models/deployment/deploymentJSON.d.cts +6 -0
  33. package/dist/mainnet/models/deployment/deploymentObject.d.cts +6 -0
  34. package/dist/mainnet/models/encryptedProvingRequest.d.cts +4 -0
  35. package/dist/mainnet/models/execution/executionJSON.d.cts +11 -0
  36. package/dist/mainnet/models/execution/executionObject.d.cts +11 -0
  37. package/dist/mainnet/models/external-signing.d.cts +123 -0
  38. package/dist/mainnet/models/finalizeJSON.d.cts +6 -0
  39. package/dist/mainnet/models/functionInput.d.cts +7 -0
  40. package/dist/mainnet/models/functionObject.d.cts +8 -0
  41. package/dist/mainnet/models/imports.d.cts +7 -0
  42. package/dist/mainnet/models/input/inputJSON.d.cts +10 -0
  43. package/dist/mainnet/models/input/inputObject.d.cts +15 -0
  44. package/dist/mainnet/models/inputID.d.cts +4 -0
  45. package/dist/mainnet/models/keyPair.d.cts +4 -0
  46. package/dist/mainnet/models/output/outputJSON.d.cts +7 -0
  47. package/dist/mainnet/models/output/outputObject.d.cts +18 -0
  48. package/dist/mainnet/models/owner/ownerJSON.d.cts +4 -0
  49. package/dist/mainnet/models/owner/ownerObject.d.cts +5 -0
  50. package/dist/mainnet/models/plaintext/array.d.cts +3 -0
  51. package/dist/mainnet/models/plaintext/literal.d.cts +1 -0
  52. package/dist/mainnet/models/plaintext/plaintext.d.cts +5 -0
  53. package/dist/mainnet/models/plaintext/struct.d.cts +5 -0
  54. package/dist/mainnet/models/provingRequest.d.cts +6 -0
  55. package/dist/mainnet/models/provingRequest.d.ts +1 -1
  56. package/dist/mainnet/models/provingResponse.d.cts +51 -0
  57. package/dist/mainnet/models/ratification.d.cts +4 -0
  58. package/dist/mainnet/models/record-provider/encryptedRecord.d.cts +58 -0
  59. package/dist/mainnet/models/record-provider/ownedRecord.d.cts +60 -0
  60. package/dist/mainnet/models/record-provider/recordSearchParams.d.cts +19 -0
  61. package/dist/mainnet/models/record-scanner/encryptedRecordsResult.d.cts +7 -0
  62. package/dist/mainnet/models/record-scanner/encryptedRegistrationRequest.d.cts +8 -0
  63. package/dist/mainnet/models/record-scanner/error.d.cts +47 -0
  64. package/dist/mainnet/models/record-scanner/error.d.ts +1 -1
  65. package/dist/mainnet/models/record-scanner/ownedFilter.d.cts +22 -0
  66. package/dist/mainnet/models/record-scanner/ownedFilter.d.ts +3 -3
  67. package/dist/mainnet/models/record-scanner/ownedRecordsResponseFilter.d.cts +42 -0
  68. package/dist/mainnet/models/record-scanner/ownedRecordsResult.d.cts +13 -0
  69. package/dist/mainnet/models/record-scanner/recordsFilter.d.cts +35 -0
  70. package/dist/mainnet/models/record-scanner/recordsFilter.d.ts +2 -2
  71. package/dist/mainnet/models/record-scanner/recordsResponseFilter.d.cts +42 -0
  72. package/dist/mainnet/models/record-scanner/registrationRequest.d.cts +13 -0
  73. package/dist/mainnet/models/record-scanner/registrationResponse.d.cts +13 -0
  74. package/dist/mainnet/models/record-scanner/registrationResult.d.cts +9 -0
  75. package/dist/mainnet/models/record-scanner/revokeResult.d.cts +17 -0
  76. package/dist/mainnet/models/record-scanner/serialNumbersResult.d.cts +15 -0
  77. package/dist/mainnet/models/record-scanner/statusResponse.d.cts +13 -0
  78. package/dist/mainnet/models/record-scanner/statusResult.d.cts +13 -0
  79. package/dist/mainnet/models/record-scanner/tagsResult.d.cts +12 -0
  80. package/dist/mainnet/models/request.d.cts +14 -0
  81. package/dist/mainnet/models/request.d.ts +1 -1
  82. package/dist/mainnet/models/solution.d.cts +14 -0
  83. package/dist/mainnet/models/transaction/transactionJSON.d.cts +11 -0
  84. package/dist/mainnet/models/transaction/transactionObject.d.cts +14 -0
  85. package/dist/mainnet/models/transition/transitionJSON.d.cts +13 -0
  86. package/dist/mainnet/models/transition/transitionObject.d.cts +15 -0
  87. package/dist/mainnet/network-client.d.cts +850 -0
  88. package/dist/mainnet/network-client.d.ts +3 -0
  89. package/dist/mainnet/node-polyfill.cjs +238 -0
  90. package/dist/mainnet/node-polyfill.cjs.map +1 -0
  91. package/dist/mainnet/node-polyfill.d.cts +5 -0
  92. package/dist/mainnet/node-polyfill.js +1 -1
  93. package/dist/mainnet/node-polyfill.js.map +1 -1
  94. package/dist/mainnet/node.cjs +685 -0
  95. package/dist/mainnet/node.cjs.map +1 -0
  96. package/dist/mainnet/node.d.cts +3 -0
  97. package/dist/mainnet/node.js +1 -1
  98. package/dist/mainnet/polyfill/crypto.d.cts +1 -0
  99. package/dist/mainnet/polyfill/fetch.d.cts +1 -0
  100. package/dist/mainnet/polyfill/shared.d.cts +1 -0
  101. package/dist/mainnet/polyfill/worker.d.cts +1 -0
  102. package/dist/mainnet/polyfill/xmlhttprequest.d.cts +1 -0
  103. package/dist/mainnet/program-manager.d.cts +1588 -0
  104. package/dist/mainnet/record-provider.d.cts +274 -0
  105. package/dist/mainnet/record-scanner.d.cts +371 -0
  106. package/dist/mainnet/record-scanner.d.ts +9 -6
  107. package/dist/mainnet/security.d.cts +62 -0
  108. package/dist/mainnet/security.d.ts +5 -5
  109. package/dist/mainnet/utils.d.cts +23 -0
  110. package/dist/mainnet/utils.d.ts +10 -2
  111. package/dist/mainnet/wasm.d.cts +1 -0
  112. package/dist/testnet/account.d.cts +347 -0
  113. package/dist/testnet/browser.cjs +8507 -0
  114. package/dist/testnet/browser.cjs.map +1 -0
  115. package/dist/testnet/browser.d.cts +72 -0
  116. package/dist/testnet/browser.d.ts +2 -2
  117. package/dist/testnet/browser.js +55 -31
  118. package/dist/testnet/browser.js.map +1 -1
  119. package/dist/testnet/constants.d.cts +40 -0
  120. package/dist/testnet/external-signing.d.cts +76 -0
  121. package/dist/testnet/integrations/sealance/merkle-tree.d.cts +192 -0
  122. package/dist/testnet/keys/keystore/error.d.cts +24 -0
  123. package/dist/testnet/keys/keystore/file.d.cts +177 -0
  124. package/dist/testnet/keys/keystore/interface.d.cts +161 -0
  125. package/dist/testnet/keys/provider/interface.d.cts +170 -0
  126. package/dist/testnet/keys/provider/memory.d.cts +213 -0
  127. package/dist/testnet/keys/provider/memory.d.ts +6 -2
  128. package/dist/testnet/keys/provider/offline.d.cts +365 -0
  129. package/dist/testnet/keys/verifier/interface.d.cts +70 -0
  130. package/dist/testnet/keys/verifier/memory.d.cts +37 -0
  131. package/dist/testnet/keys/verifier/memory.d.ts +1 -1
  132. package/dist/testnet/models/authorization.d.cts +6 -0
  133. package/dist/testnet/models/authorization.d.ts +2 -2
  134. package/dist/testnet/models/blockJSON.d.cts +33 -0
  135. package/dist/testnet/models/confirmed_transaction.d.cts +9 -0
  136. package/dist/testnet/models/cryptoBoxPubkey.d.cts +4 -0
  137. package/dist/testnet/models/deployment/deploymentJSON.d.cts +6 -0
  138. package/dist/testnet/models/deployment/deploymentObject.d.cts +6 -0
  139. package/dist/testnet/models/encryptedProvingRequest.d.cts +4 -0
  140. package/dist/testnet/models/execution/executionJSON.d.cts +11 -0
  141. package/dist/testnet/models/execution/executionObject.d.cts +11 -0
  142. package/dist/testnet/models/external-signing.d.cts +123 -0
  143. package/dist/testnet/models/finalizeJSON.d.cts +6 -0
  144. package/dist/testnet/models/functionInput.d.cts +7 -0
  145. package/dist/testnet/models/functionObject.d.cts +8 -0
  146. package/dist/testnet/models/imports.d.cts +7 -0
  147. package/dist/testnet/models/input/inputJSON.d.cts +10 -0
  148. package/dist/testnet/models/input/inputObject.d.cts +15 -0
  149. package/dist/testnet/models/inputID.d.cts +4 -0
  150. package/dist/testnet/models/keyPair.d.cts +4 -0
  151. package/dist/testnet/models/output/outputJSON.d.cts +7 -0
  152. package/dist/testnet/models/output/outputObject.d.cts +18 -0
  153. package/dist/testnet/models/owner/ownerJSON.d.cts +4 -0
  154. package/dist/testnet/models/owner/ownerObject.d.cts +5 -0
  155. package/dist/testnet/models/plaintext/array.d.cts +3 -0
  156. package/dist/testnet/models/plaintext/literal.d.cts +1 -0
  157. package/dist/testnet/models/plaintext/plaintext.d.cts +5 -0
  158. package/dist/testnet/models/plaintext/struct.d.cts +5 -0
  159. package/dist/testnet/models/provingRequest.d.cts +6 -0
  160. package/dist/testnet/models/provingRequest.d.ts +1 -1
  161. package/dist/testnet/models/provingResponse.d.cts +51 -0
  162. package/dist/testnet/models/ratification.d.cts +4 -0
  163. package/dist/testnet/models/record-provider/encryptedRecord.d.cts +58 -0
  164. package/dist/testnet/models/record-provider/ownedRecord.d.cts +60 -0
  165. package/dist/testnet/models/record-provider/recordSearchParams.d.cts +19 -0
  166. package/dist/testnet/models/record-scanner/encryptedRecordsResult.d.cts +7 -0
  167. package/dist/testnet/models/record-scanner/encryptedRegistrationRequest.d.cts +8 -0
  168. package/dist/testnet/models/record-scanner/error.d.cts +47 -0
  169. package/dist/testnet/models/record-scanner/error.d.ts +1 -1
  170. package/dist/testnet/models/record-scanner/ownedFilter.d.cts +22 -0
  171. package/dist/testnet/models/record-scanner/ownedFilter.d.ts +3 -3
  172. package/dist/testnet/models/record-scanner/ownedRecordsResponseFilter.d.cts +42 -0
  173. package/dist/testnet/models/record-scanner/ownedRecordsResult.d.cts +13 -0
  174. package/dist/testnet/models/record-scanner/recordsFilter.d.cts +35 -0
  175. package/dist/testnet/models/record-scanner/recordsFilter.d.ts +2 -2
  176. package/dist/testnet/models/record-scanner/recordsResponseFilter.d.cts +42 -0
  177. package/dist/testnet/models/record-scanner/registrationRequest.d.cts +13 -0
  178. package/dist/testnet/models/record-scanner/registrationResponse.d.cts +13 -0
  179. package/dist/testnet/models/record-scanner/registrationResult.d.cts +9 -0
  180. package/dist/testnet/models/record-scanner/revokeResult.d.cts +17 -0
  181. package/dist/testnet/models/record-scanner/serialNumbersResult.d.cts +15 -0
  182. package/dist/testnet/models/record-scanner/statusResponse.d.cts +13 -0
  183. package/dist/testnet/models/record-scanner/statusResult.d.cts +13 -0
  184. package/dist/testnet/models/record-scanner/tagsResult.d.cts +12 -0
  185. package/dist/testnet/models/request.d.cts +14 -0
  186. package/dist/testnet/models/request.d.ts +1 -1
  187. package/dist/testnet/models/solution.d.cts +14 -0
  188. package/dist/testnet/models/transaction/transactionJSON.d.cts +11 -0
  189. package/dist/testnet/models/transaction/transactionObject.d.cts +14 -0
  190. package/dist/testnet/models/transition/transitionJSON.d.cts +13 -0
  191. package/dist/testnet/models/transition/transitionObject.d.cts +15 -0
  192. package/dist/testnet/network-client.d.cts +850 -0
  193. package/dist/testnet/network-client.d.ts +3 -0
  194. package/dist/testnet/node-polyfill.cjs +238 -0
  195. package/dist/testnet/node-polyfill.cjs.map +1 -0
  196. package/dist/testnet/node-polyfill.d.cts +5 -0
  197. package/dist/testnet/node-polyfill.js +1 -1
  198. package/dist/testnet/node-polyfill.js.map +1 -1
  199. package/dist/testnet/node.cjs +685 -0
  200. package/dist/testnet/node.cjs.map +1 -0
  201. package/dist/testnet/node.d.cts +3 -0
  202. package/dist/testnet/node.js +1 -1
  203. package/dist/testnet/polyfill/crypto.d.cts +1 -0
  204. package/dist/testnet/polyfill/fetch.d.cts +1 -0
  205. package/dist/testnet/polyfill/shared.d.cts +1 -0
  206. package/dist/testnet/polyfill/worker.d.cts +1 -0
  207. package/dist/testnet/polyfill/xmlhttprequest.d.cts +1 -0
  208. package/dist/testnet/program-manager.d.cts +1588 -0
  209. package/dist/testnet/record-provider.d.cts +274 -0
  210. package/dist/testnet/record-scanner.d.cts +371 -0
  211. package/dist/testnet/record-scanner.d.ts +9 -6
  212. package/dist/testnet/security.d.cts +62 -0
  213. package/dist/testnet/security.d.ts +5 -5
  214. package/dist/testnet/utils.d.cts +23 -0
  215. package/dist/testnet/utils.d.ts +10 -2
  216. package/dist/testnet/wasm.d.cts +1 -0
  217. package/package.json +51 -9
@@ -0,0 +1,1588 @@
1
+ import { Account } from "./account.js";
2
+ import { AleoNetworkClient, AleoNetworkClientOptions, ProgramImports } from "./network-client.js";
3
+ import { ImportedPrograms, ImportedVerifyingKeys } from "./models/imports.js";
4
+ import { RecordProvider } from "./record-provider.js";
5
+ import { RecordSearchParams } from "./models/record-provider/recordSearchParams.js";
6
+ import { FunctionKeyProvider, KeySearchParams } from "./keys/provider/interface.js";
7
+ import { FunctionKeyPair } from "./models/keyPair.js";
8
+ import { Authorization, ExecutionRequest, ExecutionResponse, OfflineQuery, RecordPlaintext, PrivateKey, Program, ProvingKey, ProvingRequest, VerifyingKey, Transaction } from "./wasm.js";
9
+ import { ExternalSigningOptions } from "./models/external-signing.js";
10
+ /**
11
+ * Represents the options for deploying and upgrading a transaction in the Aleo network.
12
+ * This interface is used to specify the parameters required for building and submitting an deployment transaction.
13
+ *
14
+ * @property {string} program - The program source code to be deployed.
15
+ * @property {number} priorityFee - The priority fee to be paid for the transaction.
16
+ * @property {boolean} privateFee - If true, uses a private record to pay the fee; otherwise, uses the account's public credit balance.
17
+ * @property {RecordSearchParams} [recordSearchParams] - Parameters for searching for a record to pay the execution transaction fee.
18
+ * @property {string | RecordPlaintext} [feeRecord] - Fee record to use for the transaction.
19
+ * @property {PrivateKey} [privateKey] - Private key to use for the transaction.
20
+ */
21
+ interface DeployOptions {
22
+ program: string;
23
+ priorityFee: number;
24
+ privateFee: boolean;
25
+ recordSearchParams?: RecordSearchParams;
26
+ feeRecord?: string | RecordPlaintext;
27
+ privateKey?: PrivateKey;
28
+ }
29
+ /**
30
+ * Represents the options for executing a transaction in the Aleo network.
31
+ * This interface is used to specify the parameters required for building and submitting an execution transaction.
32
+ *
33
+ * @property {string} programName - The name of the program containing the function to be executed.
34
+ * @property {string} functionName - The name of the function to execute within the program.
35
+ * @property {number} priorityFee - The priority fee to be paid for the transaction.
36
+ * @property {boolean} privateFee - If true, uses a private record to pay the fee; otherwise, uses the account's public credit balance.
37
+ * @property {string[]} inputs - The inputs to the function being executed.
38
+ * @property {RecordSearchParams} [recordSearchParams] - Parameters for searching for a record to pay the execution transaction fee.
39
+ * @property {KeySearchParams} [keySearchParams] - Parameters for finding the matching proving & verifying keys for the function.
40
+ * @property {string | RecordPlaintext} [feeRecord] - Fee record to use for the transaction.
41
+ * @property {ProvingKey} [provingKey] - Proving key to use for the transaction.
42
+ * @property {VerifyingKey} [verifyingKey] - Verifying key to use for the transaction.
43
+ * @property {PrivateKey} [privateKey] - Private key to use for the transaction.
44
+ * @property {OfflineQuery} [offlineQuery] - Offline query if creating transactions in an offline environment.
45
+ * @property {string | Program} [program] - Program source code to use for the transaction.
46
+ * @property {ProgramImports} [imports] - Programs that the program being executed imports.
47
+ * @property {number} [edition] - Edition of the program to execute the function in.
48
+ */
49
+ interface ExecuteOptions {
50
+ programName: string;
51
+ functionName: string;
52
+ priorityFee: number;
53
+ privateFee: boolean;
54
+ inputs: string[];
55
+ recordSearchParams?: RecordSearchParams;
56
+ keySearchParams?: KeySearchParams;
57
+ feeRecord?: string | RecordPlaintext;
58
+ provingKey?: ProvingKey;
59
+ verifyingKey?: VerifyingKey;
60
+ privateKey?: PrivateKey;
61
+ offlineQuery?: OfflineQuery;
62
+ program?: string | Program;
63
+ imports?: ProgramImports;
64
+ edition?: number;
65
+ }
66
+ /**
67
+ * Options for building an Authorization for a function.
68
+ *
69
+ * @property {string} programName Name of the program containing the function to build the authorization for.
70
+ * @property {string} functionName Name of the function name to build the authorization for.
71
+ * @property {string[]} inputs The inputs to the function.
72
+ * @property {string | Program} [programSource] The optional source code for the program to build an execution for.
73
+ * @property {PrivateKey} [privateKey] Optional private key to use to build the authorization.
74
+ * @property {ProgramImports} [programImports] The other programs the program imports.
75
+ * @property {edition} [edition]
76
+ */
77
+ interface AuthorizationOptions {
78
+ programName: string;
79
+ functionName: string;
80
+ inputs: string[];
81
+ programSource?: string | Program;
82
+ privateKey?: PrivateKey;
83
+ programImports?: ProgramImports;
84
+ edition?: number;
85
+ }
86
+ /**
87
+ * Options for executing a fee authorization.
88
+ *
89
+ * @property {string} deploymentOrExecutionId The id of a previously built Execution or Authorization.
90
+ * @property {number} baseFeeCredits The number of Aleo Credits to pay for the base fee.
91
+ * @property {number} [priorityFeeCredits] The number of Aleo Credits to pay for the priority fee.
92
+ * @property {PrivateKey} [privateKey] Optional private key to specify for the authorization.
93
+ * @property {RecordPlaintext} [feeRecord] A record to specify to pay the private fee. If this is specified a `fee_private` authorization will be built.
94
+ */
95
+ interface FeeAuthorizationOptions {
96
+ deploymentOrExecutionId: string;
97
+ baseFeeCredits: number;
98
+ priorityFeeCredits?: number;
99
+ privateKey?: PrivateKey;
100
+ feeRecord?: RecordPlaintext;
101
+ }
102
+ /**
103
+ * Represents the options for executing a transaction on the Aleo Network from an authorization.
104
+ *
105
+ * @property {string} programName - The name of the program containing the function to be executed.
106
+ * @property {KeySearchParams} [keySearchParams] - Optional parameters for finding the matching proving & verifying keys for the function.
107
+ * @property {ProvingKey} [provingKey] - Optional proving key to use for the transaction.
108
+ * @property {VerifyingKey} [verifyingKey] - Optional verifying key to use for the transaction.
109
+ * @property {OfflineQuery} [offlineQuery] - Optional offline query if creating transactions in an offline environment.
110
+ * @property {string | Program} [program] - Optional program source code to use for the transaction.
111
+ * @property {ProgramImports} [imports] - Optional programs that the program being executed imports.
112
+ */
113
+ interface ExecuteAuthorizationOptions {
114
+ programName: string;
115
+ authorization: Authorization;
116
+ feeAuthorization?: Authorization;
117
+ keySearchParams?: KeySearchParams;
118
+ provingKey?: ProvingKey;
119
+ verifyingKey?: VerifyingKey;
120
+ offlineQuery?: OfflineQuery;
121
+ program?: string | Program;
122
+ imports?: ProgramImports;
123
+ }
124
+ /**
125
+ * Represents the options for executing a transaction in the Aleo network.
126
+ * This interface is used to specify the parameters required for building and submitting an execution transaction.
127
+ *
128
+ * @property {string} programName - The name of the program containing the function to be executed.
129
+ * @property {string} functionName - The name of the function to execute within the program.
130
+ * @property {number} [baseFee] - The base fee to be paid for the transaction.
131
+ * @deprecated Base fee is now estimated automatically; this option is ignored and will be removed in a future version.
132
+ * @property {number} priorityFee - The optional priority fee to be paid for the transaction.
133
+ * @property {boolean} privateFee - If true, uses a private record to pay the fee; otherwise, uses the account's public credit balance.
134
+ * @property {string[]} inputs - The inputs to the function being executed.
135
+ * @property {RecordSearchParams} [recordSearchParams] - Optional parameters for searching for a record to pay the execution transaction fee.
136
+ * @property {string | RecordPlaintext} [feeRecord] - Optional fee record to use for the transaction.
137
+ * @property {PrivateKey} [privateKey] - Optional private key to use for the transaction.
138
+ * @property {string | Program} [program] - Optional program source code to use for the transaction.
139
+ * @property {string} uri - The URI send the ProvingRequest to.
140
+ * @property {ProgramImports} [imports] - Optional programs that the program being executed imports.
141
+ * @property {boolean} broadcast - Whether to broadcast the Transaction generated by the remove prover to the Aleo network.
142
+ * @property {boolean} unchecked - Whether to execute the transaction without checking the validity of the authorization (faster but may fail).
143
+ * @property {number} [edition] - Edition of the program to execute the function in.
144
+ * @property {boolean} [useFeeMaster] - Whether to use the FeeMaster account to execute the transaction.
145
+ */
146
+ interface ProvingRequestOptions {
147
+ programName: string;
148
+ functionName: string;
149
+ priorityFee: number;
150
+ privateFee: boolean;
151
+ inputs?: string[];
152
+ baseFee?: number;
153
+ recordSearchParams?: RecordSearchParams;
154
+ feeRecord?: string | RecordPlaintext;
155
+ privateKey?: PrivateKey;
156
+ programSource?: string | Program;
157
+ programImports?: ProgramImports;
158
+ broadcast?: boolean;
159
+ unchecked?: boolean;
160
+ edition?: number;
161
+ useFeeMaster?: boolean;
162
+ executionRequest?: ExecutionRequest;
163
+ }
164
+ /**
165
+ * Fee estimate options.
166
+ *
167
+ * @property {string} programName - The name of the program containing the function to estimate the fee for.
168
+ * @property {string} functionName - The name of the function to execute within the program to estimate the fee for.
169
+ * @property {string} [program] - Program source code to use for the fee estimate.
170
+ * @property {ProgramImports} [imports] - Programs that the program imports.
171
+ * @property {number} [edition] - Edition of the program to estimate the fee for.
172
+ * @property {Authorization} authorization - An authorization to estimate the fee for.
173
+ */
174
+ interface FeeEstimateOptions {
175
+ programName: string;
176
+ functionName?: string;
177
+ program?: string | Program;
178
+ imports?: ProgramImports;
179
+ edition?: number;
180
+ authorization?: Authorization;
181
+ }
182
+ /**
183
+ * Options for verifying a single Aleo zkSnark proof.
184
+ *
185
+ * @property {string} verifyingKey - The verifying key string for the circuit
186
+ * @property {string[]} inputs - Array of public input strings — either field elements (e.g. "1field") or Aleo types (e.g. "1u32", "{ x: 1u8 }")
187
+ * @property {string} proof - The proof string to verify
188
+ */
189
+ interface VerificationOptions {
190
+ verifyingKey: string;
191
+ inputs: string[];
192
+ proof: string;
193
+ }
194
+ /**
195
+ * Options for verifying a batch Aleo zkSnark proof.
196
+ *
197
+ * @property {string[]} verifyingKeys - Array of verifying key strings, one per circuit
198
+ * @property {string[][][]} inputs - 3D array of input strings [circuit_idx][instance_idx][input_idx]
199
+ * @property {string} proof - The batch proof string to verify
200
+ */
201
+ interface BatchVerificationOptions {
202
+ verifyingKeys: string[];
203
+ inputs: string[][][];
204
+ proof: string;
205
+ }
206
+ /**
207
+ * The ProgramManager class is used to execute and deploy programs on the Aleo network and create value transfers.
208
+ */
209
+ declare class ProgramManager {
210
+ account: Account | undefined;
211
+ keyProvider: FunctionKeyProvider;
212
+ host: string;
213
+ networkClient: AleoNetworkClient;
214
+ recordProvider: RecordProvider | undefined;
215
+ inclusionKeysLoaded: boolean;
216
+ /** Create a new instance of the ProgramManager
217
+ *
218
+ * @param { string | undefined } host A host uri running the official Aleo API
219
+ * @param { FunctionKeyProvider | undefined } keyProvider A key provider that implements {@link FunctionKeyProvider} interface
220
+ * @param { RecordProvider | undefined } recordProvider A record provider that implements {@link RecordProvider} interface
221
+ */
222
+ constructor(host?: string | undefined, keyProvider?: FunctionKeyProvider | undefined, recordProvider?: RecordProvider | undefined, networkClientOptions?: AleoNetworkClientOptions | undefined);
223
+ /**
224
+ * Check if the fee is sufficient to pay for the transaction
225
+ */
226
+ checkFee(address: string, feeAmount: bigint): Promise<void>;
227
+ /**
228
+ * Set the account to use for transaction submission to the Aleo network
229
+ *
230
+ * @param {Account} account Account to use for transaction submission
231
+ */
232
+ setAccount(account: Account): void;
233
+ /**
234
+ * Set the key provider that provides the proving and verifying keys for programs
235
+ *
236
+ * @param {FunctionKeyProvider} keyProvider
237
+ */
238
+ setKeyProvider(keyProvider: FunctionKeyProvider): void;
239
+ /**
240
+ * Set the host peer to use for transaction submission to the Aleo network
241
+ *
242
+ * @param host {string} Peer url to use for transaction submission
243
+ */
244
+ setHost(host: string): void;
245
+ /**
246
+ * Set the record provider that provides records for transactions
247
+ *
248
+ * @param {RecordProvider} recordProvider
249
+ */
250
+ setRecordProvider(recordProvider: RecordProvider): void;
251
+ /**
252
+ * Set a header in the `AleoNetworkClient`s header map
253
+ *
254
+ * @param {string} headerName The name of the header to set
255
+ * @param {string} value The header value
256
+ *
257
+ * @example
258
+ * import { ProgramManager } from "@provablehq/sdk/mainnet.js";
259
+ *
260
+ * // Create a ProgramManager
261
+ * const programManager = new ProgramManager("https://api.provable.com/v2");
262
+ *
263
+ * // Set the value of the `Accept-Language` header to `en-US`
264
+ * programManager.setHeader('Accept-Language', 'en-US');
265
+ */
266
+ setHeader(headerName: string, value: string): void;
267
+ /**
268
+ * Set the inclusion prover into the wasm memory. This should be done prior to any execution of a function with a
269
+ * private record.
270
+ *
271
+ * @param {ProvingKey} [provingKey]
272
+ *
273
+ * @example
274
+ * import { ProgramManager, AleoKeyProvider } from "@provablehq/sdk/mainnet.js";
275
+ *
276
+ * const keyProvider = new AleoKeyProvider();
277
+ * keyProvider.useCache(true);
278
+ *
279
+ * // Create a ProgramManager
280
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider);
281
+ *
282
+ * // Set the inclusion keys.
283
+ * programManager.setInclusionProver();
284
+ */
285
+ setInclusionProver(provingKey?: ProvingKey): Promise<void>;
286
+ /**
287
+ * Remove a header from the `AleoNetworkClient`s header map
288
+ *
289
+ * @param {string} headerName The name of the header to be removed
290
+ *
291
+ * @example
292
+ * import { ProgramManager } from "@provablehq/sdk/mainnet.js";
293
+ *
294
+ * // Create a ProgramManager
295
+ * const programManager = new ProgramManager("https://api.provable.com/v2");
296
+ *
297
+ * // Remove the default `X-Aleo-SDK-Version` header
298
+ * programManager.removeHeader('X-Aleo-SDK-Version');
299
+ */
300
+ removeHeader(headerName: string): void;
301
+ /**
302
+ * Builds a deployment transaction for submission to the Aleo network.
303
+ *
304
+ * @param {string} program Program source code
305
+ * @param {number} priorityFee The optional priority fee to be paid for that transaction.
306
+ * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
307
+ * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for searching for a record to use pay the deployment fee
308
+ * @param {string | RecordPlaintext | undefined} feeRecord Optional Fee record to use for the transaction
309
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
310
+ * @returns {string} The transaction id of the deployed program or a failure message from the network
311
+ *
312
+ * @example
313
+ * /// Import the mainnet version of the sdk.
314
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
315
+ *
316
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
317
+ * const keyProvider = new AleoKeyProvider();
318
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
319
+ * keyProvider.useCache(true);
320
+ *
321
+ * // Initialize a program manager with the key provider to automatically fetch keys for deployments
322
+ * 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";
323
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
324
+ * programManager.setAccount(Account);
325
+ *
326
+ * // Define a fee in credits
327
+ * const priorityFee = 0.0;
328
+ *
329
+ * // Create the deployment transaction.
330
+ * const tx = await programManager.buildDeploymentTransaction(program, fee, false);
331
+ * await programManager.networkClient.submitTransaction(tx);
332
+ *
333
+ * // Verify the transaction was successful
334
+ * setTimeout(async () => {
335
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
336
+ * assert(transaction.id() === tx.id());
337
+ * }, 20000);
338
+ */
339
+ buildDeploymentTransaction(program: string, priorityFee: number, privateFee: boolean, recordSearchParams?: RecordSearchParams, feeRecord?: string | RecordPlaintext, privateKey?: PrivateKey): Promise<Transaction>;
340
+ /**
341
+ * Builds a deployment transaction for submission to the Aleo network that upgrades an existing program.
342
+ *
343
+ * @param {DeployOptions} options The deployment options.
344
+ *
345
+ * @example
346
+ * /// Import the mainnet version of the sdk.
347
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
348
+ *
349
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
350
+ * const keyProvider = new AleoKeyProvider();
351
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
352
+ * keyProvider.useCache(true);
353
+ *
354
+ * // Initialize a program manager with the key provider to automatically fetch keys for deployments
355
+ * 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";
356
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
357
+ * programManager.setAccount(Account);
358
+ *
359
+ * // Define a fee in credits
360
+ * const priorityFee = 0.0;
361
+ *
362
+ * // Create the deployment transaction.
363
+ * const tx = await programManager.buildUpgradeTransaction({program: program, priorityFee: fee, privateFee: false});
364
+ * await programManager.networkClient.submitTransaction(tx);
365
+ *
366
+ * // Verify the transaction was successful
367
+ * setTimeout(async () => {
368
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
369
+ * assert(transaction.id() === tx.id());
370
+ * }, 20000);
371
+ */
372
+ buildUpgradeTransaction(options: DeployOptions): Promise<Transaction>;
373
+ /**
374
+ * Deploy an Aleo program to the Aleo network
375
+ *
376
+ * @param {string} program Program source code
377
+ * @param {number} priorityFee The optional fee to be paid for the transaction
378
+ * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
379
+ * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for searching for a record to used pay the deployment fee
380
+ * @param {string | RecordPlaintext | undefined} feeRecord Optional Fee record to use for the transaction
381
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
382
+ * @returns {string} The transaction id of the deployed program or a failure message from the network
383
+ *
384
+ * @example
385
+ * /// Import the mainnet version of the sdk.
386
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
387
+ *
388
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider.
389
+ * const keyProvider = new AleoKeyProvider();
390
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
391
+ * keyProvider.useCache(true);
392
+ *
393
+ * // Initialize a program manager with the key provider to automatically fetch keys for deployments
394
+ * 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";
395
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
396
+ *
397
+ * // Define a fee in credits
398
+ * const priorityFee = 0.0;
399
+ *
400
+ * // Deploy the program
401
+ * const tx_id = await programManager.deploy(program, fee, false);
402
+ *
403
+ * // Verify the transaction was successful
404
+ * setTimeout(async () => {
405
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
406
+ * assert(transaction.id() === tx_id);
407
+ * }, 20000);
408
+ */
409
+ deploy(program: string, priorityFee: number, privateFee: boolean, recordSearchParams?: RecordSearchParams, feeRecord?: string | RecordPlaintext, privateKey?: PrivateKey): Promise<string>;
410
+ /**
411
+ * Builds an execution transaction for submission to the Aleo network.
412
+ *
413
+ * @param {ExecuteOptions} options - The options for the execution transaction.
414
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
415
+ *
416
+ * @example
417
+ * /// Import the mainnet version of the sdk.
418
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
419
+ *
420
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider.
421
+ * const keyProvider = new AleoKeyProvider();
422
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
423
+ * keyProvider.useCache(true);
424
+ *
425
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
426
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
427
+ *
428
+ * // Build and execute the transaction
429
+ * const tx = await programManager.buildExecutionTransaction({
430
+ * programName: "hello_hello.aleo",
431
+ * functionName: "hello_hello",
432
+ * priorityFee: 0.0,
433
+ * privateFee: false,
434
+ * inputs: ["5u32", "5u32"],
435
+ * keySearchParams: { "cacheKey": "hello_hello:hello" }
436
+ * });
437
+ *
438
+ * // Submit the transaction to the network
439
+ * await programManager.networkClient.submitTransaction(tx.toString());
440
+ *
441
+ * // Verify the transaction was successful
442
+ * setTimeout(async () => {
443
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
444
+ * assert(transaction.id() === tx.id());
445
+ * }, 10000);
446
+ */
447
+ buildExecutionTransaction(options: ExecuteOptions): Promise<Transaction>;
448
+ /**
449
+ * Builds an execution transaction for submission to the Aleo network from an Authorization and Fee Authorization.
450
+ * This method is helpful if signing and authorization needs to be done in a secure environment separate from where
451
+ * transactions are built.
452
+ *
453
+ * @param {ExecuteAuthorizationOptions} options - The options for executing the authorizations.
454
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
455
+ *
456
+ * @example
457
+ * import { AleoKeyProvider, PrivateKey, initThreadPool, ProgramManager } from "@provablehq/sdk";
458
+ *
459
+ * await initThreadPool();
460
+ *
461
+ * // Create a new KeyProvider.
462
+ * const keyProvider = new AleoKeyProvider();
463
+ * keyProvider.useCache(true);
464
+ *
465
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions.
466
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider);
467
+ *
468
+ * // Build the `Authorization`.
469
+ * const privateKey = new PrivateKey(); // Change this to a private key that has an aleo credit balance.
470
+ * const authorization = await programManager.buildAuthorization({
471
+ * programName: "credits.aleo",
472
+ * functionName: "transfer_public",
473
+ * privateKey,
474
+ * inputs: [
475
+ * "aleo1vwls2ete8dk8uu2kmkmzumd7q38fvshrht8hlc0a5362uq8ftgyqnm3w08",
476
+ * "10000000u64",
477
+ * ],
478
+ * });
479
+ *
480
+ * console.log("Getting execution id");
481
+ *
482
+ * // Derive the execution ID and base fee.
483
+ * const executionId = authorization.toExecutionId().toString();
484
+ *
485
+ * console.log("Estimating fee");
486
+ *
487
+ * // Get the base fee in microcredits.
488
+ * const baseFeeMicrocredits = await programManager.estimateFeeForAuthorization(authorization, "credits.aleo");
489
+ * const baseFeeCredits = Number(baseFeeMicrocredits)/1000000;
490
+ *
491
+ * console.log("Building fee authorization");
492
+ *
493
+ * // Build a credits.aleo/fee_public `Authorization`.
494
+ * const feeAuthorization = await programManager.buildFeeAuthorization({
495
+ * deploymentOrExecutionId: executionId,
496
+ * baseFeeCredits,
497
+ * privateKey
498
+ * });
499
+ *
500
+ * console.log("Executing authorizations");
501
+ *
502
+ * // Build and execute the transaction.
503
+ * const tx = await programManager.buildTransactionFromAuthorization({
504
+ * programName: "credits.aleo",
505
+ * authorization,
506
+ * feeAuthorization,
507
+ * });
508
+ *
509
+ * // Submit the transaction to the network.
510
+ * await programManager.networkClient.submitTransaction(tx.toString());
511
+ *
512
+ * // Verify the transaction was successful.
513
+ * setTimeout(async () => {
514
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
515
+ * console.log(transaction);
516
+ * }, 10000);
517
+ */
518
+ buildTransactionFromAuthorization(options: ExecuteAuthorizationOptions): Promise<Transaction>;
519
+ /**
520
+ * Builds a SnarkVM `Authorization` for a specific function.
521
+ *
522
+ * @param {AuthorizationOptions} options - The options for building the `Authorization`
523
+ * @returns {Promise<Authorization>} - A promise that resolves to an `Authorization` or throws an Error.
524
+ *
525
+ * @example
526
+ * /// Import the mainnet version of the sdk.
527
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
528
+ *
529
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider.
530
+ * const keyProvider = new AleoKeyProvider();
531
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
532
+ * keyProvider.useCache(true);
533
+ *
534
+ * // Initialize a ProgramManager with the key and record providers.
535
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
536
+ *
537
+ * // Build the `Authorization`.
538
+ * const authorization = await programManager.buildAuthorization({
539
+ * programName: "credits.aleo",
540
+ * functionName: "transfer_public",
541
+ * inputs: [
542
+ * "aleo1vwls2ete8dk8uu2kmkmzumd7q38fvshrht8hlc0a5362uq8ftgyqnm3w08",
543
+ * "10000000u64",
544
+ * ],
545
+ * });
546
+ */
547
+ buildAuthorization(options: AuthorizationOptions): Promise<Authorization>;
548
+ /**
549
+ * Builds a SnarkVM `Authorization` for a specific function without building a circuit first. This should be used when fast authorization generation is needed and the invoker is confident inputs are coorect.
550
+ *
551
+ * @param {AuthorizationOptions} options - The options for building the `Authorization`
552
+ * @returns {Promise<Authorization>} - A promise that resolves to an `Authorization` or throws an Error.
553
+ *
554
+ * @example
555
+ * /// Import the mainnet version of the sdk.
556
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
557
+ *
558
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider.
559
+ * const keyProvider = new AleoKeyProvider();
560
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
561
+ * keyProvider.useCache(true);
562
+ *
563
+ * // Initialize a ProgramManager with the key and record providers.
564
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
565
+ *
566
+ * // Build the unchecked `Authorization`.
567
+ * const authorization = await programManager.buildAuthorizationUnchecked({
568
+ * programName: "credits.aleo",
569
+ * functionName: "transfer_public",
570
+ * inputs: [
571
+ * "aleo1vwls2ete8dk8uu2kmkmzumd7q38fvshrht8hlc0a5362uq8ftgyqnm3w08",
572
+ * "10000000u64",
573
+ * ],
574
+ * });
575
+ */
576
+ buildAuthorizationUnchecked(options: AuthorizationOptions): Promise<Authorization>;
577
+ /**
578
+ * Builds a `ProvingRequest` for submission to a prover for execution. If building a proving request with an ExecutionRequest, a private key must be explicitly provided.
579
+ *
580
+ * @param {ProvingRequestOptions} options - The options for building the proving request
581
+ * @returns {Promise<ProvingRequest>} - A promise that resolves to the transaction or an error.
582
+ *
583
+ * @example
584
+ * /// Import the mainnet version of the sdk.
585
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
586
+ *
587
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider.
588
+ * const keyProvider = new AleoKeyProvider();
589
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
590
+ * keyProvider.useCache(true);
591
+ *
592
+ * // Initialize a ProgramManager with the key and record providers.
593
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
594
+ *
595
+ * // Build the proving request.
596
+ * const provingRequest = await programManager.provingRequest({
597
+ * programName: "credits.aleo",
598
+ * functionName: "transfer_public",
599
+ * priorityFee: 0,
600
+ * privateFee: false,
601
+ * inputs: [
602
+ * "aleo1vwls2ete8dk8uu2kmkmzumd7q38fvshrht8hlc0a5362uq8ftgyqnm3w08",
603
+ * "10000000u64",
604
+ * ],
605
+ * broadcast: false,
606
+ * });
607
+ */
608
+ provingRequest(options: ProvingRequestOptions): Promise<ProvingRequest>;
609
+ /**
610
+ * 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.
611
+ *
612
+ * @param {FeeAuthorizationOptions} options - The options for building the `Authorization`.
613
+ * @returns {Promise<Authorization>} - A promise that resolves to an `Authorization` or throws an Error.
614
+ *
615
+ * @example
616
+ * /// Import the mainnet version of the sdk.
617
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
618
+ *
619
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider.
620
+ * const keyProvider = new AleoKeyProvider();
621
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
622
+ * keyProvider.useCache(true);
623
+ *
624
+ * // Initialize a ProgramManager with the key and record providers.
625
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
626
+ *
627
+ * // Build a credits.aleo/fee_public `Authorization`.
628
+ * const feePublicAuthorization = await programManager.buildFeeAuthorization({
629
+ * deploymentOrExecutionId: "2423957656946557501636078245035919227529640894159332581642187482178647335171field",
630
+ * baseFeeCredits: 0.1,
631
+ * });
632
+ *
633
+ * // Build a credits.aleo/fee_private `Authorization`.
634
+ * const record = "{ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private, microcredits: 1500000000000000u64.private, _nonce: 3077450429259593211617823051143573281856129402760267155982965992208217472983group.public }";
635
+ * const feePrivateAuthorization = await programManager.buildFeeAuthorization({
636
+ * deploymentOrExecutionId: "2423957656946557501636078245035919227529640894159332581642187482178647335171field",
637
+ * baseFeeCredits: 0.1,
638
+ * feeRecord: record,
639
+ * });
640
+ */
641
+ buildFeeAuthorization(options: FeeAuthorizationOptions): Promise<Authorization>;
642
+ /**
643
+ * Builds an execution transaction for submission to the Aleo network.
644
+ *
645
+ * @param {ExecuteOptions} options - The options for the execution transaction.
646
+ * @returns {Promise<string>} - The transaction id
647
+ *
648
+ * @example
649
+ * /// Import the mainnet version of the sdk.
650
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
651
+ *
652
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
653
+ * const keyProvider = new AleoKeyProvider();
654
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
655
+ * keyProvider.useCache(true);
656
+ *
657
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
658
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
659
+ *
660
+ * // Build and execute the transaction
661
+ * const tx_id = await programManager.execute({
662
+ * programName: "hello_hello.aleo",
663
+ * functionName: "hello_hello",
664
+ * priorityFee: 0.0,
665
+ * privateFee: false,
666
+ * inputs: ["5u32", "5u32"],
667
+ * keySearchParams: { "cacheKey": "hello_hello:hello" }
668
+ * });
669
+ *
670
+ * // Verify the transaction was successful
671
+ * setTimeout(async () => {
672
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
673
+ * assert(transaction.id() === tx_id);
674
+ * }, 10000);
675
+ */
676
+ execute(options: ExecuteOptions): Promise<string>;
677
+ /**
678
+ * Prepares user-provided inputs for a function call by auto-converting bare
679
+ * string identifiers to field elements where the function signature expects
680
+ * a `field` type. This lets callers of dynamic-dispatch programs pass
681
+ * human-readable strings (e.g. `"my_program"`) instead of requiring
682
+ * `stringToField("my_program").toString()`.
683
+ *
684
+ * Inputs that already look like a numeric field literal (matching
685
+ * `/^\d+field$/` after trimming whitespace) are left untouched. Non-field
686
+ * inputs are returned as-is. If introspection fails for any reason the
687
+ * original inputs are returned unchanged.
688
+ *
689
+ * @param {string | Program} programSource - The program source code or Program object
690
+ * @param {string} functionName - The function to inspect
691
+ * @param {string[]} inputs - The raw user-provided inputs
692
+ * @returns {string[]} The (possibly converted) inputs
693
+ */
694
+ prepareInputs(programSource: string | Program, functionName: string, inputs: string[]): string[];
695
+ /**
696
+ * Run an Aleo program in offline mode
697
+ *
698
+ * @param {string} program Program source code containing the function to be executed
699
+ * @param {string} function_name Function name to execute
700
+ * @param {string[]} inputs Inputs to the function
701
+ * @param {number} proveExecution Whether to prove the execution of the function and return an execution transcript that contains the proof.
702
+ * @param {string[] | undefined} imports Optional imports to the program
703
+ * @param {KeySearchParams | undefined} keySearchParams Optional parameters for finding the matching proving & verifying keys for the function
704
+ * @param {ProvingKey | undefined} provingKey Optional proving key to use for the transaction
705
+ * @param {VerifyingKey | undefined} verifyingKey Optional verifying key to use for the transaction
706
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
707
+ * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
708
+ * @returns {Promise<ExecutionResponse>} The execution response containing the outputs of the function and the proof if the program is proved.
709
+ *
710
+ * @example
711
+ * /// Import the mainnet version of the sdk used to build executions.
712
+ * import { Account, ProgramManager } from "@provablehq/sdk/mainnet.js";
713
+ *
714
+ * /// Create the source for the "helloworld" program
715
+ * 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";
716
+ * const programManager = new ProgramManager(undefined, undefined, undefined);
717
+ *
718
+ * /// Create a temporary account for the execution of the program
719
+ * const account = new Account();
720
+ * programManager.setAccount(account);
721
+ *
722
+ * /// Get the response and ensure that the program executed correctly
723
+ * const executionResponse = await programManager.run(program, "hello", ["5u32", "5u32"]);
724
+ * const result = executionResponse.getOutputs();
725
+ * assert(result === ["10u32"]);
726
+ */
727
+ run(program: string, function_name: string, inputs: string[], proveExecution: boolean, imports?: ProgramImports, keySearchParams?: KeySearchParams, provingKey?: ProvingKey, verifyingKey?: VerifyingKey, privateKey?: PrivateKey, offlineQuery?: OfflineQuery, edition?: number): Promise<ExecutionResponse>;
728
+ /**
729
+ * Join two credits records into a single credits record
730
+ *
731
+ * @param {RecordPlaintext | string} recordOne First credits record to join
732
+ * @param {RecordPlaintext | string} recordTwo Second credits record to join
733
+ * @param {number} priorityFee The optional priority fee to be paid for the transaction
734
+ * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
735
+ * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the fee record to use to pay the fee for the join transaction
736
+ * @param {RecordPlaintext | string | undefined} feeRecord Fee record to use for the join transaction
737
+ * @param {PrivateKey | undefined} privateKey Private key to use for the join transaction
738
+ * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
739
+ * @returns {Promise<string>} The transaction id
740
+ *
741
+ * @example
742
+ * /// Import the mainnet version of the sdk.
743
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
744
+ *
745
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
746
+ * const keyProvider = new AleoKeyProvider();
747
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
748
+ * keyProvider.useCache(true);
749
+ *
750
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
751
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
752
+ * const record_1 = "{ owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private, microcredits: 45000000u64.private, _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}"
753
+ * const record_2 = "{ owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private, microcredits: 45000000u64.private, _nonce: 1540945439182663264862696551825005342995406165131907382295858612069623286213group.public}"
754
+ * const tx_id = await programManager.join(record_1, record_2, 0.05, false);
755
+ *
756
+ * // Verify the transaction was successful
757
+ * setTimeout(async () => {
758
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
759
+ * assert(transaction.id() === tx_id);
760
+ * }, 10000);
761
+ */
762
+ join(recordOne: RecordPlaintext | string, recordTwo: RecordPlaintext | string, priorityFee: number, privateFee: boolean, recordSearchParams?: RecordSearchParams | undefined, feeRecord?: RecordPlaintext | string | undefined, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<string>;
763
+ /**
764
+ * Split credits into two new credits records
765
+ *
766
+ * @param {number} splitAmount Amount in microcredits to split from the original credits record
767
+ * @param {RecordPlaintext | string} amountRecord Amount record to use for the split transaction
768
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the split transaction
769
+ * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
770
+ * @returns {Promise<string>} The transaction id
771
+ *
772
+ * @example
773
+ * /// Import the mainnet version of the sdk.
774
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
775
+ *
776
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
777
+ * const keyProvider = new AleoKeyProvider();
778
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
779
+ * keyProvider.useCache(true);
780
+ *
781
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
782
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
783
+ * const record = "{ owner: aleo184vuwr5u7u0ha5f5k44067dd2uaqewxx6pe5ltha5pv99wvhfqxqv339h4.private, microcredits: 45000000u64.private, _nonce: 4106205762862305308495708971985748592380064201230396559307556388725936304984group.public}"
784
+ * const tx_id = await programManager.split(25000000, record);
785
+ *
786
+ * // Verify the transaction was successful
787
+ * setTimeout(async () => {
788
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
789
+ * assert(transaction.id() === tx_id);
790
+ * }, 10000);
791
+ */
792
+ split(splitAmount: number, amountRecord: RecordPlaintext | string, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<string>;
793
+ /**
794
+ * Pre-synthesize proving and verifying keys for a program
795
+ *
796
+ * @param program {string} The program source code to synthesize keys for
797
+ * @param function_id {string} The function id to synthesize keys for
798
+ * @param inputs {Array<string>} Sample inputs to the function
799
+ * @param privateKey {PrivateKey | undefined} Optional private key to use for the key synthesis
800
+ *
801
+ * @returns {Promise<FunctionKeyPair>}
802
+ */
803
+ synthesizeKeys(program: string, function_id: string, inputs: Array<string>, privateKey?: PrivateKey): Promise<FunctionKeyPair>;
804
+ /**
805
+ * Build a transaction to transfer credits to another account for later submission to the Aleo network
806
+ *
807
+ * @param {number} amount The amount of credits to transfer
808
+ * @param {string} recipient The recipient of the transfer
809
+ * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
810
+ * @param {number} priorityFee The optional priority fee to be paid for the transaction
811
+ * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
812
+ * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee records for the transfer transaction
813
+ * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer
814
+ * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
815
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
816
+ * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
817
+ * @returns {Promise<Transaction>} The transaction object
818
+ *
819
+ * @example
820
+ * /// Import the mainnet version of the sdk.
821
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
822
+ *
823
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
824
+ * const keyProvider = new AleoKeyProvider();
825
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
826
+ * keyProvider.useCache(true);
827
+ *
828
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
829
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
830
+ * const tx = await programManager.buildTransferTransaction(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "public", 0.2, false);
831
+ * await programManager.networkClient.submitTransaction(tx.toString());
832
+ *
833
+ * // Verify the transaction was successful
834
+ * setTimeout(async () => {
835
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
836
+ * assert(transaction.id() === tx.id());
837
+ * }, 10000);
838
+ */
839
+ buildTransferTransaction(amount: number, recipient: string, transferType: string, priorityFee: number, privateFee: boolean, recordSearchParams?: RecordSearchParams, amountRecord?: RecordPlaintext | string, feeRecord?: RecordPlaintext | string, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<Transaction>;
840
+ /**
841
+ * Build a transfer_public transaction to transfer credits to another account for later submission to the Aleo network
842
+ *
843
+ * @param {number} amount The amount of credits to transfer
844
+ * @param {string} recipient The recipient of the transfer
845
+ * @param {number} priorityFee The optional priority fee to be paid for the transfer
846
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
847
+ * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
848
+ * @returns {Promise<Transaction>} The transaction object
849
+ *
850
+ * @example
851
+ * /// Import the mainnet version of the sdk.
852
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
853
+ *
854
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
855
+ * const keyProvider = new AleoKeyProvider();
856
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
857
+ * keyProvider.useCache(true);
858
+ *
859
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
860
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
861
+ * const tx = await programManager.buildTransferPublicTransaction(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", 0.2);
862
+ * await programManager.networkClient.submitTransaction(tx.toString());
863
+ *
864
+ * // Verify the transaction was successful
865
+ * setTimeout(async () => {
866
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
867
+ * assert(transaction.id() === tx.id());
868
+ * }, 10000);
869
+ */
870
+ buildTransferPublicTransaction(amount: number, recipient: string, priorityFee: number, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<Transaction>;
871
+ /**
872
+ * Build a transfer_public_as_signer transaction to transfer credits to another account for later submission to the Aleo network
873
+ *
874
+ * @param {number} amount The amount of credits to transfer
875
+ * @param {string} recipient The recipient of the transfer
876
+ * @param {number} priorityFee The optional priority fee to be paid for the transfer
877
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
878
+ * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
879
+ * @returns {Promise<Transaction>} The transaction object
880
+ *
881
+ * @example
882
+ * /// Import the mainnet version of the sdk.
883
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
884
+ *
885
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
886
+ * const keyProvider = new AleoKeyProvider();
887
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
888
+ * keyProvider.useCache(true);
889
+ *
890
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
891
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
892
+ * const tx = await programManager.buildTransferPublicAsSignerTransaction(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", 0.2);
893
+ * await programManager.networkClient.submitTransaction(tx.toString());
894
+ *
895
+ * // Verify the transaction was successful
896
+ * setTimeout(async () => {
897
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
898
+ * assert(transaction.id() === tx.id());
899
+ * }, 10000);
900
+ */
901
+ buildTransferPublicAsSignerTransaction(amount: number, recipient: string, priorityFee: number, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<Transaction>;
902
+ /**
903
+ * Transfer credits to another account
904
+ *
905
+ * @param {number} amount The amount of credits to transfer
906
+ * @param {string} recipient The recipient of the transfer
907
+ * @param {string} transferType The type of transfer to perform - options: 'private', 'privateToPublic', 'public', 'publicToPrivate'
908
+ * @param {number} priorityFee The optional priority fee to be paid for the transfer
909
+ * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
910
+ * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for finding the amount and fee records for the transfer transaction
911
+ * @param {RecordPlaintext | string} amountRecord Optional amount record to use for the transfer
912
+ * @param {RecordPlaintext | string} feeRecord Optional fee record to use for the transfer
913
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transfer transaction
914
+ * @param {OfflineQuery | undefined} offlineQuery Optional offline query if creating transactions in an offline environment
915
+ * @returns {Promise<string>} The transaction id
916
+ *
917
+ * @example
918
+ * /// Import the mainnet version of the sdk.
919
+ * import { AleoKeyProvider, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
920
+ *
921
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
922
+ * const keyProvider = new AleoKeyProvider();
923
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
924
+ * keyProvider.useCache(true);
925
+ *
926
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions
927
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
928
+ * const tx_id = await programManager.transfer(1, "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "public", 0.2, false);
929
+ *
930
+ * // Verify the transaction was successful
931
+ * setTimeout(async () => {
932
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
933
+ * assert(transaction.id() === tx_id);
934
+ * }, 10000);
935
+ */
936
+ transfer(amount: number, recipient: string, transferType: string, priorityFee: number, privateFee: boolean, recordSearchParams?: RecordSearchParams, amountRecord?: RecordPlaintext | string, feeRecord?: RecordPlaintext | string, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<string>;
937
+ /**
938
+ * Build transaction to bond credits to a validator for later submission to the Aleo Network
939
+ *
940
+ * @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.
941
+ * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
942
+ * @param {number} amount The amount of credits to bond
943
+ * @param {Partial<ExecuteOptions>} options - Override default execution options.
944
+ * @returns {Promise<Transaction>} The transaction object
945
+ *
946
+ * @example
947
+ * // Import the mainnet version of the sdk.
948
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
949
+ *
950
+ * // Create a keyProvider to handle key management
951
+ * const keyProvider = new AleoKeyProvider();
952
+ * keyProvider.useCache(true);
953
+ *
954
+ * // Create a new ProgramManager with the key that will be used to bond credits
955
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
956
+ * programManager.setAccount(new Account("YourPrivateKey"));
957
+ *
958
+ * // Create the bonding transaction object for later submission
959
+ * const tx = await programManager.buildBondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
960
+ *
961
+ * // The transaction can be later submitted to the network using the network client.
962
+ * await programManager.networkClient.submitTransaction(tx.toString());
963
+ *
964
+ * // Verify the transaction was successful
965
+ * setTimeout(async () => {
966
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
967
+ * assert(transaction.id() === tx.id());
968
+ * }, 10000);
969
+ */
970
+ buildBondPublicTransaction(validator_address: string, withdrawal_address: string, amount: number, options?: Partial<ExecuteOptions>): Promise<Transaction>;
971
+ /**
972
+ * Bond credits to validator.
973
+ *
974
+ * @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.
975
+ * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
976
+ * @param {number} amount The amount of credits to bond
977
+ * @param {Options} options Options for the execution
978
+ * @returns {Promise<string>} The transaction id
979
+ *
980
+ * @example
981
+ * // Import the mainnet version of the sdk.
982
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
983
+ *
984
+ * // Create a keyProvider to handle key management
985
+ * const keyProvider = new AleoKeyProvider();
986
+ * keyProvider.useCache(true);
987
+ *
988
+ * // Create a new ProgramManager with the key that will be used to bond credits
989
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
990
+ *
991
+ * // Create the bonding transaction
992
+ * tx_id = await programManager.bondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
993
+ *
994
+ * // Verify the transaction was successful
995
+ * setTimeout(async () => {
996
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
997
+ * assert(transaction.id() === tx_id);
998
+ * }, 10000);
999
+ */
1000
+ bondPublic(validator_address: string, withdrawal_address: string, amount: number, options?: Partial<ExecuteOptions>): Promise<string>;
1001
+ /**
1002
+ * Build a bond_validator transaction for later submission to the Aleo Network.
1003
+ *
1004
+ * @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.
1005
+ * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
1006
+ * @param {number} amount The amount of credits to bond. A minimum of 10000 credits is required to bond as a delegator.
1007
+ * @param {number} commission The commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
1008
+ * @param {Partial<ExecuteOptions>} options - Override default execution options.
1009
+ * @returns {Promise<Transaction>} The transaction object
1010
+ *
1011
+ * @example
1012
+ * // Import the mainnet version of the sdk.
1013
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1014
+ *
1015
+ * // Create a keyProvider to handle key management
1016
+ * const keyProvider = new AleoKeyProvider();
1017
+ * keyProvider.useCache(true);
1018
+ *
1019
+ * // Create a new ProgramManager with the key that will be used to bond credits
1020
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1021
+ * programManager.setAccount(new Account("YourPrivateKey"));
1022
+ *
1023
+ * // Create the bond validator transaction object for later use.
1024
+ * const tx = await programManager.buildBondValidatorTransaction("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
1025
+ *
1026
+ * // The transaction can later be submitted to the network using the network client.
1027
+ * const tx_id = await programManager.networkClient.submitTransaction(tx.toString());
1028
+ *
1029
+ * // Verify the transaction was successful
1030
+ * setTimeout(async () => {
1031
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
1032
+ * assert(transaction.id() === tx_id);
1033
+ * }, 10000);
1034
+ */
1035
+ buildBondValidatorTransaction(validator_address: string, withdrawal_address: string, amount: number, commission: number, options?: Partial<ExecuteOptions>): Promise<Transaction>;
1036
+ /**
1037
+ * Build transaction to bond a validator.
1038
+ *
1039
+ * @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.
1040
+ * @param {string} withdrawal_address Address to withdraw the staked credits to when unbond_public is called.
1041
+ * @param {number} amount The amount of credits to bond
1042
+ * @param {number} commission The commission rate for the validator (must be between 0 and 100 - an error will be thrown if it is not)
1043
+ * @param {Partial<ExecuteOptions>} options - Override default execution options.
1044
+ * @returns {Promise<string>} The transaction id
1045
+ *
1046
+ * @example
1047
+ * // Import the mainnet version of the sdk.
1048
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1049
+ *
1050
+ * // Create a keyProvider to handle key management
1051
+ * const keyProvider = new AleoKeyProvider();
1052
+ * keyProvider.useCache(true);
1053
+ *
1054
+ * // Create a new ProgramManager with the key that will be used to bond credits
1055
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1056
+ * programManager.setAccount(new Account("YourPrivateKey"));
1057
+ *
1058
+ * // Create the bonding transaction
1059
+ * const tx_id = await programManager.bondValidator("aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px", "aleo1feya8sjy9k2zflvl2dx39pdsq5tju28elnp2ektnn588uu9ghv8s84msv9", 2000000);
1060
+ *
1061
+ * // Verify the transaction was successful
1062
+ * setTimeout(async () => {
1063
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
1064
+ * assert(transaction.id() === tx_id);
1065
+ * }, 10000);
1066
+ */
1067
+ bondValidator(validator_address: string, withdrawal_address: string, amount: number, commission: number, options?: Partial<ExecuteOptions>): Promise<string>;
1068
+ /**
1069
+ * Build an unbond_public execution transaction to unbond credits from a validator in the Aleo network.
1070
+ *
1071
+ * @param {string} staker_address - The address of the staker who is unbonding the credits.
1072
+ * @param {number} amount - The amount of credits to unbond (scaled by 1,000,000).
1073
+ * @param {Partial<ExecuteOptions>} options - Override default execution options.
1074
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.
1075
+ *
1076
+ * @example
1077
+ * // Import the mainnet version of the sdk.
1078
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1079
+ *
1080
+ * // Create a keyProvider to handle key management.
1081
+ * const keyProvider = new AleoKeyProvider();
1082
+ * keyProvider.useCache(true);
1083
+ *
1084
+ * // Create a new ProgramManager with the key that will be used to unbond credits.
1085
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1086
+ * const tx = await programManager.buildUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 2000000);
1087
+ *
1088
+ * // The transaction can be submitted later to the network using the network client.
1089
+ * programManager.networkClient.submitTransaction(tx.toString());
1090
+ *
1091
+ * // Verify the transaction was successful
1092
+ * setTimeout(async () => {
1093
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
1094
+ * assert(transaction.id() === tx.id());
1095
+ * }, 10000);
1096
+ */
1097
+ buildUnbondPublicTransaction(staker_address: string, amount: number, options?: Partial<ExecuteOptions>): Promise<Transaction>;
1098
+ /**
1099
+ * Unbond a specified amount of staked credits. If the address of the executor of this function is an existing
1100
+ * validator, it will subtract this amount of credits from the validator's staked credits. If there are less than
1101
+ * 1,000,000 credits staked pool after the unbond, the validator will be removed from the validator set. If the
1102
+ * address of the executor of this function is not a validator and has credits bonded as a delegator, it will
1103
+ * subtract this amount of credits from the delegator's staked credits. If there are less than 10 credits bonded
1104
+ * after the unbond operation, the delegator will be removed from the validator's staking pool.
1105
+ *
1106
+ * @param {string} staker_address Address of the staker who is unbonding the credits
1107
+ * @param {number} amount Amount of credits to unbond.
1108
+ * @param {ExecuteOptions} options Options for the execution
1109
+ * @returns {Promise<string>} The transaction id
1110
+ *
1111
+ * @example
1112
+ * // Import the mainnet version of the sdk.
1113
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1114
+ *
1115
+ * // Create a keyProvider to handle key management
1116
+ * const keyProvider = new AleoKeyProvider();
1117
+ * keyProvider.useCache(true);
1118
+ *
1119
+ * // Create a new ProgramManager with the key that will be used to bond credits
1120
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1121
+ * programManager.setAccount(new Account("YourPrivateKey"));
1122
+ *
1123
+ * // Create the unbond_public transaction and send it to the network
1124
+ * const tx_id = await programManager.unbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j", 10);
1125
+ *
1126
+ * // Verify the transaction was successful
1127
+ * setTimeout(async () => {
1128
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
1129
+ * assert(transaction.id() === tx_id);
1130
+ * }, 10000);
1131
+ */
1132
+ unbondPublic(staker_address: string, amount: number, options?: Partial<ExecuteOptions>): Promise<string>;
1133
+ /**
1134
+ * Build a transaction to claim unbonded public credits in the Aleo network.
1135
+ *
1136
+ * @param {string} staker_address - The address of the staker who is claiming the credits.
1137
+ * @param {Partial<ExecuteOptions>} options - Override default execution options.
1138
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error message.
1139
+ *
1140
+ * @example
1141
+ * // Import the mainnet version of the sdk.
1142
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1143
+ *
1144
+ * // Create a keyProvider to handle key management
1145
+ * const keyProvider = new AleoKeyProvider();
1146
+ * keyProvider.useCache(true);
1147
+ *
1148
+ * // Create a new ProgramManager with the key that will be used to claim unbonded credits.
1149
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1150
+ *
1151
+ * // Create the claim_unbond_public transaction object for later use.
1152
+ * const tx = await programManager.buildClaimUnbondPublicTransaction("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");
1153
+ *
1154
+ * // The transaction can be submitted later to the network using the network client.
1155
+ * programManager.networkClient.submitTransaction(tx.toString());
1156
+ *
1157
+ * // Verify the transaction was successful
1158
+ * setTimeout(async () => {
1159
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
1160
+ * assert(transaction.id() === tx.id());
1161
+ * }, 10000);
1162
+ */
1163
+ buildClaimUnbondPublicTransaction(staker_address: string, options?: Partial<ExecuteOptions>): Promise<Transaction>;
1164
+ /**
1165
+ * Claim unbonded credits. If credits have been unbonded by the account executing this function, this method will
1166
+ * claim them and add them to the public balance of the account.
1167
+ *
1168
+ * @param {string} staker_address Address of the staker who is claiming the credits
1169
+ * @param {ExecuteOptions} options
1170
+ * @returns {Promise<string>} The transaction id
1171
+ *
1172
+ * @example
1173
+ * // Import the mainnet version of the sdk.
1174
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1175
+ *
1176
+ * // Create a keyProvider to handle key management
1177
+ * const keyProvider = new AleoKeyProvider();
1178
+ * keyProvider.useCache(true);
1179
+ *
1180
+ * // Create a new ProgramManager with the key that will be used to bond credits
1181
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1182
+ * programManager.setAccount(new Account("YourPrivateKey"));
1183
+ *
1184
+ * // Create the claim_unbond_public transaction
1185
+ * const tx_id = await programManager.claimUnbondPublic("aleo1jx8s4dvjepculny4wfrzwyhs3tlyv65r58ns3g6q2gm2esh7ps8sqy9s5j");
1186
+ *
1187
+ * // Verify the transaction was successful
1188
+ * setTimeout(async () => {
1189
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
1190
+ * assert(transaction.id() === tx_id);
1191
+ * }, 10000);
1192
+ */
1193
+ claimUnbondPublic(staker_address: string, options?: Partial<ExecuteOptions>): Promise<string>;
1194
+ /**
1195
+ * Build a set_validator_state transaction for later usage.
1196
+ *
1197
+ * This function allows a validator to set their state to be either opened or closed to new stakers.
1198
+ * When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.
1199
+ * When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.
1200
+ *
1201
+ * This function serves two primary purposes:
1202
+ * 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.
1203
+ * 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
1204
+ *
1205
+ * @param {boolean} validator_state
1206
+ * @param {Partial<ExecuteOptions>} options - Override default execution options
1207
+ * @returns {Promise<Transaction>} The transaction object
1208
+ *
1209
+ * @example
1210
+ * // Import the mainnet version of the sdk.
1211
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1212
+ *
1213
+ * // Create a keyProvider to handle key management
1214
+ * const keyProvider = new AleoKeyProvider();
1215
+ * keyProvider.useCache(true);
1216
+ *
1217
+ * // Create a new ProgramManager with the key that will be used to bond credits
1218
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1219
+ *
1220
+ * // Create the set_validator_state transaction
1221
+ * const tx = await programManager.buildSetValidatorStateTransaction(true);
1222
+ *
1223
+ * // The transaction can be submitted later to the network using the network client.
1224
+ * programManager.networkClient.submitTransaction(tx.toString());
1225
+ *
1226
+ * // Verify the transaction was successful
1227
+ * setTimeout(async () => {
1228
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
1229
+ * assert(transaction.id() === tx.id());
1230
+ * }, 10000);
1231
+ */
1232
+ buildSetValidatorStateTransaction(validator_state: boolean, options?: Partial<ExecuteOptions>): Promise<Transaction>;
1233
+ /**
1234
+ * Submit a set_validator_state transaction to the Aleo Network.
1235
+ *
1236
+ * This function allows a validator to set their state to be either opened or closed to new stakers.
1237
+ * When the validator is open to new stakers, any staker (including the validator) can bond or unbond from the validator.
1238
+ * When the validator is closed to new stakers, existing stakers can still bond or unbond from the validator, but new stakers cannot bond.
1239
+ *
1240
+ * This function serves two primary purposes:
1241
+ * 1. Allow a validator to leave the committee, by closing themselves to stakers and then unbonding all of their stakers.
1242
+ * 2. Allow a validator to maintain their % of stake, by closing themselves to allowing more stakers to bond to them.
1243
+ *
1244
+ * @param {boolean} validator_state
1245
+ * @param {Partial<ExecuteOptions>} options - Override default execution options
1246
+ * @returns {Promise<string>} The transaction id
1247
+ *
1248
+ * @example
1249
+ * // Import the mainnet version of the sdk.
1250
+ * import { AleoKeyProvider, ProgramManager } from "@provablehq/sdk/mainnet.js";
1251
+ *
1252
+ * // Create a keyProvider to handle key management
1253
+ * const keyProvider = new AleoKeyProvider();
1254
+ * keyProvider.useCache(true);
1255
+ *
1256
+ * // Create a new ProgramManager with the key that will be used to bond credits
1257
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, undefined);
1258
+ *
1259
+ * // Create the set_validator_state transaction
1260
+ * const tx_id = await programManager.setValidatorState(true);
1261
+ *
1262
+ * // Verify the transaction was successful
1263
+ * setTimeout(async () => {
1264
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
1265
+ * assert(transaction.id() === tx_id);
1266
+ * }, 10000);
1267
+ */
1268
+ setValidatorState(validator_state: boolean, options?: Partial<ExecuteOptions>): Promise<string>;
1269
+ /**
1270
+ * Verify a proof from an offline execution. This is useful when it is desired to do offchain proving and verification.
1271
+ *
1272
+ * @param {executionResponse} executionResponse The response from an offline function execution (via the `programManager.run` method)
1273
+ * @param {blockHeight} blockHeight The ledger height when the execution was generated.
1274
+ * @param {ImportedPrograms} imports The imported programs used in the execution. Specified as { "programName": "programSourceCode", ... }
1275
+ * @param {ImportedVerifyingKeys} importedVerifyingKeys The verifying keys in the execution. Specified as { "programName": [["functionName", "verifyingKey"], ...], ... }
1276
+ * @returns {boolean} True if the proof is valid, false otherwise
1277
+ *
1278
+ * @example
1279
+ * /// Import the mainnet version of the sdk used to build executions.
1280
+ * import { Account, ProgramManager } from "@provablehq/sdk/mainnet.js";
1281
+ *
1282
+ * /// Create the source for two programs.
1283
+ * 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";
1284
+ * 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";
1285
+ * const programManager = new ProgramManager(undefined, undefined, undefined);
1286
+ *
1287
+ * /// Create a temporary account for the execution of the program
1288
+ * const account = Account.fromCipherText(process.env.ciphertext, process.env.password);
1289
+ * programManager.setAccount(account);
1290
+ *
1291
+ * /// Get the response and ensure that the program executed correctly
1292
+ * const executionResponse = await programManager.run(program, "mul_and_add", ["5u32", "5u32"], true);
1293
+ *
1294
+ * /// Construct the imports and verifying keys
1295
+ * const imports = { "add_it_up.aleo": program_import };
1296
+ * const importedVerifyingKeys = { "add_it_up.aleo": [["add_it", "verifyingKey1..."]] };
1297
+ *
1298
+ * /// Verify the execution.
1299
+ * const blockHeight = 9000000;
1300
+ * const isValid = programManager.verifyExecution(executionResponse, blockHeight, imports, importedVerifyingKeys);
1301
+ * assert(isValid);
1302
+ */
1303
+ verifyExecution(executionResponse: ExecutionResponse, blockHeight: number, imports?: ImportedPrograms, importedVerifyingKeys?: ImportedVerifyingKeys): boolean;
1304
+ /**
1305
+ * Create a program object from a program's source code
1306
+ *
1307
+ * @param {string} program Program source code
1308
+ * @returns {Program} The program object
1309
+ */
1310
+ createProgramFromSource(program: string): Program;
1311
+ /**
1312
+ * Get the credits program object
1313
+ *
1314
+ * @returns {Program} The credits program object
1315
+ */
1316
+ creditsProgram(): Program;
1317
+ /**
1318
+ * Verify a program is valid
1319
+ *
1320
+ * @param {string} program The program source code
1321
+ */
1322
+ verifyProgram(program: string): boolean;
1323
+ /**
1324
+ * Estimate the execution fee for an authorization.
1325
+ *
1326
+ * @param {FeeEstimateOptions} options Options for fee estimate.
1327
+ *
1328
+ * @example
1329
+ * import { AleoKeyProvider, PrivateKey, initThreadPool, ProgramManager } from "@provablehq/sdk";
1330
+ *
1331
+ * await initThreadPool();
1332
+ *
1333
+ * // Create a new KeyProvider.
1334
+ * const keyProvider = new AleoKeyProvider();
1335
+ * keyProvider.useCache(true);
1336
+ *
1337
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions.
1338
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider);
1339
+ *
1340
+ * // Build the `Authorization`.
1341
+ * const privateKey = new PrivateKey(); // Change this to a private key that has an aleo credit balance.
1342
+ * const authorization = await programManager.buildAuthorization({
1343
+ * programName: "credits.aleo",
1344
+ * functionName: "transfer_public",
1345
+ * privateKey,
1346
+ * inputs: [
1347
+ * "aleo1vwls2ete8dk8uu2kmkmzumd7q38fvshrht8hlc0a5362uq8ftgyqnm3w08",
1348
+ * "10000000u64",
1349
+ * ],
1350
+ * });
1351
+ *
1352
+ * console.log("Getting execution id");
1353
+ *
1354
+ * // Derive the execution ID and base fee.
1355
+ * const executionId = authorization.toExecutionId().toString();
1356
+ *
1357
+ * console.log("Estimating fee");
1358
+ *
1359
+ * // Get the base fee in microcredits.
1360
+ * const baseFeeMicrocredits = await programManager.estimateFeeForAuthorization({
1361
+ * authorization,
1362
+ * programName: "credits.aleo"
1363
+ * });
1364
+ * const baseFeeCredits = Number(baseFeeMicrocredits)/1000000;
1365
+ *
1366
+ * console.log("Building fee authorization");
1367
+ *
1368
+ * // Build a credits.aleo/fee_public `Authorization`.
1369
+ * const feeAuthorization = await programManager.buildFeeAuthorization({
1370
+ * deploymentOrExecutionId: executionId,
1371
+ * baseFeeCredits,
1372
+ * privateKey
1373
+ * });
1374
+ */
1375
+ estimateFeeForAuthorization(options: FeeEstimateOptions): Promise<bigint>;
1376
+ /**
1377
+ * Estimate the execution fee for an Aleo function.
1378
+ *
1379
+ * @param {FeeEstimateOptions} options Options for the fee estimate.
1380
+ *
1381
+ * @returns {Promise<bigint>} Execution fee in microcredits for the authorization.
1382
+ *
1383
+ * @example
1384
+ * import { AleoKeyProvider, PrivateKey, initThreadPool, ProgramManager } from "@provablehq/sdk";
1385
+ *
1386
+ * // Initialize a program manager with the key provider to automatically fetch keys for executions.
1387
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider);
1388
+ *
1389
+ * // Get the base fee in microcredits.
1390
+ * const baseFeeMicrocredits = await programManager.estimateExecutionFee({programName: "credits.aleo"});
1391
+ * const baseFeeCredits = Number(baseFeeMicrocredits)/1000000;
1392
+ *
1393
+ * console.log("Building fee authorization");
1394
+ *
1395
+ * // Build a credits.aleo/fee_public `Authorization`.
1396
+ * const baseFeeMicrocredits = await programManager.estimateFeeForAuthorization({
1397
+ * programName: "credits.aleo",
1398
+ * functionName: "transfer_public",
1399
+ * });
1400
+ * const baseFeeCredits = Number(baseFeeMicrocredits)/1000000;
1401
+ */
1402
+ estimateExecutionFee(options: FeeEstimateOptions): Promise<bigint>;
1403
+ getCreditsRecord(amount: number, nonces: string[], record?: RecordPlaintext | string, params?: RecordSearchParams): Promise<RecordPlaintext>;
1404
+ /**
1405
+ * Builds an execution transaction for submission to the a local devnode.
1406
+ * This method skips proof generation and is not meant for use with the mainnet or testnet Aleo networks.
1407
+ * Note: getOrInitConsensusVersionTestHeights must be called prior to using this method for this method to work properly.
1408
+ *
1409
+ * @param {ExecuteOptions} options - The options for the execution transaction.
1410
+ * @returns {Promise<Transaction>} - A promise that resolves to the transaction or an error.
1411
+ *
1412
+ * @example
1413
+ * /// Import the mainnet version of the sdk.
1414
+ * import { AleoKeyProvider, getOrInitConsensusVersionTestHeights, ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
1415
+ *
1416
+ * // Initialize the development consensus heights in order to work with devnode.
1417
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
1418
+ *
1419
+ * // Create a new NetworkClient and RecordProvider.
1420
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
1421
+ * keyProvider.useCache(true);
1422
+ *
1423
+ * // Initialize a program manager.
1424
+ * const programManager = new ProgramManager("http://localhost:3030", recordProvider);
1425
+ *
1426
+ * // Build and execute the transaction.
1427
+ * const tx = await programManager.buildDevnodeExecutionTransaction({
1428
+ * programName: "hello_hello.aleo",
1429
+ * functionName: "hello_hello",
1430
+ * priorityFee: 0.0,
1431
+ * privateFee: false,
1432
+ * inputs: ["5u32", "5u32"],
1433
+ * });
1434
+ *
1435
+ * // Submit the transaction to the network
1436
+ * await programManager.networkClient.submitTransaction(tx.toString());
1437
+ *
1438
+ * // Verify the transaction was successful
1439
+ * setTimeout(async () => {
1440
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
1441
+ * assert(transaction.id() === tx.id());
1442
+ * }, 10000);
1443
+ */
1444
+ buildDevnodeExecutionTransaction(options: ExecuteOptions): Promise<Transaction>;
1445
+ /**
1446
+ * Builds a deployment transaction with placeholder certificates and verifying keys for each function in the program.
1447
+ * Intended for use with a local devnode.
1448
+ * `getOrInitConsensusVersionTestHeights` must be called with development heights prior to invoking this method for it to work properly.
1449
+ *
1450
+ * @param {DeployOptions} options - The options for the deployment transaction.
1451
+ * @returns {string} The transaction id of the deployed program or a failure message from the network
1452
+ *
1453
+ * @example
1454
+ * /// Import the mainnet version of the sdk.
1455
+ * import { ProgramManager, NetworkRecordProvider, getOrInitConsensusVersionTestHeights } from "@provablehq/sdk/mainnet.js";
1456
+ *
1457
+ * // Initialize the development consensus heights in order to work with a local devnode.
1458
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
1459
+ *
1460
+ * // Create a new NetworkClient, and RecordProvider
1461
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
1462
+ * keyProvider.useCache(true);
1463
+ *
1464
+ * // Initialize a program manager with the key provider to automatically fetch keys for deployments
1465
+ * 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";
1466
+ * const programManager = new ProgramManager("http://localhost:3030", recordProvider);
1467
+ * programManager.setAccount(Account);
1468
+ *
1469
+ * // Define a fee in credits
1470
+ * const priorityFee = 0.0;
1471
+ *
1472
+ * // Create the deployment transaction.
1473
+ * const tx = await programManager.buildDevnodeDeploymentTransaction({program: program, fee: priorityFee, privateFee: false});
1474
+ * await programManager.networkClient.submitTransaction(tx);
1475
+ *
1476
+ * // Verify the transaction was successful
1477
+ * setTimeout(async () => {
1478
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
1479
+ * assert(transaction.id() === tx.id());
1480
+ * }, 20000);
1481
+ */
1482
+ buildDevnodeDeploymentTransaction(options: DeployOptions): Promise<Transaction>;
1483
+ /**
1484
+ * Builds an upgrade transaction on a local devnodewith placeholder certificates and verifying keys for each function in the program.
1485
+ * This method is only intended for use with a local devnode.
1486
+ *
1487
+ * @param {DeployOptions} options - The options for the deployment transaction.
1488
+ * @returns {string} The transaction id of the deployed program or a failure message from the network
1489
+ *
1490
+ * @example
1491
+ * /// Import the mainnet version of the sdk.
1492
+ * import { ProgramManager, NetworkRecordProvider } from "@provablehq/sdk/mainnet.js";
1493
+ *
1494
+ * // Create a new NetworkClient, and RecordProvider
1495
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
1496
+ * keyProvider.useCache(true);
1497
+ *
1498
+ * // Initialize a program manager with the key provider to automatically fetch keys for deployments
1499
+ * 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";
1500
+ * const programManager = new ProgramManager("http://localhost:3030", recordProvider);
1501
+ * programManager.setAccount(Account);
1502
+ *
1503
+ * // Define a fee in credits
1504
+ * const priorityFee = 0.0;
1505
+ *
1506
+ * // Create the deployment transaction.
1507
+ * const tx = await programManager.buildDevnodeUpgradeTransaction({program: program, fee: priorityFee, privateFee: false});
1508
+ * await programManager.networkClient.submitTransaction(tx);
1509
+ *
1510
+ * // Verify the transaction was successful
1511
+ * setTimeout(async () => {
1512
+ * const transaction = await programManager.networkClient.getTransaction(tx.id());
1513
+ * assert(transaction.id() === tx.id());
1514
+ * }, 20000);
1515
+ */
1516
+ buildDevnodeUpgradeTransaction(options: DeployOptions): Promise<Transaction>;
1517
+ }
1518
+ /**
1519
+ * Convert an array of Aleo type strings to field element strings.
1520
+ *
1521
+ * Inputs that are already field elements (e.g. "1field") are passed through directly.
1522
+ * Other Aleo values (e.g. "1u32", records, futures, dynamic records) are parsed via
1523
+ * Value and converted to their field representation.
1524
+ *
1525
+ * @param {string[]} inputs Array of Aleo value strings
1526
+ * @returns {string[]} Array of field element strings
1527
+ */
1528
+ declare function inputsToFields(inputs: string[]): string[];
1529
+ /**
1530
+ * Verify an Aleo zkSnark proof against a verifying key and public inputs.
1531
+ *
1532
+ * This verifies a proof produced by an Aleo program that may not be deployed on chain.
1533
+ * It directly invokes the Varuna proof verification from snarkVM.
1534
+ *
1535
+ * **Note:** The proof must have been generated with the Fiat-Shamir domain separator
1536
+ * "snark_verify". Proofs generated via snarkVM with a different function name will fail
1537
+ * verification even if the circuit and inputs are correct.
1538
+ *
1539
+ * Inputs can be raw field element strings (e.g. "1field") or Aleo type strings
1540
+ * (e.g. "1u32", "true", "{ x: 1u8, y: 2u8 }"). Non-field inputs are automatically
1541
+ * converted to their field representation via Value.toFields().
1542
+ *
1543
+ * @param {VerificationOptions} options The verification parameters
1544
+ * @returns {boolean} True if the proof is valid, false otherwise
1545
+ *
1546
+ * @example
1547
+ * import { verifyProof } from "@provablehq/sdk/mainnet.js";
1548
+ *
1549
+ * // Using raw field elements:
1550
+ * const isValid = verifyProof({
1551
+ * verifyingKey: "verifier1...",
1552
+ * inputs: ["1field", "2field"],
1553
+ * proof: "proof1...",
1554
+ * });
1555
+ *
1556
+ * // Using Aleo types (automatically converted to fields):
1557
+ * const isValid2 = verifyProof({
1558
+ * verifyingKey: "verifier1...",
1559
+ * inputs: ["1u32", "2u32"],
1560
+ * proof: "proof1...",
1561
+ * });
1562
+ */
1563
+ declare function verifyProof(options: VerificationOptions): boolean;
1564
+ /**
1565
+ * Verify a batch Aleo zkSnark proof against multiple verifying keys and their corresponding public inputs.
1566
+ *
1567
+ * Each verifying key is paired with one or more sets of public inputs (instances).
1568
+ * Inputs can be raw field element strings or Aleo type strings — non-field inputs
1569
+ * are automatically converted to their field representation.
1570
+ *
1571
+ * **Note:** The proof must have been generated with the Fiat-Shamir domain separator
1572
+ * "snark_verify_batch". Proofs generated with a different function name will fail
1573
+ * verification even if the circuits and inputs are correct.
1574
+ *
1575
+ * @param {BatchVerificationOptions} options The batch verification parameters
1576
+ * @returns {boolean} True if the batch proof is valid, false otherwise
1577
+ *
1578
+ * @example
1579
+ * import { verifyBatchProof } from "@provablehq/sdk/mainnet.js";
1580
+ *
1581
+ * const isValid = verifyBatchProof({
1582
+ * verifyingKeys: ["verifier1...", "verifier2..."],
1583
+ * inputs: [[["1field", "2field"]], [["3field"]]],
1584
+ * proof: "proof1...",
1585
+ * });
1586
+ */
1587
+ declare function verifyBatchProof(options: BatchVerificationOptions): boolean;
1588
+ export { ProgramManager, AuthorizationOptions, FeeAuthorizationOptions, ExecuteOptions, ProvingRequestOptions, ExternalSigningOptions, VerificationOptions, BatchVerificationOptions, inputsToFields, verifyProof, verifyBatchProof };