@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
@@ -0,0 +1,300 @@
1
+ import { U as UmbraError } from './errors-B9EoPeWV.cjs';
2
+
3
+ /**
4
+ * Arcium Error Classes
5
+ *
6
+ * Provides error classes for Arcium MPC computation monitoring failures.
7
+ * Each error carries a {@link ComputationMonitorStage} field that identifies
8
+ * exactly where in the monitoring pipeline the failure occurred.
9
+ *
10
+ * @module arcium/errors
11
+ * @since 2.0.0
12
+ */
13
+
14
+ /**
15
+ * Stage of the computation monitoring operation where an error occurred.
16
+ *
17
+ * @remarks
18
+ * Each stage represents a distinct phase in the monitoring flow:
19
+ *
20
+ * - `subscription` — WebSocket subscription setup or notification stream failed
21
+ * - `account-fetch` — HTTP RPC fetch of the ComputationAccount failed
22
+ * - `account-decode` — Failed to decode the ComputationAccount from raw bytes
23
+ * - `timeout` — Monitoring timed out before the computation finalized
24
+ * - `signature-retrieval` — `getSignaturesForAddress` call failed after finalization
25
+ *
26
+ * @since 2.0.0
27
+ * @public
28
+ */
29
+ type ComputationMonitorStage = "subscription" | "account-fetch" | "account-decode" | "timeout" | "signature-retrieval";
30
+ /**
31
+ * Error thrown when a computation monitoring operation fails.
32
+ *
33
+ * @remarks
34
+ * Thrown by {@link ComputationMonitor} implementations when the monitoring
35
+ * loop encounters an unrecoverable failure. The {@link stage} field identifies
36
+ * exactly where in the monitoring pipeline the failure occurred, enabling
37
+ * callers to implement targeted recovery strategies.
38
+ *
39
+ * The error code follows the format `COMPUTATION_MONITOR_{STAGE}` where
40
+ * `{STAGE}` is the uppercase, underscore-delimited stage name.
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * try {
45
+ * const result = await monitor.awaitComputation(computationAddress, {
46
+ * timeoutMs: 60_000,
47
+ * });
48
+ * } catch (error) {
49
+ * if (isComputationMonitorError(error)) {
50
+ * switch (error.stage) {
51
+ * case "timeout":
52
+ * console.log("MPC computation did not finalize in time");
53
+ * break;
54
+ * case "subscription":
55
+ * console.log("WebSocket connection failed — try polling monitor");
56
+ * break;
57
+ * }
58
+ * }
59
+ * }
60
+ * ```
61
+ *
62
+ * @since 2.0.0
63
+ * @public
64
+ */
65
+ declare class ComputationMonitorError extends UmbraError {
66
+ /** The monitoring stage where the failure occurred. */
67
+ readonly stage: ComputationMonitorStage;
68
+ /**
69
+ * @param stage - The monitoring pipeline stage where the failure occurred.
70
+ * @param message - A human-readable description of the error.
71
+ * @param cause - The underlying error that caused this failure, if any.
72
+ */
73
+ constructor(stage: ComputationMonitorStage, message: string, cause?: Error);
74
+ }
75
+ /**
76
+ * Type guard to check if a value is a {@link ComputationMonitorError}.
77
+ *
78
+ * @param error - The value to test.
79
+ * @returns `true` and narrows `error` to {@link ComputationMonitorError} when
80
+ * the value is an instance of `ComputationMonitorError`.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * catch (error) {
85
+ * if (isComputationMonitorError(error)) {
86
+ * console.log(error.stage); // TypeScript knows this is ComputationMonitorStage
87
+ * }
88
+ * }
89
+ * ```
90
+ *
91
+ * @since 2.0.0
92
+ * @public
93
+ */
94
+ declare function isComputationMonitorError(error: unknown): error is ComputationMonitorError;
95
+
96
+ /**
97
+ * Umbra Error Classes
98
+ *
99
+ * This module provides error classes for all Umbra SDK operation failures,
100
+ * each carrying a `stage` field that identifies exactly where in the pipeline
101
+ * the failure occurred.
102
+ *
103
+ * @since 2.0.0
104
+ * @module umbra/errors
105
+ */
106
+
107
+ /**
108
+ * Stage of the encrypted deposit operation where an error occurred.
109
+ *
110
+ * Each stage represents a distinct phase in the deposit flow:
111
+ *
112
+ * | Stage | Description |
113
+ * |-------|-------------|
114
+ * | `initialization` | Factory-level validation failed |
115
+ * | `validation` | Input parameter validation failed |
116
+ * | `mint-fetch` | Failed to fetch mint account data |
117
+ * | `fee-calculation` | Failed to calculate transfer fee |
118
+ * | `pda-derivation` | PDA address generation failed |
119
+ * | `account-fetch` | Failed to fetch account data from RPC |
120
+ * | `instruction-build` | Failed to build the deposit instruction |
121
+ * | `transaction-build` | Failed to build transaction message |
122
+ * | `transaction-compile` | Failed to compile the transaction |
123
+ * | `transaction-sign` | Failed to sign the transaction |
124
+ * | `transaction-validate` | Transaction validation failed |
125
+ * | `transaction-send` | Failed to send or confirm the transaction |
126
+ */
127
+ type EncryptedDepositStage = "initialization" | "validation" | "mint-fetch" | "fee-calculation" | "pda-derivation" | "account-fetch" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
128
+ /** Error thrown when an encrypted deposit operation fails. */
129
+ declare class EncryptedDepositError extends UmbraError {
130
+ readonly stage: EncryptedDepositStage;
131
+ constructor(stage: EncryptedDepositStage, message: string, cause?: Error);
132
+ }
133
+ /** Type guard to check if an error is an EncryptedDepositError. */
134
+ declare function isEncryptedDepositError(error: unknown): error is EncryptedDepositError;
135
+ /**
136
+ * Stage of the encrypted withdrawal operation where an error occurred.
137
+ *
138
+ * | Stage | Description |
139
+ * |-------|-------------|
140
+ * | `initialization` | Factory-level validation failed |
141
+ * | `validation` | Input parameter validation failed |
142
+ * | `mint-fetch` | Failed to fetch mint account data |
143
+ * | `pda-derivation` | PDA address generation failed |
144
+ * | `instruction-build` | Failed to build the withdrawal instruction |
145
+ * | `transaction-build` | Failed to build transaction message |
146
+ * | `transaction-compile` | Failed to compile the transaction |
147
+ * | `transaction-sign` | Failed to sign the transaction |
148
+ * | `transaction-send` | Failed to send or confirm the transaction |
149
+ */
150
+ type EncryptedWithdrawalStage = "initialization" | "validation" | "mint-fetch" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-send";
151
+ /** Error thrown when an encrypted withdrawal operation fails. */
152
+ declare class EncryptedWithdrawalError extends UmbraError {
153
+ readonly stage: EncryptedWithdrawalStage;
154
+ constructor(stage: EncryptedWithdrawalStage, message: string, cause?: Error);
155
+ }
156
+ /** Type guard to check if an error is an EncryptedWithdrawalError. */
157
+ declare function isEncryptedWithdrawalError(error: unknown): error is EncryptedWithdrawalError;
158
+ /**
159
+ * Stage of the user registration operation where an error occurred.
160
+ *
161
+ * | Stage | Description |
162
+ * |-------|-------------|
163
+ * | `initialization` | Factory-level validation failed |
164
+ * | `master-seed-derivation` | Master seed signing was rejected or failed |
165
+ * | `account-fetch` | RPC call to read existing registration state failed |
166
+ * | `key-derivation` | Cryptographic key derivation from master seed failed |
167
+ * | `zk-proof-generation` | Groth16 proof generation failed (anonymous step) |
168
+ * | `pda-derivation` | PDA address generation failed |
169
+ * | `instruction-build` | Failed to build an instruction |
170
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
171
+ * | `transaction-compile` | Failed to compile the transaction |
172
+ * | `transaction-sign` | Wallet rejected signing |
173
+ * | `transaction-validate` | Pre-flight simulation failed |
174
+ * | `transaction-send` | Transaction sent but confirmation timed out |
175
+ */
176
+ type RegistrationStage = "initialization" | "master-seed-derivation" | "account-fetch" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
177
+ /** Error thrown when a user registration operation fails. */
178
+ declare class RegistrationError extends UmbraError {
179
+ readonly stage: RegistrationStage;
180
+ constructor(stage: RegistrationStage, message: string, cause?: unknown);
181
+ }
182
+ /** Type guard to check if an error is a RegistrationError. */
183
+ declare function isRegistrationError(error: unknown): error is RegistrationError;
184
+ /**
185
+ * Stage of the MXE-to-Shared conversion operation where an error occurred.
186
+ *
187
+ * | Stage | Description |
188
+ * |-------|-------------|
189
+ * | `initialization` | Factory-level validation failed |
190
+ * | `account-fetch` | Batch RPC fetch of token account PDAs failed |
191
+ * | `pda-derivation` | PDA address generation failed |
192
+ * | `instruction-build` | Failed to build a conversion instruction |
193
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
194
+ * | `transaction-compile` | Failed to compile the transaction |
195
+ * | `transaction-sign` | Wallet rejected signing for a per-mint transaction |
196
+ * | `transaction-validate` | Pre-flight simulation failed |
197
+ * | `transaction-send` | Transaction sent but confirmation timed out |
198
+ */
199
+ type ConversionStage = "initialization" | "account-fetch" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
200
+ /** Error thrown when an MXE-to-Shared conversion operation fails. */
201
+ declare class ConversionError extends UmbraError {
202
+ readonly stage: ConversionStage;
203
+ constructor(stage: ConversionStage, message: string, cause?: unknown);
204
+ }
205
+ /** Type guard to check if an error is a ConversionError. */
206
+ declare function isConversionError(error: unknown): error is ConversionError;
207
+ /**
208
+ * Stage of a UTXO creation operation where an error occurred.
209
+ *
210
+ * | Stage | Description |
211
+ * |-------|-------------|
212
+ * | `initialization` | Factory-level validation failed |
213
+ * | `validation` | Input parameter validation failed |
214
+ * | `account-fetch` | Failed to fetch recipient or token account data |
215
+ * | `mint-fetch` | Failed to fetch mint account data |
216
+ * | `fee-calculation` | Token-2022 transfer fee calculation failed |
217
+ * | `key-derivation` | Key derivation from master seed failed |
218
+ * | `zk-proof-generation` | Groth16 proof generation failed |
219
+ * | `pda-derivation` | PDA address generation failed |
220
+ * | `instruction-build` | Failed to build an instruction |
221
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
222
+ * | `transaction-compile` | Failed to compile the transaction |
223
+ * | `transaction-sign` | Wallet rejected signing |
224
+ * | `transaction-validate` | Pre-flight simulation failed |
225
+ * | `transaction-send` | Transaction sent but confirmation timed out |
226
+ */
227
+ type CreateUtxoStage = "initialization" | "validation" | "account-fetch" | "mint-fetch" | "fee-calculation" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
228
+ /** Error thrown when a UTXO creation operation fails. */
229
+ declare class CreateUtxoError extends UmbraError {
230
+ readonly stage: CreateUtxoStage;
231
+ constructor(stage: CreateUtxoStage, message: string, cause?: unknown);
232
+ }
233
+ /** Type guard to check if an error is a CreateUtxoError. */
234
+ declare function isCreateUtxoError(error: unknown): error is CreateUtxoError;
235
+ /**
236
+ * Stage of a UTXO fetch operation where an error occurred.
237
+ *
238
+ * | Stage | Description |
239
+ * |-------|-------------|
240
+ * | `initialization` | Factory construction failed — missing indexerApiEndpoint |
241
+ * | `validation` | Invalid tree index or insertion index parameters |
242
+ * | `key-derivation` | X25519 private key derivation from master seed failed |
243
+ * | `indexer-fetch` | Indexer HTTP call failed |
244
+ * | `proof-fetch` | Merkle proof HTTP call failed |
245
+ */
246
+ type FetchUtxosStage = "initialization" | "validation" | "key-derivation" | "indexer-fetch" | "proof-fetch" | "proof-enrichment";
247
+ /** Error thrown when a UTXO fetch operation fails. */
248
+ declare class FetchUtxosError extends UmbraError {
249
+ readonly stage: FetchUtxosStage;
250
+ constructor(stage: FetchUtxosStage, message: string, cause?: unknown);
251
+ }
252
+ /** Type guard to check if an error is a FetchUtxosError. */
253
+ declare function isFetchUtxosError(error: unknown): error is FetchUtxosError;
254
+ /**
255
+ * Stage of a UTXO claim operation where an error occurred.
256
+ *
257
+ * | Stage | Description |
258
+ * |-------|-------------|
259
+ * | `initialization` | Factory-level validation failed |
260
+ * | `validation` | Invalid UTXO data or Merkle proof parameters |
261
+ * | `key-derivation` | Key derivation from master seed failed |
262
+ * | `zk-proof-generation` | Groth16 proof generation failed |
263
+ * | `pda-derivation` | PDA address generation failed |
264
+ * | `instruction-build` | Failed to build an instruction |
265
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
266
+ * | `transaction-compile` | Failed to compile the transaction |
267
+ * | `transaction-sign` | Wallet rejected signing |
268
+ * | `transaction-validate` | Pre-flight simulation failed — also surfaces stale Merkle proof |
269
+ * | `transaction-send` | Transaction sent but confirmation timed out |
270
+ */
271
+ type ClaimUtxoStage = "initialization" | "validation" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
272
+ /** Error thrown when a UTXO claim operation fails. */
273
+ declare class ClaimUtxoError extends UmbraError {
274
+ readonly stage: ClaimUtxoStage;
275
+ constructor(stage: ClaimUtxoStage, message: string, cause?: unknown);
276
+ }
277
+ /** Type guard to check if an error is a ClaimUtxoError. */
278
+ declare function isClaimUtxoError(error: unknown): error is ClaimUtxoError;
279
+ /**
280
+ * Stage of a query operation where an error occurred.
281
+ *
282
+ * | Stage | Description |
283
+ * |-------|-------------|
284
+ * | `initialization` | Factory-level validation failed |
285
+ * | `pda-derivation` | PDA address generation failed |
286
+ * | `account-fetch` | RPC fetch failed |
287
+ * | `account-decode` | On-chain account data could not be decoded |
288
+ * | `key-derivation` | X25519 key derivation failed (encrypted balance query) |
289
+ * | `decryption` | Rescue cipher decryption failed (encrypted balance query) |
290
+ */
291
+ type QueryStage = "initialization" | "pda-derivation" | "account-fetch" | "account-decode" | "key-derivation" | "decryption";
292
+ /** Error thrown when a query operation fails. */
293
+ declare class QueryError extends UmbraError {
294
+ readonly stage: QueryStage;
295
+ constructor(stage: QueryStage, message: string, cause?: unknown);
296
+ }
297
+ /** Type guard to check if an error is a QueryError. */
298
+ declare function isQueryError(error: unknown): error is QueryError;
299
+
300
+ export { ClaimUtxoError as C, EncryptedDepositError as E, FetchUtxosError as F, QueryError as Q, RegistrationError as R, type ClaimUtxoStage as a, ComputationMonitorError as b, type ComputationMonitorStage as c, ConversionError as d, type ConversionStage as e, CreateUtxoError as f, type CreateUtxoStage as g, type EncryptedDepositStage as h, EncryptedWithdrawalError as i, type EncryptedWithdrawalStage as j, type FetchUtxosStage as k, type QueryStage as l, type RegistrationStage as m, isClaimUtxoError as n, isComputationMonitorError as o, isConversionError as p, isCreateUtxoError as q, isEncryptedDepositError as r, isEncryptedWithdrawalError as s, isFetchUtxosError as t, isQueryError as u, isRegistrationError as v };
@@ -0,0 +1,300 @@
1
+ import { U as UmbraError } from './errors-B9EoPeWV.js';
2
+
3
+ /**
4
+ * Arcium Error Classes
5
+ *
6
+ * Provides error classes for Arcium MPC computation monitoring failures.
7
+ * Each error carries a {@link ComputationMonitorStage} field that identifies
8
+ * exactly where in the monitoring pipeline the failure occurred.
9
+ *
10
+ * @module arcium/errors
11
+ * @since 2.0.0
12
+ */
13
+
14
+ /**
15
+ * Stage of the computation monitoring operation where an error occurred.
16
+ *
17
+ * @remarks
18
+ * Each stage represents a distinct phase in the monitoring flow:
19
+ *
20
+ * - `subscription` — WebSocket subscription setup or notification stream failed
21
+ * - `account-fetch` — HTTP RPC fetch of the ComputationAccount failed
22
+ * - `account-decode` — Failed to decode the ComputationAccount from raw bytes
23
+ * - `timeout` — Monitoring timed out before the computation finalized
24
+ * - `signature-retrieval` — `getSignaturesForAddress` call failed after finalization
25
+ *
26
+ * @since 2.0.0
27
+ * @public
28
+ */
29
+ type ComputationMonitorStage = "subscription" | "account-fetch" | "account-decode" | "timeout" | "signature-retrieval";
30
+ /**
31
+ * Error thrown when a computation monitoring operation fails.
32
+ *
33
+ * @remarks
34
+ * Thrown by {@link ComputationMonitor} implementations when the monitoring
35
+ * loop encounters an unrecoverable failure. The {@link stage} field identifies
36
+ * exactly where in the monitoring pipeline the failure occurred, enabling
37
+ * callers to implement targeted recovery strategies.
38
+ *
39
+ * The error code follows the format `COMPUTATION_MONITOR_{STAGE}` where
40
+ * `{STAGE}` is the uppercase, underscore-delimited stage name.
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * try {
45
+ * const result = await monitor.awaitComputation(computationAddress, {
46
+ * timeoutMs: 60_000,
47
+ * });
48
+ * } catch (error) {
49
+ * if (isComputationMonitorError(error)) {
50
+ * switch (error.stage) {
51
+ * case "timeout":
52
+ * console.log("MPC computation did not finalize in time");
53
+ * break;
54
+ * case "subscription":
55
+ * console.log("WebSocket connection failed — try polling monitor");
56
+ * break;
57
+ * }
58
+ * }
59
+ * }
60
+ * ```
61
+ *
62
+ * @since 2.0.0
63
+ * @public
64
+ */
65
+ declare class ComputationMonitorError extends UmbraError {
66
+ /** The monitoring stage where the failure occurred. */
67
+ readonly stage: ComputationMonitorStage;
68
+ /**
69
+ * @param stage - The monitoring pipeline stage where the failure occurred.
70
+ * @param message - A human-readable description of the error.
71
+ * @param cause - The underlying error that caused this failure, if any.
72
+ */
73
+ constructor(stage: ComputationMonitorStage, message: string, cause?: Error);
74
+ }
75
+ /**
76
+ * Type guard to check if a value is a {@link ComputationMonitorError}.
77
+ *
78
+ * @param error - The value to test.
79
+ * @returns `true` and narrows `error` to {@link ComputationMonitorError} when
80
+ * the value is an instance of `ComputationMonitorError`.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * catch (error) {
85
+ * if (isComputationMonitorError(error)) {
86
+ * console.log(error.stage); // TypeScript knows this is ComputationMonitorStage
87
+ * }
88
+ * }
89
+ * ```
90
+ *
91
+ * @since 2.0.0
92
+ * @public
93
+ */
94
+ declare function isComputationMonitorError(error: unknown): error is ComputationMonitorError;
95
+
96
+ /**
97
+ * Umbra Error Classes
98
+ *
99
+ * This module provides error classes for all Umbra SDK operation failures,
100
+ * each carrying a `stage` field that identifies exactly where in the pipeline
101
+ * the failure occurred.
102
+ *
103
+ * @since 2.0.0
104
+ * @module umbra/errors
105
+ */
106
+
107
+ /**
108
+ * Stage of the encrypted deposit operation where an error occurred.
109
+ *
110
+ * Each stage represents a distinct phase in the deposit flow:
111
+ *
112
+ * | Stage | Description |
113
+ * |-------|-------------|
114
+ * | `initialization` | Factory-level validation failed |
115
+ * | `validation` | Input parameter validation failed |
116
+ * | `mint-fetch` | Failed to fetch mint account data |
117
+ * | `fee-calculation` | Failed to calculate transfer fee |
118
+ * | `pda-derivation` | PDA address generation failed |
119
+ * | `account-fetch` | Failed to fetch account data from RPC |
120
+ * | `instruction-build` | Failed to build the deposit instruction |
121
+ * | `transaction-build` | Failed to build transaction message |
122
+ * | `transaction-compile` | Failed to compile the transaction |
123
+ * | `transaction-sign` | Failed to sign the transaction |
124
+ * | `transaction-validate` | Transaction validation failed |
125
+ * | `transaction-send` | Failed to send or confirm the transaction |
126
+ */
127
+ type EncryptedDepositStage = "initialization" | "validation" | "mint-fetch" | "fee-calculation" | "pda-derivation" | "account-fetch" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
128
+ /** Error thrown when an encrypted deposit operation fails. */
129
+ declare class EncryptedDepositError extends UmbraError {
130
+ readonly stage: EncryptedDepositStage;
131
+ constructor(stage: EncryptedDepositStage, message: string, cause?: Error);
132
+ }
133
+ /** Type guard to check if an error is an EncryptedDepositError. */
134
+ declare function isEncryptedDepositError(error: unknown): error is EncryptedDepositError;
135
+ /**
136
+ * Stage of the encrypted withdrawal operation where an error occurred.
137
+ *
138
+ * | Stage | Description |
139
+ * |-------|-------------|
140
+ * | `initialization` | Factory-level validation failed |
141
+ * | `validation` | Input parameter validation failed |
142
+ * | `mint-fetch` | Failed to fetch mint account data |
143
+ * | `pda-derivation` | PDA address generation failed |
144
+ * | `instruction-build` | Failed to build the withdrawal instruction |
145
+ * | `transaction-build` | Failed to build transaction message |
146
+ * | `transaction-compile` | Failed to compile the transaction |
147
+ * | `transaction-sign` | Failed to sign the transaction |
148
+ * | `transaction-send` | Failed to send or confirm the transaction |
149
+ */
150
+ type EncryptedWithdrawalStage = "initialization" | "validation" | "mint-fetch" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-send";
151
+ /** Error thrown when an encrypted withdrawal operation fails. */
152
+ declare class EncryptedWithdrawalError extends UmbraError {
153
+ readonly stage: EncryptedWithdrawalStage;
154
+ constructor(stage: EncryptedWithdrawalStage, message: string, cause?: Error);
155
+ }
156
+ /** Type guard to check if an error is an EncryptedWithdrawalError. */
157
+ declare function isEncryptedWithdrawalError(error: unknown): error is EncryptedWithdrawalError;
158
+ /**
159
+ * Stage of the user registration operation where an error occurred.
160
+ *
161
+ * | Stage | Description |
162
+ * |-------|-------------|
163
+ * | `initialization` | Factory-level validation failed |
164
+ * | `master-seed-derivation` | Master seed signing was rejected or failed |
165
+ * | `account-fetch` | RPC call to read existing registration state failed |
166
+ * | `key-derivation` | Cryptographic key derivation from master seed failed |
167
+ * | `zk-proof-generation` | Groth16 proof generation failed (anonymous step) |
168
+ * | `pda-derivation` | PDA address generation failed |
169
+ * | `instruction-build` | Failed to build an instruction |
170
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
171
+ * | `transaction-compile` | Failed to compile the transaction |
172
+ * | `transaction-sign` | Wallet rejected signing |
173
+ * | `transaction-validate` | Pre-flight simulation failed |
174
+ * | `transaction-send` | Transaction sent but confirmation timed out |
175
+ */
176
+ type RegistrationStage = "initialization" | "master-seed-derivation" | "account-fetch" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
177
+ /** Error thrown when a user registration operation fails. */
178
+ declare class RegistrationError extends UmbraError {
179
+ readonly stage: RegistrationStage;
180
+ constructor(stage: RegistrationStage, message: string, cause?: unknown);
181
+ }
182
+ /** Type guard to check if an error is a RegistrationError. */
183
+ declare function isRegistrationError(error: unknown): error is RegistrationError;
184
+ /**
185
+ * Stage of the MXE-to-Shared conversion operation where an error occurred.
186
+ *
187
+ * | Stage | Description |
188
+ * |-------|-------------|
189
+ * | `initialization` | Factory-level validation failed |
190
+ * | `account-fetch` | Batch RPC fetch of token account PDAs failed |
191
+ * | `pda-derivation` | PDA address generation failed |
192
+ * | `instruction-build` | Failed to build a conversion instruction |
193
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
194
+ * | `transaction-compile` | Failed to compile the transaction |
195
+ * | `transaction-sign` | Wallet rejected signing for a per-mint transaction |
196
+ * | `transaction-validate` | Pre-flight simulation failed |
197
+ * | `transaction-send` | Transaction sent but confirmation timed out |
198
+ */
199
+ type ConversionStage = "initialization" | "account-fetch" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
200
+ /** Error thrown when an MXE-to-Shared conversion operation fails. */
201
+ declare class ConversionError extends UmbraError {
202
+ readonly stage: ConversionStage;
203
+ constructor(stage: ConversionStage, message: string, cause?: unknown);
204
+ }
205
+ /** Type guard to check if an error is a ConversionError. */
206
+ declare function isConversionError(error: unknown): error is ConversionError;
207
+ /**
208
+ * Stage of a UTXO creation operation where an error occurred.
209
+ *
210
+ * | Stage | Description |
211
+ * |-------|-------------|
212
+ * | `initialization` | Factory-level validation failed |
213
+ * | `validation` | Input parameter validation failed |
214
+ * | `account-fetch` | Failed to fetch recipient or token account data |
215
+ * | `mint-fetch` | Failed to fetch mint account data |
216
+ * | `fee-calculation` | Token-2022 transfer fee calculation failed |
217
+ * | `key-derivation` | Key derivation from master seed failed |
218
+ * | `zk-proof-generation` | Groth16 proof generation failed |
219
+ * | `pda-derivation` | PDA address generation failed |
220
+ * | `instruction-build` | Failed to build an instruction |
221
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
222
+ * | `transaction-compile` | Failed to compile the transaction |
223
+ * | `transaction-sign` | Wallet rejected signing |
224
+ * | `transaction-validate` | Pre-flight simulation failed |
225
+ * | `transaction-send` | Transaction sent but confirmation timed out |
226
+ */
227
+ type CreateUtxoStage = "initialization" | "validation" | "account-fetch" | "mint-fetch" | "fee-calculation" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
228
+ /** Error thrown when a UTXO creation operation fails. */
229
+ declare class CreateUtxoError extends UmbraError {
230
+ readonly stage: CreateUtxoStage;
231
+ constructor(stage: CreateUtxoStage, message: string, cause?: unknown);
232
+ }
233
+ /** Type guard to check if an error is a CreateUtxoError. */
234
+ declare function isCreateUtxoError(error: unknown): error is CreateUtxoError;
235
+ /**
236
+ * Stage of a UTXO fetch operation where an error occurred.
237
+ *
238
+ * | Stage | Description |
239
+ * |-------|-------------|
240
+ * | `initialization` | Factory construction failed — missing indexerApiEndpoint |
241
+ * | `validation` | Invalid tree index or insertion index parameters |
242
+ * | `key-derivation` | X25519 private key derivation from master seed failed |
243
+ * | `indexer-fetch` | Indexer HTTP call failed |
244
+ * | `proof-fetch` | Merkle proof HTTP call failed |
245
+ */
246
+ type FetchUtxosStage = "initialization" | "validation" | "key-derivation" | "indexer-fetch" | "proof-fetch" | "proof-enrichment";
247
+ /** Error thrown when a UTXO fetch operation fails. */
248
+ declare class FetchUtxosError extends UmbraError {
249
+ readonly stage: FetchUtxosStage;
250
+ constructor(stage: FetchUtxosStage, message: string, cause?: unknown);
251
+ }
252
+ /** Type guard to check if an error is a FetchUtxosError. */
253
+ declare function isFetchUtxosError(error: unknown): error is FetchUtxosError;
254
+ /**
255
+ * Stage of a UTXO claim operation where an error occurred.
256
+ *
257
+ * | Stage | Description |
258
+ * |-------|-------------|
259
+ * | `initialization` | Factory-level validation failed |
260
+ * | `validation` | Invalid UTXO data or Merkle proof parameters |
261
+ * | `key-derivation` | Key derivation from master seed failed |
262
+ * | `zk-proof-generation` | Groth16 proof generation failed |
263
+ * | `pda-derivation` | PDA address generation failed |
264
+ * | `instruction-build` | Failed to build an instruction |
265
+ * | `transaction-build` | Blockhash fetch or transaction assembly failed |
266
+ * | `transaction-compile` | Failed to compile the transaction |
267
+ * | `transaction-sign` | Wallet rejected signing |
268
+ * | `transaction-validate` | Pre-flight simulation failed — also surfaces stale Merkle proof |
269
+ * | `transaction-send` | Transaction sent but confirmation timed out |
270
+ */
271
+ type ClaimUtxoStage = "initialization" | "validation" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
272
+ /** Error thrown when a UTXO claim operation fails. */
273
+ declare class ClaimUtxoError extends UmbraError {
274
+ readonly stage: ClaimUtxoStage;
275
+ constructor(stage: ClaimUtxoStage, message: string, cause?: unknown);
276
+ }
277
+ /** Type guard to check if an error is a ClaimUtxoError. */
278
+ declare function isClaimUtxoError(error: unknown): error is ClaimUtxoError;
279
+ /**
280
+ * Stage of a query operation where an error occurred.
281
+ *
282
+ * | Stage | Description |
283
+ * |-------|-------------|
284
+ * | `initialization` | Factory-level validation failed |
285
+ * | `pda-derivation` | PDA address generation failed |
286
+ * | `account-fetch` | RPC fetch failed |
287
+ * | `account-decode` | On-chain account data could not be decoded |
288
+ * | `key-derivation` | X25519 key derivation failed (encrypted balance query) |
289
+ * | `decryption` | Rescue cipher decryption failed (encrypted balance query) |
290
+ */
291
+ type QueryStage = "initialization" | "pda-derivation" | "account-fetch" | "account-decode" | "key-derivation" | "decryption";
292
+ /** Error thrown when a query operation fails. */
293
+ declare class QueryError extends UmbraError {
294
+ readonly stage: QueryStage;
295
+ constructor(stage: QueryStage, message: string, cause?: unknown);
296
+ }
297
+ /** Type guard to check if an error is a QueryError. */
298
+ declare function isQueryError(error: unknown): error is QueryError;
299
+
300
+ export { ClaimUtxoError as C, EncryptedDepositError as E, FetchUtxosError as F, QueryError as Q, RegistrationError as R, type ClaimUtxoStage as a, ComputationMonitorError as b, type ComputationMonitorStage as c, ConversionError as d, type ConversionStage as e, CreateUtxoError as f, type CreateUtxoStage as g, type EncryptedDepositStage as h, EncryptedWithdrawalError as i, type EncryptedWithdrawalStage as j, type FetchUtxosStage as k, type QueryStage as l, type RegistrationStage as m, isClaimUtxoError as n, isComputationMonitorError as o, isConversionError as p, isCreateUtxoError as q, isEncryptedDepositError as r, isEncryptedWithdrawalError as s, isFetchUtxosError as t, isQueryError as u, isRegistrationError as v };