@umbra-privacy/sdk 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +104 -25
  2. package/dist/{addresses-Brzgurv_.d.ts → addresses-B7HybtbJ.d.ts} +2 -1
  3. package/dist/{addresses-D_0YAS6B.d.cts → addresses-CTVY1oi7.d.cts} +2 -1
  4. package/dist/arcium-BXXlryfe.d.cts +20 -0
  5. package/dist/arcium-BXXlryfe.d.ts +20 -0
  6. package/dist/chunk-4RHXVBNI.js +203 -0
  7. package/dist/chunk-4RHXVBNI.js.map +1 -0
  8. package/dist/chunk-4TZVXB5G.js +324 -0
  9. package/dist/chunk-4TZVXB5G.js.map +1 -0
  10. package/dist/chunk-5GUSMQ74.cjs +549 -0
  11. package/dist/chunk-5GUSMQ74.cjs.map +1 -0
  12. package/dist/chunk-5KPQXPQM.js +36 -0
  13. package/dist/chunk-5KPQXPQM.js.map +1 -0
  14. package/dist/chunk-AXD7LXYY.cjs +405 -0
  15. package/dist/chunk-AXD7LXYY.cjs.map +1 -0
  16. package/dist/{chunk-HOEXDXRC.cjs → chunk-BL6WXLPV.cjs} +32 -360
  17. package/dist/chunk-BL6WXLPV.cjs.map +1 -0
  18. package/dist/chunk-CFFLOE7D.cjs +598 -0
  19. package/dist/chunk-CFFLOE7D.cjs.map +1 -0
  20. package/dist/{chunk-BM7N6N7E.js → chunk-CFTW5WNG.js} +3 -325
  21. package/dist/chunk-CFTW5WNG.js.map +1 -0
  22. package/dist/chunk-DD2WCK4C.js +327 -0
  23. package/dist/chunk-DD2WCK4C.js.map +1 -0
  24. package/dist/chunk-DMPMQ74B.cjs +246 -0
  25. package/dist/chunk-DMPMQ74B.cjs.map +1 -0
  26. package/dist/{chunk-2Q75CQQJ.js → chunk-EEKF4553.js} +2 -2
  27. package/dist/chunk-EEKF4553.js.map +1 -0
  28. package/dist/chunk-ENVYYEM4.cjs +113 -0
  29. package/dist/chunk-ENVYYEM4.cjs.map +1 -0
  30. package/dist/chunk-FQX6ZYGJ.js +500 -0
  31. package/dist/chunk-FQX6ZYGJ.js.map +1 -0
  32. package/dist/chunk-FSK2ICMB.cjs +39 -0
  33. package/dist/chunk-FSK2ICMB.cjs.map +1 -0
  34. package/dist/chunk-FZYWLQAF.cjs +355 -0
  35. package/dist/chunk-FZYWLQAF.cjs.map +1 -0
  36. package/dist/chunk-GP26R377.js +436 -0
  37. package/dist/chunk-GP26R377.js.map +1 -0
  38. package/dist/chunk-HA5FLM63.js +393 -0
  39. package/dist/chunk-HA5FLM63.js.map +1 -0
  40. package/dist/chunk-INJ73LXQ.js +1107 -0
  41. package/dist/chunk-INJ73LXQ.js.map +1 -0
  42. package/dist/chunk-JPDF7BIT.cjs +10892 -0
  43. package/dist/chunk-JPDF7BIT.cjs.map +1 -0
  44. package/dist/{chunk-MDFSBU5W.cjs → chunk-LTCKPTZC.cjs} +2 -351
  45. package/dist/chunk-LTCKPTZC.cjs.map +1 -0
  46. package/dist/chunk-MKNCBUFA.js +564 -0
  47. package/dist/chunk-MKNCBUFA.js.map +1 -0
  48. package/dist/chunk-NKVMSABR.cjs +207 -0
  49. package/dist/chunk-NKVMSABR.cjs.map +1 -0
  50. package/dist/chunk-OFDWNWCL.js +70 -0
  51. package/dist/chunk-OFDWNWCL.js.map +1 -0
  52. package/dist/chunk-QJAUUYZU.cjs +331 -0
  53. package/dist/chunk-QJAUUYZU.cjs.map +1 -0
  54. package/dist/chunk-RVUYPKKD.js +10750 -0
  55. package/dist/chunk-RVUYPKKD.js.map +1 -0
  56. package/dist/chunk-TLR7A64G.js +103 -0
  57. package/dist/chunk-TLR7A64G.js.map +1 -0
  58. package/dist/{chunk-MVKTV3FT.cjs → chunk-TQQZGNOI.cjs} +2 -2
  59. package/dist/chunk-TQQZGNOI.cjs.map +1 -0
  60. package/dist/chunk-UOFYS6M3.js +219 -0
  61. package/dist/chunk-UOFYS6M3.js.map +1 -0
  62. package/dist/chunk-UXMQI6B7.js +2406 -0
  63. package/dist/chunk-UXMQI6B7.js.map +1 -0
  64. package/dist/chunk-WN75ORDT.js +571 -0
  65. package/dist/chunk-WN75ORDT.js.map +1 -0
  66. package/dist/chunk-Y55PYKXH.cjs +595 -0
  67. package/dist/chunk-Y55PYKXH.cjs.map +1 -0
  68. package/dist/chunk-YEZBTYCP.cjs +77 -0
  69. package/dist/chunk-YEZBTYCP.cjs.map +1 -0
  70. package/dist/chunk-ZQOIYCGA.cjs +1126 -0
  71. package/dist/chunk-ZQOIYCGA.cjs.map +1 -0
  72. package/dist/chunk-ZY3TSHMJ.cjs +2665 -0
  73. package/dist/chunk-ZY3TSHMJ.cjs.map +1 -0
  74. package/dist/client-DkVBHMWb.d.cts +2613 -0
  75. package/dist/client-V4AF6Bz9.d.ts +2613 -0
  76. package/dist/common/pda/index.cjs +145 -0
  77. package/dist/common/pda/index.cjs.map +1 -0
  78. package/dist/common/pda/index.d.cts +1250 -0
  79. package/dist/common/pda/index.d.ts +1250 -0
  80. package/dist/common/pda/index.js +8 -0
  81. package/dist/common/pda/index.js.map +1 -0
  82. package/dist/constants/index.cjs +38 -164
  83. package/dist/constants/index.cjs.map +1 -1
  84. package/dist/constants/index.d.cts +8 -425
  85. package/dist/constants/index.d.ts +8 -425
  86. package/dist/constants/index.js +15 -124
  87. package/dist/constants/index.js.map +1 -1
  88. package/dist/crypto/index.cjs +583 -0
  89. package/dist/crypto/index.cjs.map +1 -0
  90. package/dist/crypto/index.d.cts +6731 -0
  91. package/dist/crypto/index.d.ts +6731 -0
  92. package/dist/crypto/index.js +14 -0
  93. package/dist/crypto/index.js.map +1 -0
  94. package/dist/{cryptography-BTGC72u-.d.ts → cryptography-BFSJcvi6.d.ts} +3 -2465
  95. package/dist/{cryptography-BTGC72u-.d.cts → cryptography-D6tPDh-Y.d.cts} +3 -2465
  96. package/dist/errors/index.cjs +64 -54
  97. package/dist/errors/index.d.cts +7 -797
  98. package/dist/errors/index.d.ts +7 -797
  99. package/dist/errors/index.js +3 -1
  100. package/dist/errors-B9EoPeWV.d.cts +593 -0
  101. package/dist/errors-B9EoPeWV.d.ts +593 -0
  102. package/dist/errors-DAIrstEL.d.cts +300 -0
  103. package/dist/errors-DPNMfyh0.d.ts +300 -0
  104. package/dist/index-BG0yjL7C.d.cts +6006 -0
  105. package/dist/index-ByynoyBO.d.ts +6006 -0
  106. package/dist/index.cjs +5126 -16118
  107. package/dist/index.cjs.map +1 -1
  108. package/dist/index.d.cts +1031 -7685
  109. package/dist/index.d.ts +1031 -7685
  110. package/dist/index.js +3219 -14905
  111. package/dist/index.js.map +1 -1
  112. package/dist/interfaces/index.d.cts +14 -6
  113. package/dist/interfaces/index.d.ts +14 -6
  114. package/dist/interfaces-43cReBcS.d.cts +3346 -0
  115. package/dist/interfaces-B8xKNl_6.d.ts +997 -0
  116. package/dist/interfaces-D2NO6kDD.d.cts +997 -0
  117. package/dist/interfaces-z_xYJlgV.d.ts +3346 -0
  118. package/dist/math/index.cjs +115 -0
  119. package/dist/math/index.cjs.map +1 -0
  120. package/dist/math/index.d.cts +1327 -0
  121. package/dist/math/index.d.ts +1327 -0
  122. package/dist/math/index.js +10 -0
  123. package/dist/math/index.js.map +1 -0
  124. package/dist/networks-RMd3abPE.d.ts +44 -0
  125. package/dist/networks-yAoO8peQ.d.cts +44 -0
  126. package/dist/relayer-NRRMSMNB.js +4 -0
  127. package/dist/relayer-NRRMSMNB.js.map +1 -0
  128. package/dist/relayer-RJHEIXJG.cjs +21 -0
  129. package/dist/relayer-RJHEIXJG.cjs.map +1 -0
  130. package/dist/solana/index.cjs +56 -0
  131. package/dist/solana/index.cjs.map +1 -0
  132. package/dist/solana/index.d.cts +105 -0
  133. package/dist/solana/index.d.ts +105 -0
  134. package/dist/solana/index.js +7 -0
  135. package/dist/solana/index.js.map +1 -0
  136. package/dist/{index-CLj_zWSD.d.ts → temporal-BbRaEPoO.d.ts} +1 -1
  137. package/dist/{index-CX6_pIRS.d.cts → temporal-oUj7iCaq.d.cts} +1 -1
  138. package/dist/transaction-forwarder-5mAMTjw6.d.ts +1155 -0
  139. package/dist/transaction-forwarder-C6gMUG7a.d.cts +1155 -0
  140. package/dist/types/index.cjs +232 -231
  141. package/dist/types/index.d.cts +15 -1485
  142. package/dist/types/index.d.ts +15 -1485
  143. package/dist/types/index.js +2 -1
  144. package/dist/types-BohhvPth.d.cts +87 -0
  145. package/dist/types-CW0oTT0j.d.ts +87 -0
  146. package/dist/types-C_V_CaKK.d.cts +2468 -0
  147. package/dist/types-C_V_CaKK.d.ts +2468 -0
  148. package/dist/types-Ca7frykr.d.ts +793 -0
  149. package/dist/types-CuKeoI19.d.cts +1296 -0
  150. package/dist/types-CxfTIpN9.d.ts +1052 -0
  151. package/dist/{types-n-sHFcgr.d.ts → types-D1jDUjfN.d.ts} +2 -2
  152. package/dist/types-DKEDUlH9.d.ts +1296 -0
  153. package/dist/types-EKuIfxTz.d.cts +1052 -0
  154. package/dist/{types-BBuELtY8.d.cts → types-IMGYmlv-.d.cts} +2 -2
  155. package/dist/types-PwNLi_2k.d.cts +793 -0
  156. package/dist/utils/index.cjs +823 -525
  157. package/dist/utils/index.d.cts +1711 -4021
  158. package/dist/utils/index.d.ts +1711 -4021
  159. package/dist/utils/index.js +9 -3
  160. package/dist/{versions-D9PqsEvj.d.cts → versions-BRlR36EA.d.cts} +1 -0
  161. package/dist/{versions-D9PqsEvj.d.ts → versions-BRlR36EA.d.ts} +1 -0
  162. package/package.json +79 -18
  163. package/dist/chunk-2Q75CQQJ.js.map +0 -1
  164. package/dist/chunk-BM7N6N7E.js.map +0 -1
  165. package/dist/chunk-GXKSUB2U.cjs +0 -4416
  166. package/dist/chunk-GXKSUB2U.cjs.map +0 -1
  167. package/dist/chunk-HOEXDXRC.cjs.map +0 -1
  168. package/dist/chunk-MDFSBU5W.cjs.map +0 -1
  169. package/dist/chunk-MQY7HDIA.js +0 -600
  170. package/dist/chunk-MQY7HDIA.js.map +0 -1
  171. package/dist/chunk-MVKTV3FT.cjs.map +0 -1
  172. package/dist/chunk-PG2J6V6Y.js +0 -4094
  173. package/dist/chunk-PG2J6V6Y.js.map +0 -1
  174. package/dist/chunk-VEGLTTYQ.cjs +0 -621
  175. package/dist/chunk-VEGLTTYQ.cjs.map +0 -1
  176. package/dist/chunk-WVHQ46DD.js +0 -758
  177. package/dist/chunk-WVHQ46DD.js.map +0 -1
  178. package/dist/index-B9pDY73x.d.ts +0 -12933
  179. package/dist/index-D33yo0qB.d.cts +0 -12933
  180. package/dist/networks-C-orpSFW.d.ts +0 -65
  181. package/dist/networks-FxYERGD1.d.cts +0 -65
@@ -1,4 +1,6 @@
1
- export { ClaimUtxoError, ConversionError, CreateUtxoError, CryptographyAssertionError, CryptographyError, EncryptedDepositError, EncryptedWithdrawalError, FetchUtxosError, InstructionError, MasterSeedSigningRejectedError, MathematicsAssertionError, QueryError, RegistrationError, RpcError, SolanaAssertionError, TemporalAssertionError, TransactionError, TransactionSigningError, UmbraError, isClaimUtxoError, isConversionError, isCreateUtxoError, isCryptographyError, isEncryptedDepositError, isEncryptedWithdrawalError, isFetchUtxosError, isInstructionError, isQueryError, isRegistrationError, isRpcError, isTransactionError, isTransactionSigningError, isUmbraError } from '../chunk-WVHQ46DD.js';
1
+ export { ClaimUtxoError, ComputationMonitorError, ConversionError, CreateUtxoError, EncryptedDepositError, EncryptedWithdrawalError, FetchUtxosError, InstructionError, MasterSeedSigningRejectedError, QueryError, RegistrationError, RpcError, TransactionError, TransactionSigningError, isClaimUtxoError, isComputationMonitorError, isConversionError, isCreateUtxoError, isEncryptedDepositError, isEncryptedWithdrawalError, isFetchUtxosError, isInstructionError, isQueryError, isRegistrationError, isRpcError, isTransactionError, isTransactionSigningError } from '../chunk-GP26R377.js';
2
+ export { CryptographyError, isCryptographyError } from '../chunk-5KPQXPQM.js';
3
+ export { CryptographyAssertionError, MathematicsAssertionError, SolanaAssertionError, TemporalAssertionError, UmbraError, isUmbraError } from '../chunk-4TZVXB5G.js';
2
4
  import '../chunk-7QVYU63E.js';
3
5
  //# sourceMappingURL=index.js.map
4
6
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,593 @@
1
+ /**
2
+ * Error Classes
3
+ *
4
+ * Centralized error hierarchy for the Umbra SDK.
5
+ * Contains the base `UmbraError` and all domain-specific assertion error classes.
6
+ *
7
+ * @remarks
8
+ * The SDK uses a two-level error hierarchy:
9
+ *
10
+ * 1. `UmbraError` — top-level base class for all SDK errors. Consumers can use
11
+ * `instanceof UmbraError` (or the `isUmbraError` type guard) to distinguish SDK errors
12
+ * from third-party or built-in errors in a catch block.
13
+ *
14
+ * 2. Domain assertion errors — thrown by type-assertion functions when a value fails
15
+ * validation. Each domain has its own class to make it easy to catch errors from a
16
+ * specific subsystem:
17
+ * - `MathematicsAssertionError` — thrown by `assertU8`, `assertU256`, etc.
18
+ * - `CryptographyAssertionError` — thrown by `assertBn254FieldElement`, `assertAesKey`, etc.
19
+ * - `SolanaAssertionError` — thrown by Solana-type assertion functions.
20
+ * - `TemporalAssertionError` — thrown by `assertYear`, `assertMonth`, etc.
21
+ *
22
+ * All four assertion error classes share the same three properties:
23
+ * - `value` — the actual value that failed
24
+ * - `expectedType` — the name of the expected branded type
25
+ * - `constraint` — optional human-readable constraint description
26
+ *
27
+ * @packageDocumentation
28
+ * @since 2.0.0
29
+ * @module common/errors
30
+ */
31
+ /**
32
+ * Base error class for all Umbra SDK errors.
33
+ *
34
+ * All errors thrown by the SDK extend this class, allowing consumers
35
+ * to distinguish SDK errors from other errors using `instanceof`.
36
+ *
37
+ * @remarks
38
+ * Prefer using the `isUmbraError` type guard over `instanceof UmbraError` when writing
39
+ * defensive catch handlers — the type guard also works across module boundaries and
40
+ * iframe/realm boundaries where `instanceof` may fail due to different class references.
41
+ *
42
+ * Sub-classes (domain assertion errors) extend this class so callers can catch either
43
+ * all SDK errors at once (`instanceof UmbraError`) or only a specific domain's failures
44
+ * (e.g., `instanceof MathematicsAssertionError`).
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * try {
49
+ * await umbraClient.register();
50
+ * } catch (error) {
51
+ * if (error instanceof UmbraError) {
52
+ * console.log('SDK error:', error.message);
53
+ * console.log('Error code:', error.code);
54
+ * } else {
55
+ * throw error; // Re-throw non-SDK errors
56
+ * }
57
+ * }
58
+ * ```
59
+ *
60
+ * @see {@link isUmbraError}
61
+ * @public
62
+ */
63
+ declare class UmbraError extends Error {
64
+ /**
65
+ * A machine-readable error code for programmatic error handling.
66
+ *
67
+ * @remarks
68
+ * Defaults to `"UMBRA_ERROR"` when no code is supplied in the constructor options.
69
+ * Sub-classes or specific throw sites should supply a more specific code to allow
70
+ * callers to branch on error identity without string-matching `message`.
71
+ *
72
+ * @readonly
73
+ */
74
+ readonly code: string;
75
+ /**
76
+ * Additional context about the error.
77
+ *
78
+ * @remarks
79
+ * A free-form key-value map of diagnostic data attached to the error at the throw site.
80
+ * Useful for logging and debugging — consumers should not rely on specific keys for
81
+ * control flow; use `code` for programmatic branching instead.
82
+ *
83
+ * Will be `undefined` when no context was provided to the constructor.
84
+ *
85
+ * @readonly
86
+ */
87
+ readonly context?: Record<string, unknown>;
88
+ /**
89
+ * The original error that caused this error, if any.
90
+ *
91
+ * @remarks
92
+ * When an SDK function wraps a lower-level error (e.g., a failed RPC call or a
93
+ * cryptographic library error), it sets `cause` to the original thrown value so
94
+ * callers can inspect the full error chain.
95
+ *
96
+ * Will be `undefined` when there is no underlying cause.
97
+ *
98
+ * @readonly
99
+ */
100
+ readonly cause?: unknown;
101
+ /**
102
+ * Creates a new UmbraError.
103
+ *
104
+ * @param message - Human-readable description of what went wrong. Should be
105
+ * actionable and specific enough for a developer to understand the failure
106
+ * without reading source code.
107
+ * @param options - Optional structured metadata attached to the error.
108
+ * @param options.code - Machine-readable error code for programmatic branching.
109
+ * Defaults to `"UMBRA_ERROR"` if omitted.
110
+ * @param options.context - Free-form diagnostic key-value pairs. Omit or set to
111
+ * `undefined` to leave the `context` property unset.
112
+ * @param options.cause - The original error that triggered this one. Enables
113
+ * full error-chain inspection. Omit or set to `undefined` when there is no
114
+ * underlying cause.
115
+ *
116
+ * @defaultValue `options` — `undefined` (all options optional)
117
+ * @defaultValue `options.code` — `"UMBRA_ERROR"`
118
+ */
119
+ constructor(message: string, options?: {
120
+ code?: string;
121
+ context?: Record<string, unknown>;
122
+ cause?: unknown;
123
+ });
124
+ }
125
+ /**
126
+ * Type guard to check if an error is an UmbraError.
127
+ *
128
+ * @remarks
129
+ * Prefer this guard over `error instanceof UmbraError` in generic catch handlers because
130
+ * it is safe to call with any value (including `null`, primitives, and non-Error objects)
131
+ * and narrows the type to `UmbraError` for TypeScript's type system in the true branch.
132
+ *
133
+ * @param error - The value to test. Typically the caught value in a `catch (error)` block,
134
+ * typed as `unknown`.
135
+ * @returns `true` and narrows `error` to `UmbraError` when the value is an instance of
136
+ * `UmbraError` (or any sub-class such as `MathematicsAssertionError`). Returns `false`
137
+ * for all other values.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * try {
142
+ * await operation();
143
+ * } catch (error) {
144
+ * if (isUmbraError(error)) {
145
+ * // error is narrowed to UmbraError here
146
+ * console.log('SDK error code:', error.code);
147
+ * console.log('SDK error context:', error.context);
148
+ * }
149
+ * }
150
+ * ```
151
+ *
152
+ * @see {@link UmbraError}
153
+ * @public
154
+ */
155
+ declare function isUmbraError(error: unknown): error is UmbraError;
156
+ /**
157
+ * Error thrown when a value fails a mathematical type assertion.
158
+ *
159
+ * This error provides detailed information about why an assertion failed,
160
+ * including the actual value, the expected type, and the constraint that
161
+ * was violated.
162
+ *
163
+ * @remarks
164
+ * All assertion functions in the mathematics module (e.g., `assertU8`, `assertU256`,
165
+ * `assertU32LeBytes`) throw this error type on failure. Catch it specifically to handle
166
+ * mathematical type validation failures differently from cryptographic or Solana errors.
167
+ *
168
+ * The three diagnostic properties together allow automated logging pipelines to produce
169
+ * structured records without parsing the `message` string:
170
+ * - `value` — the actual value that was supplied
171
+ * - `expectedType` — the branded type name (e.g., `"U8"`, `"U256LeBytes"`)
172
+ * - `constraint` — the violated range or length rule, or `undefined` for type mismatches
173
+ *
174
+ * Note that this class does NOT extend `UmbraError`. It extends `Error` directly to keep
175
+ * the assertion error classes lightweight and independent of the UmbraError hierarchy.
176
+ * Use `isUmbraError` only to detect top-level SDK operational errors; use
177
+ * `instanceof MathematicsAssertionError` for assertion failures.
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * import { assertU8, MathematicsAssertionError } from "./mathematics";
182
+ *
183
+ * try {
184
+ * const value = assertU8(256n); // Will throw
185
+ * } catch (error) {
186
+ * if (error instanceof MathematicsAssertionError) {
187
+ * console.error(`Assertion failed for ${error.expectedType}`);
188
+ * console.error(`Value: ${error.value}`);
189
+ * console.error(`Constraint: ${error.constraint}`);
190
+ * // Output:
191
+ * // Assertion failed for U8
192
+ * // Value: 256
193
+ * // Constraint: 0 <= value <= 255
194
+ * }
195
+ * }
196
+ * ```
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * // Safe parse pattern — returns null instead of throwing
201
+ * function safeParseU8(value: bigint): U8 | null {
202
+ * try {
203
+ * return assertU8(value);
204
+ * } catch (error) {
205
+ * if (error instanceof MathematicsAssertionError) {
206
+ * console.warn(`Invalid U8 value: ${value}`);
207
+ * return null;
208
+ * }
209
+ * throw error; // Re-throw unexpected errors
210
+ * }
211
+ * }
212
+ * ```
213
+ *
214
+ * @sealed
215
+ * @public
216
+ */
217
+ declare class MathematicsAssertionError extends Error {
218
+ /**
219
+ * The actual value that failed the assertion.
220
+ *
221
+ * @remarks
222
+ * The runtime type reflects what was actually passed to the assertion function:
223
+ * - `bigint` for integer assertions (`assertU8`, `assertU256`, etc.)
224
+ * - `Uint8Array` for byte-array assertions (`assertU256LeBytes`, `assertU32LeBytes`, etc.)
225
+ * - Any other type when a non-numeric value was passed unexpectedly
226
+ *
227
+ * @readonly
228
+ */
229
+ readonly value: unknown;
230
+ /**
231
+ * The type that was expected.
232
+ *
233
+ * @remarks
234
+ * Contains the branded type name exactly as it appears in the SDK type system,
235
+ * e.g., `"U8"`, `"U256"`, `"U32LeBytes"`. Use this for structured logging or
236
+ * to build user-facing error messages without parsing the `message` string.
237
+ *
238
+ * @readonly
239
+ */
240
+ readonly expectedType: string;
241
+ /**
242
+ * Description of the constraint that was violated.
243
+ *
244
+ * @remarks
245
+ * Is `undefined` when only a type check failed (e.g., a `string` was passed where a
246
+ * `bigint` was expected). Contains a human-readable inequality or length rule when a
247
+ * value of the correct type was out of the allowed range.
248
+ *
249
+ * @example
250
+ * - `"0 <= value <= 255"` — U8 range violation
251
+ * - `"length === 32"` — U256LeBytes length violation
252
+ * - `"value >= 0"` — negative value passed to an unsigned integer assertion
253
+ *
254
+ * @readonly
255
+ */
256
+ readonly constraint: string | undefined;
257
+ /**
258
+ * Creates a new MathematicsAssertionError.
259
+ *
260
+ * @param message - Human-readable description of the assertion failure. Should name
261
+ * the assertion function, the expected type, and the constraint that was violated.
262
+ * @param options - Structured diagnostic details attached to the error.
263
+ * @param options.value - The actual value that was supplied and failed the assertion.
264
+ * @param options.expectedType - The name of the branded type that was expected
265
+ * (e.g., `"U8"`, `"U256LeBytes"`).
266
+ * @param options.constraint - Optional human-readable constraint description
267
+ * (e.g., `"0 <= value <= 255"`). Omit when the failure is a type mismatch rather
268
+ * than a range violation.
269
+ */
270
+ constructor(message: string, options: {
271
+ value: unknown;
272
+ expectedType: string;
273
+ constraint?: string;
274
+ });
275
+ }
276
+ /**
277
+ * Error thrown when a value fails a cryptographic type assertion.
278
+ *
279
+ * This error provides detailed information about why an assertion failed,
280
+ * including the actual value, the expected type, and the constraint that
281
+ * was violated.
282
+ *
283
+ * @remarks
284
+ * Thrown by assertion functions in the cryptography module, such as
285
+ * `assertBn254FieldElement`, `assertAesKey`, `assertX25519PrivateKey`, and similar.
286
+ * Each function validates that a value conforms to a branded cryptographic type,
287
+ * throwing this error with a precise `expectedType` and `constraint` when it does not.
288
+ *
289
+ * Common reasons for failure:
290
+ * - A `bigint` field element exceeds the BN254 or Curve25519 field prime
291
+ * - A byte array has the wrong length (e.g., a 31-byte array passed as an AES-256 key)
292
+ * - A wrong JavaScript type was supplied (e.g., a `number` instead of a `bigint`)
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * import { assertBn254FieldElement, CryptographyAssertionError } from "./cryptography";
297
+ *
298
+ * try {
299
+ * assertBn254FieldElement(invalidValue); // Will throw
300
+ * } catch (error) {
301
+ * if (error instanceof CryptographyAssertionError) {
302
+ * console.error(`Assertion failed for ${error.expectedType}`);
303
+ * console.error(`Value: ${error.value}`);
304
+ * console.error(`Constraint: ${error.constraint}`);
305
+ * }
306
+ * }
307
+ * ```
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * // Distinguish cryptographic assertion failures from mathematical ones
312
+ * try {
313
+ * const key = assertAesKey(rawBytes);
314
+ * } catch (error) {
315
+ * if (error instanceof CryptographyAssertionError) {
316
+ * console.warn("Crypto assertion failed:", error.expectedType, error.constraint);
317
+ * } else if (error instanceof MathematicsAssertionError) {
318
+ * console.warn("Math assertion failed:", error.expectedType, error.constraint);
319
+ * }
320
+ * }
321
+ * ```
322
+ *
323
+ * @see {@link MathematicsAssertionError}
324
+ * @see {@link SolanaAssertionError}
325
+ * @see {@link TemporalAssertionError}
326
+ * @sealed
327
+ * @public
328
+ */
329
+ declare class CryptographyAssertionError extends Error {
330
+ /**
331
+ * The actual value that failed the assertion.
332
+ *
333
+ * @remarks
334
+ * The runtime type reflects what was actually passed to the assertion function:
335
+ * - `bigint` for field element assertions (`assertBn254FieldElement`, etc.)
336
+ * - `Uint8Array` for byte-array assertions (`assertAesKey`, `assertX25519PrivateKey`, etc.)
337
+ * - Any other type when an entirely wrong value type was supplied
338
+ *
339
+ * @readonly
340
+ */
341
+ readonly value: unknown;
342
+ /**
343
+ * The type that was expected (e.g., `"Bn254FieldElement"`, `"PoseidonKey"`, `"AesKey"`).
344
+ *
345
+ * @remarks
346
+ * Contains the branded type name exactly as it appears in the SDK type system.
347
+ * Use this property for structured logging without parsing the `message` string.
348
+ *
349
+ * @readonly
350
+ */
351
+ readonly expectedType: string;
352
+ /**
353
+ * Description of the constraint that was violated.
354
+ *
355
+ * @remarks
356
+ * Is `undefined` for pure type-mismatch failures (e.g., `string` instead of `bigint`).
357
+ * Contains a human-readable constraint description for range and length violations
358
+ * (e.g., `"value < BN254_FIELD_PRIME"`, `"length === 32"`).
359
+ *
360
+ * @readonly
361
+ */
362
+ readonly constraint: string | undefined;
363
+ /**
364
+ * Creates a new CryptographyAssertionError.
365
+ *
366
+ * @param message - Human-readable description of the assertion failure. Should name
367
+ * the assertion function, the expected type, and the constraint that was violated.
368
+ * @param options - Structured diagnostic details attached to the error.
369
+ * @param options.value - The actual value that was supplied and failed the assertion.
370
+ * @param options.expectedType - The name of the branded cryptographic type that was
371
+ * expected (e.g., `"Bn254FieldElement"`, `"AesKey"`).
372
+ * @param options.constraint - Optional human-readable constraint description.
373
+ * Omit when the failure is a type mismatch rather than a range or length violation.
374
+ */
375
+ constructor(message: string, options: {
376
+ value: unknown;
377
+ expectedType: string;
378
+ constraint?: string;
379
+ });
380
+ }
381
+ /**
382
+ * Error thrown when a Solana type assertion fails.
383
+ *
384
+ * This error provides detailed information about why the assertion failed,
385
+ * including the actual value, expected type, and constraint that was violated.
386
+ *
387
+ * @remarks
388
+ * Thrown by assertion functions for Solana-specific branded types, such as
389
+ * `assertTransactionSignature`, `assertSignatureBytes`, and similar validators.
390
+ * These assertions verify that string or byte-array values conform to Solana's
391
+ * encoding and length conventions (e.g., Base58-encoded 64-byte Ed25519 signatures).
392
+ *
393
+ * Common reasons for failure:
394
+ * - A string that fails Base58 decoding or has the wrong decoded length
395
+ * - A `Uint8Array` with the wrong byte length for a signature or public key
396
+ * - A wrong JavaScript type (e.g., `number` instead of `string`)
397
+ *
398
+ * @example
399
+ * ```typescript
400
+ * import { assertTransactionSignature, SolanaAssertionError } from "./solana";
401
+ *
402
+ * try {
403
+ * assertTransactionSignature("invalid!signature"); // Will throw
404
+ * } catch (error) {
405
+ * if (error instanceof SolanaAssertionError) {
406
+ * console.error(`Assertion failed for ${error.expectedType}`);
407
+ * console.error(`Value: ${error.value}`);
408
+ * console.error(`Constraint: ${error.constraint}`);
409
+ * }
410
+ * }
411
+ * ```
412
+ *
413
+ * @example
414
+ * ```typescript
415
+ * // Safe parse pattern — returns null on failure
416
+ * function tryParseSignature(raw: unknown): TransactionSignature | null {
417
+ * try {
418
+ * return assertTransactionSignature(raw);
419
+ * } catch (error) {
420
+ * if (error instanceof SolanaAssertionError) return null;
421
+ * throw error;
422
+ * }
423
+ * }
424
+ * ```
425
+ *
426
+ * @see {@link MathematicsAssertionError}
427
+ * @see {@link CryptographyAssertionError}
428
+ * @see {@link TemporalAssertionError}
429
+ * @sealed
430
+ * @public
431
+ */
432
+ declare class SolanaAssertionError extends Error {
433
+ /**
434
+ * The actual value that failed the assertion.
435
+ *
436
+ * @remarks
437
+ * The runtime type reflects what was actually passed to the assertion function:
438
+ * - `string` for Base58-encoded assertions (`assertTransactionSignature`, etc.)
439
+ * - `Uint8Array` for byte-array assertions (`assertSignatureBytes`, etc.)
440
+ * - Any other type when a completely wrong value type was supplied
441
+ *
442
+ * @readonly
443
+ */
444
+ readonly value: unknown;
445
+ /**
446
+ * The type that was expected (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
447
+ *
448
+ * @remarks
449
+ * Contains the branded type name exactly as it appears in the SDK type system.
450
+ * Use this for structured logging without parsing the `message` string.
451
+ *
452
+ * @readonly
453
+ */
454
+ readonly expectedType: string;
455
+ /**
456
+ * Description of the constraint that was violated.
457
+ *
458
+ * @remarks
459
+ * Is `undefined` for pure type-mismatch failures. Contains a human-readable rule
460
+ * for encoding or length violations (e.g., `"valid Base58"`, `"length === 64"`).
461
+ *
462
+ * @readonly
463
+ */
464
+ readonly constraint: string | undefined;
465
+ /**
466
+ * Creates a new SolanaAssertionError.
467
+ *
468
+ * @param message - Human-readable description of the assertion failure. Should name
469
+ * the assertion function, the expected type, and the constraint that was violated.
470
+ * @param options - Structured diagnostic details attached to the error.
471
+ * @param options.value - The actual value that was supplied and failed the assertion.
472
+ * @param options.expectedType - The name of the branded Solana type that was expected
473
+ * (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
474
+ * @param options.constraint - Optional human-readable constraint description.
475
+ * Omit when the failure is a type mismatch rather than an encoding or length violation.
476
+ */
477
+ constructor(message: string, options: {
478
+ value: unknown;
479
+ expectedType: string;
480
+ constraint?: string;
481
+ });
482
+ }
483
+ /**
484
+ * Error thrown when a temporal type assertion fails.
485
+ *
486
+ * This error provides detailed information about why an assertion failed,
487
+ * including the actual value, the expected type, and the constraint that
488
+ * was violated.
489
+ *
490
+ * @remarks
491
+ * Thrown by assertion functions for branded temporal types: `assertYear`, `assertMonth`,
492
+ * `assertDay`, `assertHour`, `assertMinute`, and `assertSecond`. These functions validate
493
+ * that a `bigint` value falls within the calendar range appropriate for each component
494
+ * (e.g., months must be in `[1, 12]`, hours in `[0, 23]`).
495
+ *
496
+ * Temporal assertions are used to validate the output of UTC timestamp extraction before
497
+ * the components are used in time-scoped viewing key derivation. In normal operation they
498
+ * should never throw (JavaScript's `Date` always produces in-range values), but callers
499
+ * that construct components manually can encounter these errors.
500
+ *
501
+ * @example
502
+ * ```typescript
503
+ * import { assertMonth, TemporalAssertionError } from "./temporal";
504
+ *
505
+ * try {
506
+ * assertMonth(13n); // Will throw — month must be 1–12
507
+ * } catch (error) {
508
+ * if (error instanceof TemporalAssertionError) {
509
+ * console.error(`Assertion failed for ${error.expectedType}`);
510
+ * console.error(`Value: ${error.value}`);
511
+ * console.error(`Constraint: ${error.constraint}`);
512
+ * // Output:
513
+ * // Assertion failed for Month
514
+ * // Value: 13
515
+ * // Constraint: 1 <= value <= 12
516
+ * }
517
+ * }
518
+ * ```
519
+ *
520
+ * @example
521
+ * ```typescript
522
+ * // Safe parse of a user-supplied year value
523
+ * function tryParseYear(raw: bigint): Year | null {
524
+ * try {
525
+ * return assertYear(raw);
526
+ * } catch (error) {
527
+ * if (error instanceof TemporalAssertionError) return null;
528
+ * throw error;
529
+ * }
530
+ * }
531
+ * ```
532
+ *
533
+ * @see {@link MathematicsAssertionError}
534
+ * @see {@link CryptographyAssertionError}
535
+ * @see {@link SolanaAssertionError}
536
+ * @sealed
537
+ * @public
538
+ */
539
+ declare class TemporalAssertionError extends Error {
540
+ /**
541
+ * The actual value that failed the assertion.
542
+ *
543
+ * @remarks
544
+ * Will be a `bigint` for all temporal assertions since the temporal types are
545
+ * BigInt-backed branded types (e.g., `Year`, `Month`, `Day`). May also be any
546
+ * other type when a non-bigint value was supplied unexpectedly.
547
+ *
548
+ * @readonly
549
+ */
550
+ readonly value: unknown;
551
+ /**
552
+ * The type that was expected (e.g., `"Year"`, `"Month"`, `"Hour"`).
553
+ *
554
+ * @remarks
555
+ * Contains the branded temporal type name exactly as it appears in the SDK type system.
556
+ * Use this for structured logging without parsing the `message` string.
557
+ *
558
+ * @readonly
559
+ */
560
+ readonly expectedType: string;
561
+ /**
562
+ * Description of the constraint that was violated.
563
+ *
564
+ * @remarks
565
+ * Contains a human-readable range rule for out-of-range values
566
+ * (e.g., `"1 <= value <= 12"` for a month violation). Is `undefined` only for
567
+ * pure type-mismatch failures (e.g., a `string` passed where a `bigint` was expected),
568
+ * which should not occur in normal usage.
569
+ *
570
+ * @readonly
571
+ */
572
+ readonly constraint: string | undefined;
573
+ /**
574
+ * Creates a new TemporalAssertionError.
575
+ *
576
+ * @param message - Human-readable description of the assertion failure. Should name
577
+ * the assertion function, the expected type, and the violated range constraint.
578
+ * @param details - Structured diagnostic details attached to the error.
579
+ * @param details.value - The actual `bigint` value (or other type) that was supplied
580
+ * and failed the temporal assertion.
581
+ * @param details.expectedType - The name of the branded temporal type that was expected
582
+ * (e.g., `"Year"`, `"Month"`, `"Hour"`).
583
+ * @param details.constraint - Optional human-readable range description
584
+ * (e.g., `"1 <= value <= 12"`). Omit when the failure is a type mismatch.
585
+ */
586
+ constructor(message: string, details: {
587
+ value: unknown;
588
+ expectedType: string;
589
+ constraint?: string;
590
+ });
591
+ }
592
+
593
+ export { CryptographyAssertionError as C, MathematicsAssertionError as M, SolanaAssertionError as S, TemporalAssertionError as T, UmbraError as U, isUmbraError as i };