@provablehq/sdk 0.10.2 → 0.10.4

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 (219) 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 +8530 -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 +3 -3
  12. package/dist/mainnet/browser.js +78 -32
  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 +686 -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 +2 -2
  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 +1600 -0
  104. package/dist/mainnet/program-manager.d.ts +13 -1
  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/testnet/account.d.cts +347 -0
  114. package/dist/testnet/browser.cjs +8530 -0
  115. package/dist/testnet/browser.cjs.map +1 -0
  116. package/dist/testnet/browser.d.cts +72 -0
  117. package/dist/testnet/browser.d.ts +3 -3
  118. package/dist/testnet/browser.js +78 -32
  119. package/dist/testnet/browser.js.map +1 -1
  120. package/dist/testnet/constants.d.cts +40 -0
  121. package/dist/testnet/external-signing.d.cts +76 -0
  122. package/dist/testnet/integrations/sealance/merkle-tree.d.cts +192 -0
  123. package/dist/testnet/keys/keystore/error.d.cts +24 -0
  124. package/dist/testnet/keys/keystore/file.d.cts +177 -0
  125. package/dist/testnet/keys/keystore/interface.d.cts +161 -0
  126. package/dist/testnet/keys/provider/interface.d.cts +170 -0
  127. package/dist/testnet/keys/provider/memory.d.cts +213 -0
  128. package/dist/testnet/keys/provider/memory.d.ts +6 -2
  129. package/dist/testnet/keys/provider/offline.d.cts +365 -0
  130. package/dist/testnet/keys/verifier/interface.d.cts +70 -0
  131. package/dist/testnet/keys/verifier/memory.d.cts +37 -0
  132. package/dist/testnet/keys/verifier/memory.d.ts +1 -1
  133. package/dist/testnet/models/authorization.d.cts +6 -0
  134. package/dist/testnet/models/authorization.d.ts +2 -2
  135. package/dist/testnet/models/blockJSON.d.cts +33 -0
  136. package/dist/testnet/models/confirmed_transaction.d.cts +9 -0
  137. package/dist/testnet/models/cryptoBoxPubkey.d.cts +4 -0
  138. package/dist/testnet/models/deployment/deploymentJSON.d.cts +6 -0
  139. package/dist/testnet/models/deployment/deploymentObject.d.cts +6 -0
  140. package/dist/testnet/models/encryptedProvingRequest.d.cts +4 -0
  141. package/dist/testnet/models/execution/executionJSON.d.cts +11 -0
  142. package/dist/testnet/models/execution/executionObject.d.cts +11 -0
  143. package/dist/testnet/models/external-signing.d.cts +123 -0
  144. package/dist/testnet/models/finalizeJSON.d.cts +6 -0
  145. package/dist/testnet/models/functionInput.d.cts +7 -0
  146. package/dist/testnet/models/functionObject.d.cts +8 -0
  147. package/dist/testnet/models/imports.d.cts +7 -0
  148. package/dist/testnet/models/input/inputJSON.d.cts +10 -0
  149. package/dist/testnet/models/input/inputObject.d.cts +15 -0
  150. package/dist/testnet/models/inputID.d.cts +4 -0
  151. package/dist/testnet/models/keyPair.d.cts +4 -0
  152. package/dist/testnet/models/output/outputJSON.d.cts +7 -0
  153. package/dist/testnet/models/output/outputObject.d.cts +18 -0
  154. package/dist/testnet/models/owner/ownerJSON.d.cts +4 -0
  155. package/dist/testnet/models/owner/ownerObject.d.cts +5 -0
  156. package/dist/testnet/models/plaintext/array.d.cts +3 -0
  157. package/dist/testnet/models/plaintext/literal.d.cts +1 -0
  158. package/dist/testnet/models/plaintext/plaintext.d.cts +5 -0
  159. package/dist/testnet/models/plaintext/struct.d.cts +5 -0
  160. package/dist/testnet/models/provingRequest.d.cts +6 -0
  161. package/dist/testnet/models/provingRequest.d.ts +1 -1
  162. package/dist/testnet/models/provingResponse.d.cts +51 -0
  163. package/dist/testnet/models/ratification.d.cts +4 -0
  164. package/dist/testnet/models/record-provider/encryptedRecord.d.cts +58 -0
  165. package/dist/testnet/models/record-provider/ownedRecord.d.cts +60 -0
  166. package/dist/testnet/models/record-provider/recordSearchParams.d.cts +19 -0
  167. package/dist/testnet/models/record-scanner/encryptedRecordsResult.d.cts +7 -0
  168. package/dist/testnet/models/record-scanner/encryptedRegistrationRequest.d.cts +8 -0
  169. package/dist/testnet/models/record-scanner/error.d.cts +47 -0
  170. package/dist/testnet/models/record-scanner/error.d.ts +1 -1
  171. package/dist/testnet/models/record-scanner/ownedFilter.d.cts +22 -0
  172. package/dist/testnet/models/record-scanner/ownedFilter.d.ts +3 -3
  173. package/dist/testnet/models/record-scanner/ownedRecordsResponseFilter.d.cts +42 -0
  174. package/dist/testnet/models/record-scanner/ownedRecordsResult.d.cts +13 -0
  175. package/dist/testnet/models/record-scanner/recordsFilter.d.cts +35 -0
  176. package/dist/testnet/models/record-scanner/recordsFilter.d.ts +2 -2
  177. package/dist/testnet/models/record-scanner/recordsResponseFilter.d.cts +42 -0
  178. package/dist/testnet/models/record-scanner/registrationRequest.d.cts +13 -0
  179. package/dist/testnet/models/record-scanner/registrationResponse.d.cts +13 -0
  180. package/dist/testnet/models/record-scanner/registrationResult.d.cts +9 -0
  181. package/dist/testnet/models/record-scanner/revokeResult.d.cts +17 -0
  182. package/dist/testnet/models/record-scanner/serialNumbersResult.d.cts +15 -0
  183. package/dist/testnet/models/record-scanner/statusResponse.d.cts +13 -0
  184. package/dist/testnet/models/record-scanner/statusResult.d.cts +13 -0
  185. package/dist/testnet/models/record-scanner/tagsResult.d.cts +12 -0
  186. package/dist/testnet/models/request.d.cts +14 -0
  187. package/dist/testnet/models/request.d.ts +1 -1
  188. package/dist/testnet/models/solution.d.cts +14 -0
  189. package/dist/testnet/models/transaction/transactionJSON.d.cts +11 -0
  190. package/dist/testnet/models/transaction/transactionObject.d.cts +14 -0
  191. package/dist/testnet/models/transition/transitionJSON.d.cts +13 -0
  192. package/dist/testnet/models/transition/transitionObject.d.cts +15 -0
  193. package/dist/testnet/network-client.d.cts +850 -0
  194. package/dist/testnet/network-client.d.ts +3 -0
  195. package/dist/testnet/node-polyfill.cjs +238 -0
  196. package/dist/testnet/node-polyfill.cjs.map +1 -0
  197. package/dist/testnet/node-polyfill.d.cts +5 -0
  198. package/dist/testnet/node-polyfill.js +1 -1
  199. package/dist/testnet/node-polyfill.js.map +1 -1
  200. package/dist/testnet/node.cjs +686 -0
  201. package/dist/testnet/node.cjs.map +1 -0
  202. package/dist/testnet/node.d.cts +3 -0
  203. package/dist/testnet/node.js +2 -2
  204. package/dist/testnet/polyfill/crypto.d.cts +1 -0
  205. package/dist/testnet/polyfill/fetch.d.cts +1 -0
  206. package/dist/testnet/polyfill/shared.d.cts +1 -0
  207. package/dist/testnet/polyfill/worker.d.cts +1 -0
  208. package/dist/testnet/polyfill/xmlhttprequest.d.cts +1 -0
  209. package/dist/testnet/program-manager.d.cts +1600 -0
  210. package/dist/testnet/program-manager.d.ts +13 -1
  211. package/dist/testnet/record-provider.d.cts +274 -0
  212. package/dist/testnet/record-scanner.d.cts +371 -0
  213. package/dist/testnet/record-scanner.d.ts +9 -6
  214. package/dist/testnet/security.d.cts +62 -0
  215. package/dist/testnet/security.d.ts +5 -5
  216. package/dist/testnet/utils.d.cts +23 -0
  217. package/dist/testnet/utils.d.ts +10 -2
  218. package/dist/testnet/wasm.d.cts +1 -0
  219. package/package.json +51 -9
@@ -0,0 +1,123 @@
1
+ import { Address, Field, Group, Signature, ViewKey } from "../wasm.js";
2
+ /** A Field, a string representation, or raw LE bytes. */
3
+ export type FieldLike = Field | string | Uint8Array;
4
+ /** A Group, a Field (x-coordinate), a string representation, or raw LE bytes. */
5
+ export type GroupLike = Group | Field | string | Uint8Array;
6
+ /** A ViewKey, a string representation, or raw LE bytes. */
7
+ export type ViewKeyLike = ViewKey | string | Uint8Array;
8
+ /** A Signature, a string representation, or raw LE bytes. */
9
+ export type SignatureLike = Signature | string | Uint8Array;
10
+ /** An Address, a string representation, or raw LE bytes. */
11
+ export type AddressLike = Address | string | Uint8Array;
12
+ /** An input ID is either a single Field-like (public/private) or a 5-tuple (record) with flexible deserialization. */
13
+ export type InputID = FieldLike | [FieldLike, GroupLike, FieldLike, FieldLike, FieldLike];
14
+ export declare function toField(value: FieldLike): Field;
15
+ export declare function toGroup(value: GroupLike): Group;
16
+ export declare function toViewKey(value: ViewKeyLike): ViewKey;
17
+ export declare function toSignature(value: SignatureLike): Signature;
18
+ export declare function toAddress(value: AddressLike): Address;
19
+ /** Output format discriminant for `computeExternalSigningInputs`. */
20
+ export type OutputFormat = "string" | "bytes";
21
+ /** Maps an {@link OutputFormat} to the concrete field-element representation. */
22
+ export type FieldOutput<F extends OutputFormat> = F extends "bytes" ? Uint8Array : string;
23
+ /**
24
+ * Type surrounding the input to an external signing request.
25
+ *
26
+ * The generic parameter `F` controls whether field elements are serialised as
27
+ * human-readable strings (`"string"`, the default) or raw little-endian bytes
28
+ * (`"bytes"`).
29
+ *
30
+ * @property {string} signingInputType - The type of signing input being requested.
31
+ * @property {FieldOutput<F>} index - The index of the output represented as an Ed/BLS-377 base field element.
32
+ * @property {FieldOutput<F>[]} data - The data represented as Ed/BLS-377 base field elements.
33
+ * @property {string} [name] - The name of the record being requested.
34
+ * @property {FieldOutput<F>} [h] - The h value of the record represented as an Ed/BLS-377 base field element.
35
+ * @property {FieldOutput<F>} [tag] - The tag of the record represented as an Ed/BLS-377 base field element.
36
+ * @property {FieldOutput<F>} [recordViewKey] - The record view key (present for record inputs when viewKey was provided).
37
+ */
38
+ export interface RequestSignInput<F extends OutputFormat = "string"> {
39
+ signingInputType: "constant" | "public" | "private" | "record" | "external_record" | "dynamic_record";
40
+ index: FieldOutput<F>;
41
+ data: FieldOutput<F>[];
42
+ name?: string;
43
+ h?: FieldOutput<F>;
44
+ tag?: FieldOutput<F>;
45
+ recordViewKey?: FieldOutput<F>;
46
+ }
47
+ /**
48
+ * Type representing the output of an external signing request.
49
+ *
50
+ * The generic parameter `F` controls whether field elements are serialised as
51
+ * human-readable strings (`"string"`, the default) or raw little-endian bytes
52
+ * (`"bytes"`).
53
+ *
54
+ * @property {FieldOutput<F>} functionId - The function ID as Ed/BLS-377 base field element(s).
55
+ * @property {boolean} isRoot - Whether this is a top-level transition.
56
+ * @property {RequestSignInput<F>[]} requestInputs - The inputs to the function being executed.
57
+ * @property {FieldOutput<F>} [checksum] - The Ed/BLS-377 base field representation of the program checksum.
58
+ * @property {string} [signer] - The signer address string (present when viewKey was provided).
59
+ * @property {string} [skTag] - The tag secret key string (present when viewKey was provided).
60
+ */
61
+ export interface ExternalSigningInput<F extends OutputFormat = "string"> {
62
+ functionId: FieldOutput<F>;
63
+ isRoot: boolean;
64
+ requestInputs: RequestSignInput<F>[];
65
+ checksum?: FieldOutput<F>;
66
+ signer?: string;
67
+ skTag?: string;
68
+ }
69
+ /**
70
+ * Type representing the options for pre-computing the inputs to an external signing request.
71
+ *
72
+ * @property {string} programName - The name of the program containing the function to execute.
73
+ * @property {string} functionName - The name of the function to execute within the program.
74
+ * @property {string[]} inputs - The inputs to the function being executed.
75
+ * @property {string[]} inputTypes - The input types of the function (e.g. ["address.public", "u64.public"]).
76
+ * @property {boolean} isRoot - Whether this transition is the first transition being executed in a transaction.
77
+ * @property {FieldLike} [checksum] - The optional checksum of the program.
78
+ * @property {ViewKeyLike} [viewKey] - The optional view key used to derive signer and skTag.
79
+ * @property {OutputFormat} [outputFormat] - Controls whether field elements are serialised as strings (default) or Uint8Arrays.
80
+ */
81
+ export interface ExternalSigningOptions {
82
+ programName: string;
83
+ functionName: string;
84
+ inputs: string[];
85
+ inputTypes: string[];
86
+ isRoot: boolean;
87
+ checksum?: FieldLike | null;
88
+ viewKey?: ViewKeyLike | null;
89
+ outputFormat?: OutputFormat;
90
+ }
91
+ /** Common parameters shared by all `buildExecutionRequest` variants. */
92
+ export interface ExecutionRequestParams {
93
+ programId: string;
94
+ functionName: string;
95
+ inputs: string[];
96
+ inputTypes: string[];
97
+ signature: SignatureLike;
98
+ tvk: FieldLike;
99
+ signer: AddressLike;
100
+ skTag: FieldLike;
101
+ }
102
+ /** Provide explicit record view keys and gammas. */
103
+ export interface RecordViewKeyStrategy {
104
+ recordViewKeys?: FieldLike[];
105
+ gammas?: GroupLike[];
106
+ }
107
+ /** Provide a view key to derive record view keys internally. */
108
+ export interface ViewKeyStrategy {
109
+ viewKey: ViewKeyLike;
110
+ gammas?: GroupLike[];
111
+ }
112
+ /** Provide pre-computed input IDs directly. */
113
+ export interface InputIdStrategy {
114
+ inputIds: InputID[];
115
+ }
116
+ /** Determines how record input IDs are resolved when building an ExecutionRequest. */
117
+ export type InputStrategy = RecordViewKeyStrategy | ViewKeyStrategy | InputIdStrategy;
118
+ /** Returns `true` if the strategy provides a `viewKey` for deriving record view keys. */
119
+ export declare function isViewKeyStrategy(r: InputStrategy): r is ViewKeyStrategy;
120
+ /** Returns `true` if the strategy provides pre-computed `inputIds`. */
121
+ export declare function isInputIdStrategy(r: InputStrategy): r is InputIdStrategy;
122
+ /** Returns `true` if the strategy provides explicit `recordViewKeys` (or is the default empty variant). */
123
+ export declare function isRecordViewKeyStrategy(r: InputStrategy): r is RecordViewKeyStrategy;
@@ -0,0 +1,6 @@
1
+ export interface FinalizeJSON {
2
+ "type": string;
3
+ "mapping_id": string;
4
+ "key_id": string;
5
+ "value_id": string;
6
+ }
@@ -0,0 +1,7 @@
1
+ export interface FunctionInput {
2
+ type: string;
3
+ visibility: string;
4
+ record?: string;
5
+ register?: string;
6
+ members?: FunctionInput[];
7
+ }
@@ -0,0 +1,8 @@
1
+ import { VerifyingKey } from "../wasm.js";
2
+ export interface FunctionObject {
3
+ "name": string;
4
+ "constraints": number;
5
+ "variables": number;
6
+ "verifyingKey": string | VerifyingKey;
7
+ "certificate": string;
8
+ }
@@ -0,0 +1,7 @@
1
+ interface ImportedVerifyingKeys {
2
+ [key: string]: Array<[string, string]>;
3
+ }
4
+ interface ImportedPrograms {
5
+ [key: string]: string;
6
+ }
7
+ export { ImportedVerifyingKeys, ImportedPrograms };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Object representation of an Input as raw JSON returned from a SnarkOS node.
3
+ */
4
+ export interface InputJSON {
5
+ type: string;
6
+ id: string;
7
+ tag?: string;
8
+ value?: string;
9
+ dynamic_id?: string;
10
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Aleo function Input represented as a typed typescript object.
3
+ */
4
+ import { Ciphertext, Field, Plaintext } from "../../wasm.js";
5
+ import { PlaintextObject } from "../plaintext/plaintext.js";
6
+ /**
7
+ * Object representation of an Input as raw JSON returned from a SnarkOS node.
8
+ */
9
+ export interface InputObject {
10
+ type: "string";
11
+ id: "string" | Field;
12
+ tag?: string | Field;
13
+ value?: Ciphertext | Plaintext | PlaintextObject;
14
+ dynamic_id?: string | Field;
15
+ }
@@ -0,0 +1,4 @@
1
+ export interface InputID {
2
+ type: string;
3
+ id: string;
4
+ }
@@ -0,0 +1,4 @@
1
+ import { ProvingKey, VerifyingKey } from "../wasm.js";
2
+ type FunctionKeyPair = [ProvingKey, VerifyingKey];
3
+ type CachedKeyPair = [Uint8Array, Uint8Array];
4
+ export { CachedKeyPair, FunctionKeyPair };
@@ -0,0 +1,7 @@
1
+ export interface OutputJSON {
2
+ type: string;
3
+ id: string;
4
+ checksum?: string;
5
+ value: string;
6
+ dynamic_id?: string;
7
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Aleo function Input represented as a typed typescript object.
3
+ */
4
+ import { Field, Ciphertext, Plaintext } from "../../wasm.js";
5
+ import { PlaintextObject } from "../plaintext/plaintext.js";
6
+ /**
7
+ * Object representation of an Input as raw JSON returned from a SnarkOS node.
8
+ */
9
+ export interface OutputObject {
10
+ type: string;
11
+ id: string | Field;
12
+ value?: Ciphertext | Plaintext | PlaintextObject;
13
+ checksum?: string | Field;
14
+ program?: string;
15
+ function?: string;
16
+ arguments?: Array<Plaintext> | Array<OutputObject>;
17
+ dynamic_id?: string | Field;
18
+ }
@@ -0,0 +1,4 @@
1
+ export interface OwnerJSON {
2
+ address: string;
3
+ signature: string;
4
+ }
@@ -0,0 +1,5 @@
1
+ import { Address, Signature } from "../../wasm.js";
2
+ export interface OwnerObject {
3
+ address: string | Address;
4
+ signature: string | Signature;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { PlaintextLiteral } from "./literal.js";
2
+ import { PlaintextStruct } from "./struct.js";
3
+ export type PlaintextArray = PlaintextLiteral[] | PlaintextStruct[] | PlaintextArray[];
@@ -0,0 +1 @@
1
+ export type PlaintextLiteral = boolean | bigint | number | string;
@@ -0,0 +1,5 @@
1
+ import { Plaintext } from "../../wasm.js";
2
+ import { PlaintextArray } from "./array.js";
3
+ import { PlaintextLiteral } from "./literal.js";
4
+ import { PlaintextStruct } from "./struct.js";
5
+ export type PlaintextObject = PlaintextArray | PlaintextLiteral | PlaintextStruct | Plaintext;
@@ -0,0 +1,5 @@
1
+ import { PlaintextArray } from "./array.js";
2
+ import { PlaintextLiteral } from "./literal.js";
3
+ export type PlaintextStruct = {
4
+ [key: string]: PlaintextArray | PlaintextLiteral | PlaintextStruct;
5
+ };
@@ -0,0 +1,6 @@
1
+ import { AuthorizationJSON } from "./authorization.js";
2
+ export interface ProvingRequestJSON {
3
+ authorization: AuthorizationJSON;
4
+ fee_authorization?: AuthorizationJSON;
5
+ broadcast: boolean;
6
+ }
@@ -1,4 +1,4 @@
1
- import { AuthorizationJSON } from "./authorization";
1
+ import { AuthorizationJSON } from "./authorization.js";
2
2
  export interface ProvingRequestJSON {
3
3
  authorization: AuthorizationJSON;
4
4
  fee_authorization?: AuthorizationJSON;
@@ -0,0 +1,51 @@
1
+ import { TransactionJSON } from "./transaction/transactionJSON.js";
2
+ /** HTTP status and optional message from snarkOS broadcast (Accepted/Rejected variants). */
3
+ export interface BroadcastResponse {
4
+ status_code: bigint | number;
5
+ message?: string;
6
+ }
7
+ /** Result of the optional broadcast step. Discriminated by `status`. */
8
+ export type BroadcastResult = {
9
+ status: "Accepted";
10
+ status_code: bigint | number;
11
+ message?: string;
12
+ } | {
13
+ status: "Rejected";
14
+ status_code: bigint | number;
15
+ message?: string;
16
+ } | {
17
+ status: "Failed";
18
+ message: string;
19
+ } | {
20
+ status: "Skipped";
21
+ };
22
+ /** Success response body for POST /prove (HTTP 200). */
23
+ export interface ProvingResponse {
24
+ transaction: TransactionJSON;
25
+ broadcast_result: BroadcastResult;
26
+ }
27
+ /** Error response body for POST /prove (HTTP 400, 500, 503). Same shape for all error cases. */
28
+ export interface ProveApiErrorBody {
29
+ message: string;
30
+ }
31
+ /** Error thrown on prove API failure; `status` is set for retry logic (e.g. retryWithBackoff checks error.status >= 500). */
32
+ export interface ProvingRequestError extends Error {
33
+ status?: number;
34
+ }
35
+ /** Success variant of a proving request result. */
36
+ export interface ProvingSuccess {
37
+ ok: true;
38
+ data: ProvingResponse;
39
+ }
40
+ /** Failure variant of a proving request result (HTTP 400, 500, 503). */
41
+ export interface ProvingFailure {
42
+ ok: false;
43
+ status: number;
44
+ error: ProveApiErrorBody;
45
+ }
46
+ /** Result of a proving request. Type used to give callers the ability to self-handle errors. */
47
+ export type ProvingResult = ProvingSuccess | ProvingFailure;
48
+ /** Type guard: value is a ProvingResponse. */
49
+ export declare function isProvingResponse(value: unknown): value is ProvingResponse;
50
+ /** Type guard: value is a ProveApiErrorBody. */
51
+ export declare function isProveApiErrorBody(value: unknown): value is ProveApiErrorBody;
@@ -0,0 +1,4 @@
1
+ export interface RatificationJSON {
2
+ type: string;
3
+ amount: number;
4
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Encrypted Record found on chain. This type provides the record ciphertext and metadata from the ledger such as the record's name, the program/function that produced it, etc.
3
+ *
4
+ * @property {string} commitment - The commitment of the record.
5
+ * @property {string | undefined} checksum - The checksum of the record.
6
+ * @property {number | undefined} block_height - The block height of the record.
7
+ * @property {number | undefined} block_timestamp - The block timestamp of the record.
8
+ * @property {string | undefined} program_name - The name of the program that produced the record.
9
+ * @property {string | undefined} function_name - The name of the function that produced the record.
10
+ * @property {number | undefined} output_index - The output index of the record.
11
+ * @property {string | undefined} owner - The owner of the record.
12
+ * @property {string | undefined} record_ciphertext - The ciphertext of the record.
13
+ * @property {string | undefined} record_name - The name of the record.
14
+ * @property {string | undefined} record_nonce - The nonce of the record.
15
+ * @property {string | undefined} sender_ciphertext - The ciphertext of the sender.
16
+ * @property {string | undefined} transaction_id - The ID of the transaction that produced the record.
17
+ * @property {string | undefined} transition_id - The ID of the transition that produced the record.
18
+ * @property {number | undefined} transaction_index - The index of the transaction that produced the record.
19
+ * @property {number | undefined} transition_index - The index of the transition that produced the record.
20
+ *
21
+ * @example
22
+ * const encryptedRecord: EncryptedRecord = {
23
+ * commitment: "1754131901135854615627743152473414463769543922079966020586765988138574911385field",
24
+ * checksum: "731623304764338277682996290553427512270277231686866672455141481050283829616field",
25
+ * block_height: 123456,
26
+ * block_timestamp: 1725845998,
27
+ * program_name: "credits.aleo",
28
+ * function_name: "transfer_private",
29
+ * output_index: 0,
30
+ * owner: "ciphertext1qgqdetlfzk98jkm4e7sgqml66e3x2gpg5d6udkpw0g67z0tplkpmzrm6q5dyfd7xhgmhedvptxzwfhrtxaqn7n0hs0esge3lwg9s2zukqgzxd0cr",
31
+ * record_ciphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf",
32
+ * record_name: "credits",
33
+ * record_nonce: "3077450429259593211617823051143573281856129402760267155982965992208217472983group",
34
+ * sender_ciphertext: "1754131901135854615627743152473414463769543922079966020586765988138574911385field",
35
+ * transaction_id: "at1f8ueqxu3x49sckpc6jlg676tmxumddzer3fwe2l0dxwj4dqxygyqua4u2q",
36
+ * transition_id: "au17mm5v7sfwus6y40xsyc99d5rtsr4vsajdec6twdjzv0m458q85zspqdnka",
37
+ * transaction_index: 0,
38
+ * transition_index: 0,
39
+ * }
40
+ */
41
+ export type EncryptedRecord = {
42
+ commitment: string;
43
+ checksum?: string;
44
+ block_height?: number;
45
+ block_timestamp?: number;
46
+ program_name?: string;
47
+ function_name?: string;
48
+ output_index?: number;
49
+ owner?: string;
50
+ record_ciphertext?: string;
51
+ record_name?: string;
52
+ record_nonce?: string;
53
+ sender_ciphertext?: string;
54
+ transaction_id?: string;
55
+ transition_id?: string;
56
+ transaction_index?: number;
57
+ transition_index?: number;
58
+ };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Record owned by a registered view key. This type provides the record ciphertext, record plaintext and metadata from the ledger such as the record's name, the program/function that produced it, etc.
3
+ *
4
+ * @property {number | undefined} block_height - Block height where the record was created.
5
+ * @property {number | undefined} block_timestamp - The timestamp of the block that the record was created in.
6
+ * @property {string | undefined} commitment - Commitment of the record.
7
+ * @property {string | undefined} function_name - Name of the function that created the record.
8
+ * @property {number | undefined} output_index - Index of the output in the function call that created the record.
9
+ * @property {string | undefined} owner - Address of the record owner.
10
+ * @property {string | undefined} program_name - Name of the program that created the record.
11
+ * @property {string | undefined} record_ciphertext - Encrypted ciphertext of the record.
12
+ * @property {string | undefined} record_name - Name of the record.
13
+ * @property {string | undefined} sender - Address of the sender.
14
+ * @property {boolean | undefined} spent - Whether the record has been spent.
15
+ * @property {string | undefined} tag - Tag associated with the record.
16
+ * @property {string | undefined} transaction_id - ID of the transaction that created the record.
17
+ * @property {string | undefined} transition_id - ID of the transition that created the record.
18
+ * @property {string | undefined} transaction_index - Index of the transaction in the block.
19
+ * @property {string | undefined} transition_index - Index of the transition in the transaction.
20
+ *
21
+ * @example
22
+ * const ownedRecord: OwnedRecord = {
23
+ * block_height: 123456,
24
+ * block_timestamp: 1725845998,
25
+ * commitment: "1754131901135854615627743152473414463769543922079966020586765988138574911385field",
26
+ * function_name: "transfer_public_to_private",
27
+ * output_index: 0,
28
+ * owner: "ciphertext1qgqdetlfzk98jkm4e7sgqml66e3x2gpg5d6udkpw0g67z0tplkpmzrm6q5dyfd7xhgmhedvptxzwfhrtxaqn7n0hs0esge3lwg9s2zukqgzxd0cr",
29
+ * program_name: "credits.aleo",
30
+ * record_ciphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf",
31
+ * record_plaintext: "{ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private, microcredits: 1500000000000000u64.private, _nonce: 3077450429259593211617823051143573281856129402760267155982965992208217472983group.public , _version: 1u8 }",
32
+ * record_name: "credits",
33
+ * spent: true,
34
+ * sender: "aleo1sf5kk4f8mcmgjasw9fannmm0h8z2nwqxu5e200cjneu28jxvtvpqulfxsa",
35
+ * tag: "6511661650536816422260305447175136877451468301541296257226129781611237851030field",
36
+ * transaction_id: "at1f8ueqxu3x49sckpc6jlg676tmxumddzer3fwe2l0dxwj4dqxygyqua4u2q",
37
+ * transition_id: "au17mm5v7sfwus6y40xsyc99d5rtsr4vsajdec6twdjzv0m458q85zspqdnka",
38
+ * transaction_index: 0,
39
+ * transition_index: 0,
40
+ * }
41
+ */
42
+ export type OwnedRecord = {
43
+ block_height?: number;
44
+ block_timestamp?: number;
45
+ commitment?: string;
46
+ function_name?: string;
47
+ output_index?: number;
48
+ owner?: string;
49
+ program_name?: string;
50
+ record_ciphertext?: string;
51
+ record_plaintext?: string;
52
+ record_name?: string;
53
+ sender?: string;
54
+ spent?: boolean;
55
+ tag?: string;
56
+ transaction_id?: string;
57
+ transition_id?: string;
58
+ transaction_index?: number;
59
+ transition_index?: number;
60
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider
3
+ * implementations.
4
+ *
5
+ * @example
6
+ * const recordSearchParams: RecordSearchParams = {
7
+ * // Declared fields
8
+ * unspent: true,
9
+ * nonces: ["3077450429259593211617823051143573281856129402760267155982965992208217472983group"],
10
+ * // Arbitrary fields
11
+ * startHeight: 123456,
12
+ * programName: "credits.aleo"
13
+ * }
14
+ */
15
+ export interface RecordSearchParams {
16
+ unspent?: boolean;
17
+ nonces?: string[];
18
+ [key: string]: any;
19
+ }
@@ -0,0 +1,7 @@
1
+ import type { RecordScannerFailure } from "./error.js";
2
+ import type { EncryptedRecord } from "../record-provider/encryptedRecord.js";
3
+ export interface EncryptedRecordsSuccess {
4
+ ok: true;
5
+ data: EncryptedRecord[];
6
+ }
7
+ export type EncryptedRecordsResult = EncryptedRecordsSuccess | RecordScannerFailure;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Payload for the /register/encrypted record scanner endpoint.
3
+ * Contains the ephemeral key id and the sealed ciphertext of the registration request.
4
+ */
5
+ export interface EncryptedRegistrationRequest {
6
+ key_id: string;
7
+ ciphertext: string;
8
+ }
@@ -0,0 +1,47 @@
1
+ import { OwnedFilter } from "./ownedFilter.js";
2
+ /**
3
+ * Error thrown when a record scanner request fails (e.g. /register, /register/encrypted).
4
+ * Includes HTTP status so callers can handle 422 vs 500 etc.
5
+ */
6
+ export declare class RecordScannerRequestError extends Error {
7
+ readonly status: number;
8
+ constructor(message: string, status: number);
9
+ }
10
+ /** Error thrown when findCreditsRecord or findCreditsRecords is called but decryption is not enabled on the record scanner. */
11
+ export declare class DecryptionNotEnabledError extends Error {
12
+ readonly filter?: OwnedFilter;
13
+ constructor(message: string, filter?: OwnedFilter);
14
+ }
15
+ /** Error thrown when findCreditsRecord or findCreditsRecords is called but no view key for the UUID is stored in viewKeys or the account. */
16
+ export declare class ViewKeyNotStoredError extends Error {
17
+ readonly uuid?: string;
18
+ readonly filter?: OwnedFilter;
19
+ constructor(message: string, uuid?: string, filter?: OwnedFilter);
20
+ }
21
+ /** Error thrown when no record matches the supplied search filter (e.g. findCreditsRecord / findCreditsRecords). */
22
+ export declare class RecordNotFoundError extends Error {
23
+ readonly filter?: OwnedFilter;
24
+ constructor(message: string, filter?: OwnedFilter);
25
+ }
26
+ /** Error thrown when no UUID is configured, the UUID is invalid, or a record scanner request fails due to an invalid UUID/response. */
27
+ export declare class UUIDError extends Error {
28
+ readonly uuid?: string;
29
+ readonly filter?: OwnedFilter;
30
+ constructor(message: string, uuid?: string, filter?: OwnedFilter);
31
+ }
32
+ /** General error payload returned from record-scanner endpoints on failure. */
33
+ export interface RecordScannerErrorBody {
34
+ /** Raw error text returned by the service. */
35
+ message: string;
36
+ /** HTTP status code from the response. */
37
+ status: number;
38
+ }
39
+ /**
40
+ * Failure variant shared by record-scanner result types.
41
+ * Use with a success interface to form a discriminated union (e.g. Success | RecordScannerFailure).
42
+ */
43
+ export interface RecordScannerFailure {
44
+ ok: false;
45
+ status: number;
46
+ error: RecordScannerErrorBody;
47
+ }
@@ -1,4 +1,4 @@
1
- import { OwnedFilter } from "./ownedFilter";
1
+ import { OwnedFilter } from "./ownedFilter.js";
2
2
  /**
3
3
  * Error thrown when a record scanner request fails (e.g. /register, /register/encrypted).
4
4
  * Includes HTTP status so callers can handle 422 vs 500 etc.
@@ -0,0 +1,22 @@
1
+ import { RecordSearchParams } from "../record-provider/recordSearchParams.js";
2
+ import { RecordsFilter } from "./recordsFilter.js";
3
+ import { OwnedRecordsResponseFilter } from "./ownedRecordsResponseFilter.js";
4
+ /**
5
+ * OwnedFilter is an extension of RecordSearchParams that represents a filter for scanning owned records.
6
+ *
7
+ * @example
8
+ * const ownedFilter: OwnedFilter = {
9
+ * unspent: true,
10
+ * nonces: ["3077450429259593211617823051143573281856129402760267155982965992208217472983group"],
11
+ * filter: {
12
+ * program: "credits.aleo",
13
+ * record: "credits",
14
+ * },
15
+ * }
16
+ */
17
+ export interface OwnedFilter extends RecordSearchParams {
18
+ filter?: RecordsFilter;
19
+ responseFilter?: OwnedRecordsResponseFilter;
20
+ unspent?: boolean;
21
+ uuid?: string;
22
+ }
@@ -1,6 +1,6 @@
1
- import { RecordSearchParams } from "../record-provider/recordSearchParams";
2
- import { RecordsFilter } from "./recordsFilter";
3
- import { OwnedRecordsResponseFilter } from "./ownedRecordsResponseFilter";
1
+ import { RecordSearchParams } from "../record-provider/recordSearchParams.js";
2
+ import { RecordsFilter } from "./recordsFilter.js";
3
+ import { OwnedRecordsResponseFilter } from "./ownedRecordsResponseFilter.js";
4
4
  /**
5
5
  * OwnedFilter is an extension of RecordSearchParams that represents a filter for scanning owned records.
6
6
  *
@@ -0,0 +1,42 @@
1
+ /**
2
+ * OwnedRecordsResponseFilter is a type that represents a filter for the response from a record provider.
3
+ * A `true` value for a field in the filter will include that field in the response.
4
+ *
5
+ * @example
6
+ * const ownedRecordsResponseFilter: OwnedRecordsResponseFilter = {
7
+ * commitment: true,
8
+ * owner: true,
9
+ * tag: true,
10
+ * sender: true,
11
+ * spent: true,
12
+ * record_ciphertext: true,
13
+ * block_height: true,
14
+ * block_timestamp: true,
15
+ * output_index: true,
16
+ * record_name: true,
17
+ * function_name: true,
18
+ * program_name: true,
19
+ * transition_id: true,
20
+ * transaction_id: true,
21
+ * transaction_index: true,
22
+ * transition_index: true,
23
+ * }
24
+ */
25
+ export interface OwnedRecordsResponseFilter {
26
+ commitment?: boolean;
27
+ owner?: boolean;
28
+ tag?: boolean;
29
+ sender?: boolean;
30
+ spent?: boolean;
31
+ record_ciphertext?: boolean;
32
+ block_height?: boolean;
33
+ block_timestamp?: boolean;
34
+ output_index?: boolean;
35
+ record_name?: boolean;
36
+ function_name?: boolean;
37
+ program_name?: boolean;
38
+ transition_id?: boolean;
39
+ transaction_id?: boolean;
40
+ transaction_index?: boolean;
41
+ transition_index?: boolean;
42
+ }
@@ -0,0 +1,13 @@
1
+ import type { RecordScannerFailure } from "./error.js";
2
+ import type { OwnedRecord } from "../record-provider/ownedRecord.js";
3
+ /**
4
+ * Success variant of ownedRecords() result.
5
+ *
6
+ * @property ok - Whether the request was successful, always true for this interface variant.
7
+ * @property data - List of owned records corresponding to the filter used.
8
+ */
9
+ export interface OwnedRecordsSuccess {
10
+ ok: true;
11
+ data: OwnedRecord[];
12
+ }
13
+ export type OwnedRecordsResult = OwnedRecordsSuccess | RecordScannerFailure;