@provablehq/sdk 0.10.2-rc.1 → 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 (223) 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 +4 -5
  12. package/dist/mainnet/browser.js +332 -855
  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 -16
  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 +3 -3
  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/program-manager.d.ts +1 -62
  105. package/dist/mainnet/record-provider.d.cts +274 -0
  106. package/dist/mainnet/record-scanner.d.cts +371 -0
  107. package/dist/mainnet/record-scanner.d.ts +9 -6
  108. package/dist/mainnet/security.d.cts +62 -0
  109. package/dist/mainnet/security.d.ts +5 -5
  110. package/dist/mainnet/utils.d.cts +23 -0
  111. package/dist/mainnet/utils.d.ts +10 -2
  112. package/dist/mainnet/wasm.d.cts +1 -0
  113. package/dist/mainnet/wasm.d.ts +1 -1
  114. package/dist/testnet/account.d.cts +347 -0
  115. package/dist/testnet/browser.cjs +8507 -0
  116. package/dist/testnet/browser.cjs.map +1 -0
  117. package/dist/testnet/browser.d.cts +72 -0
  118. package/dist/testnet/browser.d.ts +4 -5
  119. package/dist/testnet/browser.js +332 -855
  120. package/dist/testnet/browser.js.map +1 -1
  121. package/dist/testnet/constants.d.cts +40 -0
  122. package/dist/testnet/external-signing.d.cts +76 -0
  123. package/dist/testnet/integrations/sealance/merkle-tree.d.cts +192 -0
  124. package/dist/testnet/keys/keystore/error.d.cts +24 -0
  125. package/dist/testnet/keys/keystore/file.d.cts +177 -0
  126. package/dist/testnet/keys/keystore/interface.d.cts +161 -0
  127. package/dist/testnet/keys/provider/interface.d.cts +170 -0
  128. package/dist/testnet/keys/provider/memory.d.cts +213 -0
  129. package/dist/testnet/keys/provider/memory.d.ts +6 -2
  130. package/dist/testnet/keys/provider/offline.d.cts +365 -0
  131. package/dist/testnet/keys/verifier/interface.d.cts +70 -0
  132. package/dist/testnet/keys/verifier/memory.d.cts +37 -0
  133. package/dist/testnet/keys/verifier/memory.d.ts +1 -1
  134. package/dist/testnet/models/authorization.d.cts +6 -0
  135. package/dist/testnet/models/authorization.d.ts +2 -2
  136. package/dist/testnet/models/blockJSON.d.cts +33 -0
  137. package/dist/testnet/models/confirmed_transaction.d.cts +9 -0
  138. package/dist/testnet/models/cryptoBoxPubkey.d.cts +4 -0
  139. package/dist/testnet/models/deployment/deploymentJSON.d.cts +6 -0
  140. package/dist/testnet/models/deployment/deploymentObject.d.cts +6 -0
  141. package/dist/testnet/models/encryptedProvingRequest.d.cts +4 -0
  142. package/dist/testnet/models/execution/executionJSON.d.cts +11 -0
  143. package/dist/testnet/models/execution/executionObject.d.cts +11 -0
  144. package/dist/testnet/models/external-signing.d.cts +123 -0
  145. package/dist/testnet/models/finalizeJSON.d.cts +6 -0
  146. package/dist/testnet/models/functionInput.d.cts +7 -0
  147. package/dist/testnet/models/functionObject.d.cts +8 -0
  148. package/dist/testnet/models/imports.d.cts +7 -0
  149. package/dist/testnet/models/input/inputJSON.d.cts +10 -0
  150. package/dist/testnet/models/input/inputObject.d.cts +15 -0
  151. package/dist/testnet/models/inputID.d.cts +4 -0
  152. package/dist/testnet/models/keyPair.d.cts +4 -0
  153. package/dist/testnet/models/output/outputJSON.d.cts +7 -0
  154. package/dist/testnet/models/output/outputObject.d.cts +18 -0
  155. package/dist/testnet/models/owner/ownerJSON.d.cts +4 -0
  156. package/dist/testnet/models/owner/ownerObject.d.cts +5 -0
  157. package/dist/testnet/models/plaintext/array.d.cts +3 -0
  158. package/dist/testnet/models/plaintext/literal.d.cts +1 -0
  159. package/dist/testnet/models/plaintext/plaintext.d.cts +5 -0
  160. package/dist/testnet/models/plaintext/struct.d.cts +5 -0
  161. package/dist/testnet/models/provingRequest.d.cts +6 -0
  162. package/dist/testnet/models/provingRequest.d.ts +1 -1
  163. package/dist/testnet/models/provingResponse.d.cts +51 -0
  164. package/dist/testnet/models/ratification.d.cts +4 -0
  165. package/dist/testnet/models/record-provider/encryptedRecord.d.cts +58 -0
  166. package/dist/testnet/models/record-provider/ownedRecord.d.cts +60 -0
  167. package/dist/testnet/models/record-provider/recordSearchParams.d.cts +19 -0
  168. package/dist/testnet/models/record-scanner/encryptedRecordsResult.d.cts +7 -0
  169. package/dist/testnet/models/record-scanner/encryptedRegistrationRequest.d.cts +8 -0
  170. package/dist/testnet/models/record-scanner/error.d.cts +47 -0
  171. package/dist/testnet/models/record-scanner/error.d.ts +1 -1
  172. package/dist/testnet/models/record-scanner/ownedFilter.d.cts +22 -0
  173. package/dist/testnet/models/record-scanner/ownedFilter.d.ts +3 -3
  174. package/dist/testnet/models/record-scanner/ownedRecordsResponseFilter.d.cts +42 -0
  175. package/dist/testnet/models/record-scanner/ownedRecordsResult.d.cts +13 -0
  176. package/dist/testnet/models/record-scanner/recordsFilter.d.cts +35 -0
  177. package/dist/testnet/models/record-scanner/recordsFilter.d.ts +2 -2
  178. package/dist/testnet/models/record-scanner/recordsResponseFilter.d.cts +42 -0
  179. package/dist/testnet/models/record-scanner/registrationRequest.d.cts +13 -0
  180. package/dist/testnet/models/record-scanner/registrationResponse.d.cts +13 -0
  181. package/dist/testnet/models/record-scanner/registrationResult.d.cts +9 -0
  182. package/dist/testnet/models/record-scanner/revokeResult.d.cts +17 -0
  183. package/dist/testnet/models/record-scanner/serialNumbersResult.d.cts +15 -0
  184. package/dist/testnet/models/record-scanner/statusResponse.d.cts +13 -0
  185. package/dist/testnet/models/record-scanner/statusResult.d.cts +13 -0
  186. package/dist/testnet/models/record-scanner/tagsResult.d.cts +12 -0
  187. package/dist/testnet/models/request.d.cts +14 -0
  188. package/dist/testnet/models/request.d.ts +1 -1
  189. package/dist/testnet/models/solution.d.cts +14 -0
  190. package/dist/testnet/models/transaction/transactionJSON.d.cts +11 -0
  191. package/dist/testnet/models/transaction/transactionObject.d.cts +14 -0
  192. package/dist/testnet/models/transition/transitionJSON.d.cts +13 -0
  193. package/dist/testnet/models/transition/transitionObject.d.cts +15 -0
  194. package/dist/testnet/network-client.d.cts +850 -0
  195. package/dist/testnet/network-client.d.ts +3 -16
  196. package/dist/testnet/node-polyfill.cjs +238 -0
  197. package/dist/testnet/node-polyfill.cjs.map +1 -0
  198. package/dist/testnet/node-polyfill.d.cts +5 -0
  199. package/dist/testnet/node-polyfill.js +1 -1
  200. package/dist/testnet/node-polyfill.js.map +1 -1
  201. package/dist/testnet/node.cjs +685 -0
  202. package/dist/testnet/node.cjs.map +1 -0
  203. package/dist/testnet/node.d.cts +3 -0
  204. package/dist/testnet/node.js +3 -3
  205. package/dist/testnet/polyfill/crypto.d.cts +1 -0
  206. package/dist/testnet/polyfill/fetch.d.cts +1 -0
  207. package/dist/testnet/polyfill/shared.d.cts +1 -0
  208. package/dist/testnet/polyfill/worker.d.cts +1 -0
  209. package/dist/testnet/polyfill/xmlhttprequest.d.cts +1 -0
  210. package/dist/testnet/program-manager.d.cts +1588 -0
  211. package/dist/testnet/program-manager.d.ts +1 -62
  212. package/dist/testnet/record-provider.d.cts +274 -0
  213. package/dist/testnet/record-scanner.d.cts +371 -0
  214. package/dist/testnet/record-scanner.d.ts +9 -6
  215. package/dist/testnet/security.d.cts +62 -0
  216. package/dist/testnet/security.d.ts +5 -5
  217. package/dist/testnet/utils.d.cts +23 -0
  218. package/dist/testnet/utils.d.ts +10 -2
  219. package/dist/testnet/wasm.d.cts +1 -0
  220. package/dist/testnet/wasm.d.ts +1 -1
  221. package/package.json +51 -13
  222. package/dist/mainnet/keys/keystore/indexeddb.d.ts +0 -49
  223. package/dist/testnet/keys/keystore/indexeddb.d.ts +0 -49
@@ -4,7 +4,6 @@ import { ImportedPrograms, ImportedVerifyingKeys } from "./models/imports.js";
4
4
  import { RecordProvider } from "./record-provider.js";
5
5
  import { RecordSearchParams } from "./models/record-provider/recordSearchParams.js";
6
6
  import { FunctionKeyProvider, KeySearchParams } from "./keys/provider/interface.js";
7
- import { KeyStore } from "./keys/keystore/interface.js";
8
7
  import { FunctionKeyPair } from "./models/keyPair.js";
9
8
  import { Authorization, ExecutionRequest, ExecutionResponse, OfflineQuery, RecordPlaintext, PrivateKey, Program, ProvingKey, ProvingRequest, VerifyingKey, Transaction } from "./wasm.js";
10
9
  import { ExternalSigningOptions } from "./models/external-signing.js";
@@ -121,7 +120,6 @@ interface ExecuteAuthorizationOptions {
121
120
  offlineQuery?: OfflineQuery;
122
121
  program?: string | Program;
123
122
  imports?: ProgramImports;
124
- edition?: number;
125
123
  }
126
124
  /**
127
125
  * Represents the options for executing a transaction in the Aleo network.
@@ -215,14 +213,13 @@ declare class ProgramManager {
215
213
  networkClient: AleoNetworkClient;
216
214
  recordProvider: RecordProvider | undefined;
217
215
  inclusionKeysLoaded: boolean;
218
- private _keyStore;
219
216
  /** Create a new instance of the ProgramManager
220
217
  *
221
218
  * @param { string | undefined } host A host uri running the official Aleo API
222
219
  * @param { FunctionKeyProvider | undefined } keyProvider A key provider that implements {@link FunctionKeyProvider} interface
223
220
  * @param { RecordProvider | undefined } recordProvider A record provider that implements {@link RecordProvider} interface
224
221
  */
225
- constructor(host?: string | undefined, keyProvider?: FunctionKeyProvider | undefined, recordProvider?: RecordProvider | undefined, networkClientOptions?: AleoNetworkClientOptions | undefined, keyStore?: KeyStore | undefined);
222
+ constructor(host?: string | undefined, keyProvider?: FunctionKeyProvider | undefined, recordProvider?: RecordProvider | undefined, networkClientOptions?: AleoNetworkClientOptions | undefined);
226
223
  /**
227
224
  * Check if the fee is sufficient to pay for the transaction
228
225
  */
@@ -251,64 +248,6 @@ declare class ProgramManager {
251
248
  * @param {RecordProvider} recordProvider
252
249
  */
253
250
  setRecordProvider(recordProvider: RecordProvider): void;
254
- /**
255
- * Set the key store for automatic key caching across executions.
256
- *
257
- * @param {KeyStore} keyStore
258
- */
259
- setKeyStore(keyStore: KeyStore): void;
260
- /**
261
- * Build a ProgramImportsBuilder from a program and its imports.
262
- * Fetches imports from the network if not provided, resolves transitive
263
- * dependencies, and optionally pre-loads cached keys from the KeyStore.
264
- *
265
- * @param loadKeys When true (default), loads cached proving/verifying keys
266
- * from the KeyStore into the builder. Set to false for authorization and
267
- * proving request paths where keys are not synthesized.
268
- */
269
- private buildProgramImports;
270
- /**
271
- * Extract `import program_name.aleo;` names from program source via regex.
272
- * Avoids a WASM round-trip compared to Program.fromString + getImports.
273
- */
274
- private static getImportNames;
275
- /**
276
- * Parse `call program.aleo/function` instructions from program source
277
- * to determine which functions of each import are actually in the call chain.
278
- * Returns a map of program name -> set of called function names.
279
- */
280
- private static getCalledFunctions;
281
- /**
282
- * Resolve the active KeyStore, preferring the directly-set _keyStore
283
- * over the KeyProvider's keyStore().
284
- */
285
- private resolveKeyStore;
286
- /**
287
- * Resolve the edition and amendment count for a program from the network.
288
- * Returns `{ edition, amendment }` or falls back to `{ edition: 1, amendment: 0 }`.
289
- */
290
- private resolveEditionAndAmendment;
291
- /**
292
- * Load cached proving/verifying keys from the KeyStore into a ProgramImportsBuilder.
293
- * Only loads keys for the specified functions — returns immediately if
294
- * functionNames is empty or undefined.
295
- * Resolves edition and amendment from the network for accurate key locator
296
- * construction when not explicitly provided.
297
- */
298
- private loadKeysFromStore;
299
- /**
300
- * Persist newly synthesized keys from the returned ProgramImportsBuilder
301
- * into the KeyStore. Only writes keys that are not already in the store,
302
- * avoiding unnecessary writes of large proving keys.
303
- * Fetches each program's current edition and amendment count from the network
304
- * for accurate key locator construction.
305
- */
306
- private persistExtractedKeys;
307
- /**
308
- * Resolve top-level function keys, checking the KeyStore first and
309
- * falling back to the KeyProvider.
310
- */
311
- private resolveTopLevelKeys;
312
251
  /**
313
252
  * Set a header in the `AleoNetworkClient`s header map
314
253
  *
@@ -0,0 +1,274 @@
1
+ import { Account } from "./account.js";
2
+ import { AleoNetworkClient } from "./network-client.js";
3
+ import { EncryptedRecord } from "./models/record-provider/encryptedRecord.js";
4
+ import { OwnedRecord } from "./models/record-provider/ownedRecord.js";
5
+ import { RecordSearchParams } from "./models/record-provider/recordSearchParams.js";
6
+ import { RecordsResponseFilter } from "./models/record-scanner/recordsResponseFilter.js";
7
+ /**
8
+ * Interface for a record provider. A record provider is used to find records for use in deployment and execution
9
+ * transactions on the Aleo Network. A default implementation is provided by the NetworkRecordProvider class. However,
10
+ * a custom implementation can be provided (say if records are synced locally to a database from the network) by
11
+ * implementing this interface.
12
+ */
13
+ interface RecordProvider {
14
+ /**
15
+ * The account used to search for records.
16
+ */
17
+ account?: Account;
18
+ /**
19
+ * Find encrypted records from the chosen provider.
20
+ *
21
+ * @param {RecordSearchParams} recordsFilter The filter used to find the records.
22
+ * @param {RecordsResponseFilter} responseFilter The filter used to filter the response.
23
+ * @returns {Promise<EncryptedRecord[]>} The encrypted records.
24
+ */
25
+ encryptedRecords(recordsFilter: RecordSearchParams, responseFilter?: RecordsResponseFilter): Promise<EncryptedRecord[]>;
26
+ /**
27
+ * Check if a list of serial numbers exist in the chosen provider.
28
+ *
29
+ * @param {string[]} serialNumbers The serial numbers to check.
30
+ * @returns {Promise<Record<string, boolean>>} Map of Aleo Record serial numbers and whether they appeared in any inputs on chain. If boolean corresponding to the Serial Number has a true value, that Record is considered spent by the Aleo Network.
31
+ */
32
+ checkSerialNumbers(serialNumbers: string[]): Promise<Record<string, boolean>>;
33
+ /**
34
+ * Check if a list of tags exist in the chosen provider.
35
+ *
36
+ * @param {string[]} tags The tags to check.
37
+ * @returns {Promise<Record<string, boolean>>} Map of Aleo Record tags and whether they appeared in any inputs on chain. If boolean corresponding to the tag has a true value, that Record is considered spent by the Aleo Network.
38
+ */
39
+ checkTags(tags: string[]): Promise<Record<string, boolean>>;
40
+ /**
41
+ * Find a credits.aleo record with a given number of microcredits from the chosen provider.
42
+ *
43
+ * @param {number} microcredits The number of microcredits to search for.
44
+ * @param {RecordSearchParams} searchParameters Additional parameters to search for.
45
+ * @returns {Promise<OwnedRecord>} The record if one is found.
46
+ *
47
+ * @example
48
+ * // A class implementing record provider can be used to find a record with a given number of microcredits
49
+ * const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [] });
50
+ *
51
+ * // When a record is found but not yet used, its nonce should be added to the nonces array so that it is not
52
+ * // found again if a subsequent search is performed
53
+ * const record2 = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [record.nonce()] });
54
+ *
55
+ * // When the program manager is initialized with the record provider it will be used to find automatically find
56
+ * // fee records and amount records for value transfers so that they do not need to be specified manually
57
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
58
+ * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
59
+ */
60
+ findCreditsRecord(microcredits: number, searchParameters: RecordSearchParams): Promise<OwnedRecord>;
61
+ /**
62
+ * Find a list of credit.aleo records with a given number of microcredits from the chosen provider
63
+ *
64
+ * @param {number[]} microcreditAmounts A list of separate microcredit amounts to search for (e.g. [5000, 100000]).
65
+ * @param {RecordSearchParams} searchParameters Additional parameters to search for.
66
+ * @returns {Promise<OwnedRecord[]>} A list of records with a value greater or equal to the amounts specified if such records exist, otherwise an error.
67
+ *
68
+ * @example
69
+ * // A class implementing record provider can be used to find a record with a given number of microcredits
70
+ * const records = await recordProvider.findCreditsRecords([5000, 5000], { unspent: true, nonces: [] });
71
+ *
72
+ * // When a record is found but not yet used, it's nonce should be added to the nonces array so that it is not
73
+ * // found again if a subsequent search is performed
74
+ * const nonces = [];
75
+ * records.forEach(record => { nonces.push(record.nonce()) });
76
+ * const records2 = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces });
77
+ *
78
+ * // When the program manager is initialized with the record provider it will be used to find automatically find
79
+ * // fee records and amount records for value transfers so that they do not need to be specified manually
80
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
81
+ * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
82
+ */
83
+ findCreditsRecords(microcreditAmounts: number[], searchParameters: RecordSearchParams): Promise<OwnedRecord[]>;
84
+ /**
85
+ * Find an arbitrary record
86
+ * @param {RecordSearchParams} searchParameters Additional parameters to search for.
87
+ * @returns {Promise<OwnedRecord>} The record if found, otherwise an error.
88
+ *
89
+ * @example
90
+ * // The RecordSearchParams interface can be used to create parameters for custom record searches which can then
91
+ * // be passed to the record provider. An example of how this would be done for the credits.aleo program is shown
92
+ * // below.
93
+ *
94
+ * class CustomRecordSearch implements RecordSearchParams {
95
+ * startHeight: number;
96
+ * endHeight: number;
97
+ * amount: number;
98
+ * program: string;
99
+ * recordName: string;
100
+ * nonces: string[];
101
+ * unspent: boolean;
102
+ * constructor(
103
+ * startHeight: number,
104
+ * endHeight: number,
105
+ * credits: number,
106
+ * maxRecords: number,
107
+ * programName: string,
108
+ * recordName: string,
109
+ * nonces: string[],
110
+ * unspent: boolean
111
+ * ) {
112
+ * this.startHeight = startHeight;
113
+ * this.endHeight = endHeight;
114
+ * this.amount = amount;
115
+ * this.program = programName;
116
+ * this.recordName = recordName;
117
+ * this.nonces = nonces;
118
+ * this.unspent = unspent;
119
+ * }
120
+ * }
121
+ *
122
+ * const params = new CustomRecordSearch(0, 100, 5000, "credits.aleo", "credits", [], true);
123
+ *
124
+ * const record = await recordProvider.findRecord(params);
125
+ */
126
+ findRecord(searchParameters: RecordSearchParams): Promise<OwnedRecord>;
127
+ /**
128
+ * Find multiple records from arbitrary programs
129
+ *
130
+ * @param {RecordSearchParams} searchParameters Additional parameters to search for.
131
+ * @returns {Promise<OwnedRecord[]>} The records if found, otherwise an error.
132
+ *
133
+ * @example
134
+ * // The RecordSearchParams interface can be used to create parameters for custom record searches which can then
135
+ * // be passed to the record provider. An example of how this would be done for the credits.aleo program is shown
136
+ * // below.
137
+ *
138
+ * class CustomRecordSearch implements RecordSearchParams {
139
+ * startHeight: number;
140
+ * endHeight: number;
141
+ * credits: number;
142
+ * program: string;
143
+ * recordName: string;
144
+ * nonces: string[];
145
+ * unspent: boolean;
146
+ * constructor(
147
+ * startHeight: number,
148
+ * endHeight: number,
149
+ * credits: number,
150
+ * maxRecords: number,
151
+ * programName: string,
152
+ * recordName: string,
153
+ * nonces: string[],
154
+ * unspent: boolean
155
+ * ) {
156
+ * this.startHeight = startHeight;
157
+ * this.endHeight = endHeight;
158
+ * this.credits = credits;
159
+ * this.program = programName;
160
+ * this.recordName = recordName;
161
+ * this.nonces = nonces;
162
+ * this.unspent = unspent;
163
+ * }
164
+ * }
165
+ *
166
+ * const params = new CustomRecordSearch(0, 100, 5000, 2, "credits.aleo", "credits");
167
+ * const records = await recordProvider.findRecord(true, [], params);
168
+ */
169
+ findRecords(searchParameters: RecordSearchParams): Promise<OwnedRecord[]>;
170
+ }
171
+ /**
172
+ * A record provider implementation that uses the official Aleo API to find records for usage in program execution and
173
+ * deployment, wallet functionality, and other use cases.
174
+ */
175
+ declare class NetworkRecordProvider implements RecordProvider {
176
+ account: Account;
177
+ networkClient: AleoNetworkClient;
178
+ constructor(account: Account, networkClient: AleoNetworkClient);
179
+ /**
180
+ * Set the account used to search for records
181
+ *
182
+ * @param {Account} account The account used to use for searching for records.
183
+ */
184
+ setAccount(account: Account): void;
185
+ /**
186
+ * Find a list of credit records with a given number of microcredits by via the official Aleo API
187
+ *
188
+ * @param {number[]} microcredits The number of microcredits to search for.
189
+ * @param {RecordSearchParams} searchParameters Additional parameters to search for.
190
+ * @returns {Promise<OwnedRecord[]>} The records if found, otherwise an error.
191
+ *
192
+ * @example
193
+ * // Create a new NetworkRecordProvider
194
+ * const networkClient = new AleoNetworkClient("https://api.provable.com/v2");
195
+ * const keyProvider = new AleoKeyProvider();
196
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
197
+ *
198
+ * // The record provider can be used to find records with a given number of microcredits
199
+ * const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [] });
200
+ *
201
+ * // When a record is found but not yet used, it's nonce should be added to the nonces parameter so that it is not
202
+ * // found again if a subsequent search is performed
203
+ * const records = await recordProvider.findCreditsRecords(5000, { unspent: true, nonces: [record.nonce()] });
204
+ *
205
+ * // When the program manager is initialized with the record provider it will be used to find automatically find
206
+ * // fee records and amount records for value transfers so that they do not need to be specified manually
207
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
208
+ * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
209
+ *
210
+ * */
211
+ findCreditsRecords(microcredits: number[], searchParameters: RecordSearchParams): Promise<OwnedRecord[]>;
212
+ /**
213
+ * Find a credit record with a given number of microcredits by via the official Aleo API
214
+ *
215
+ * @param {number} microcredits The number of microcredits to search for.
216
+ * @param {RecordSearchParams} searchParameters Additional parameters to search for.
217
+ * @returns {Promise<OwnedRecord>} The record if found, otherwise an error.
218
+ *
219
+ * @example
220
+ * // Create a new NetworkRecordProvider
221
+ * const networkClient = new AleoNetworkClient("https://api.provable.com/v2");
222
+ * const keyProvider = new AleoKeyProvider();
223
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
224
+ *
225
+ * // The record provider can be used to find records with a given number of microcredits
226
+ * const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [] });
227
+ *
228
+ * // When a record is found but not yet used, it's nonce should be added to the nonces parameter so that it is not
229
+ * // found again if a subsequent search is performed
230
+ * const records = await recordProvider.findCreditsRecords(5000, { unspent: true, nonces: [record.nonce()] });
231
+ *
232
+ * // When the program manager is initialized with the record provider it will be used to find automatically find
233
+ * // fee records and amount records for value transfers so that they do not need to be specified manually
234
+ * const programManager = new ProgramManager("https://api.provable.com/v2", keyProvider, recordProvider);
235
+ * programManager.transfer(1, "aleo166q6ww6688cug7qxwe7nhctjpymydwzy2h7rscfmatqmfwnjvggqcad0at", "public", 0.5);
236
+ */
237
+ findCreditsRecord(microcredits: number, searchParameters: RecordSearchParams): Promise<OwnedRecord>;
238
+ /**
239
+ * Find an arbitrary record. WARNING: This function is not implemented yet and will throw an error.
240
+ */
241
+ findRecord(searchParameters: RecordSearchParams): Promise<OwnedRecord>;
242
+ /**
243
+ * Find multiple records from a specified program.
244
+ */
245
+ findRecords(searchParameters: RecordSearchParams): Promise<OwnedRecord[]>;
246
+ encryptedRecords(recordsFilter: RecordSearchParams, responseFilter?: RecordsResponseFilter): Promise<EncryptedRecord[]>;
247
+ checkSerialNumbers(serialNumbers: string[]): Promise<Record<string, boolean>>;
248
+ checkTags(tags: string[]): Promise<Record<string, boolean>>;
249
+ }
250
+ /**
251
+ * BlockHeightSearch is a RecordSearchParams implementation that allows for searching for records within a given
252
+ * block height range.
253
+ *
254
+ * @example
255
+ * // Create a new BlockHeightSearch
256
+ * const params = new BlockHeightSearch(89995, 99995);
257
+ *
258
+ * // Create a new NetworkRecordProvider
259
+ * const networkClient = new AleoNetworkClient("https://api.provable.com/v2");
260
+ * const keyProvider = new AleoKeyProvider();
261
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
262
+ *
263
+ * // The record provider can be used to find records with a given number of microcredits and the block height search
264
+ * // can be used to find records within a given block height range
265
+ * const record = await recordProvider.findCreditsRecord(5000, { unspent: true, nonces: [], ...params });
266
+ *
267
+ */
268
+ declare class BlockHeightSearch implements RecordSearchParams {
269
+ startHeight: number;
270
+ endHeight: number;
271
+ unspent: boolean;
272
+ constructor(startHeight: number, endHeight: number, unspent?: boolean);
273
+ }
274
+ export { BlockHeightSearch, NetworkRecordProvider, RecordProvider, };