@umbra-privacy/sdk 1.0.0 → 2.0.1
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.
- package/README.md +104 -25
- package/dist/{addresses-Brzgurv_.d.ts → addresses-B7HybtbJ.d.ts} +2 -1
- package/dist/{addresses-D_0YAS6B.d.cts → addresses-CTVY1oi7.d.cts} +2 -1
- package/dist/arcium-BXXlryfe.d.cts +20 -0
- package/dist/arcium-BXXlryfe.d.ts +20 -0
- package/dist/chunk-3LS5P32X.cjs +10892 -0
- package/dist/chunk-3LS5P32X.cjs.map +1 -0
- package/dist/chunk-4RHXVBNI.js +203 -0
- package/dist/chunk-4RHXVBNI.js.map +1 -0
- package/dist/chunk-4TZVXB5G.js +324 -0
- package/dist/chunk-4TZVXB5G.js.map +1 -0
- package/dist/chunk-5GUSMQ74.cjs +549 -0
- package/dist/chunk-5GUSMQ74.cjs.map +1 -0
- package/dist/chunk-5KPQXPQM.js +36 -0
- package/dist/chunk-5KPQXPQM.js.map +1 -0
- package/dist/chunk-AXD7LXYY.cjs +405 -0
- package/dist/chunk-AXD7LXYY.cjs.map +1 -0
- package/dist/{chunk-HOEXDXRC.cjs → chunk-BL6WXLPV.cjs} +32 -360
- package/dist/chunk-BL6WXLPV.cjs.map +1 -0
- package/dist/chunk-CFFLOE7D.cjs +598 -0
- package/dist/chunk-CFFLOE7D.cjs.map +1 -0
- package/dist/{chunk-BM7N6N7E.js → chunk-CFTW5WNG.js} +3 -325
- package/dist/chunk-CFTW5WNG.js.map +1 -0
- package/dist/chunk-DD2WCK4C.js +327 -0
- package/dist/chunk-DD2WCK4C.js.map +1 -0
- package/dist/chunk-DMPMQ74B.cjs +246 -0
- package/dist/chunk-DMPMQ74B.cjs.map +1 -0
- package/dist/{chunk-2Q75CQQJ.js → chunk-EEKF4553.js} +2 -2
- package/dist/chunk-EEKF4553.js.map +1 -0
- package/dist/chunk-ENVYYEM4.cjs +113 -0
- package/dist/chunk-ENVYYEM4.cjs.map +1 -0
- package/dist/chunk-FQX6ZYGJ.js +500 -0
- package/dist/chunk-FQX6ZYGJ.js.map +1 -0
- package/dist/chunk-FSK2ICMB.cjs +39 -0
- package/dist/chunk-FSK2ICMB.cjs.map +1 -0
- package/dist/chunk-FZYWLQAF.cjs +355 -0
- package/dist/chunk-FZYWLQAF.cjs.map +1 -0
- package/dist/chunk-GP26R377.js +436 -0
- package/dist/chunk-GP26R377.js.map +1 -0
- package/dist/chunk-HA5FLM63.js +393 -0
- package/dist/chunk-HA5FLM63.js.map +1 -0
- package/dist/chunk-INJ73LXQ.js +1107 -0
- package/dist/chunk-INJ73LXQ.js.map +1 -0
- package/dist/chunk-KMRROOME.js +10750 -0
- package/dist/chunk-KMRROOME.js.map +1 -0
- package/dist/{chunk-MDFSBU5W.cjs → chunk-LTCKPTZC.cjs} +2 -351
- package/dist/chunk-LTCKPTZC.cjs.map +1 -0
- package/dist/chunk-MKNCBUFA.js +564 -0
- package/dist/chunk-MKNCBUFA.js.map +1 -0
- package/dist/chunk-NKVMSABR.cjs +207 -0
- package/dist/chunk-NKVMSABR.cjs.map +1 -0
- package/dist/chunk-OFDWNWCL.js +70 -0
- package/dist/chunk-OFDWNWCL.js.map +1 -0
- package/dist/chunk-QJAUUYZU.cjs +331 -0
- package/dist/chunk-QJAUUYZU.cjs.map +1 -0
- package/dist/chunk-TLR7A64G.js +103 -0
- package/dist/chunk-TLR7A64G.js.map +1 -0
- package/dist/{chunk-MVKTV3FT.cjs → chunk-TQQZGNOI.cjs} +2 -2
- package/dist/chunk-TQQZGNOI.cjs.map +1 -0
- package/dist/chunk-UOFYS6M3.js +219 -0
- package/dist/chunk-UOFYS6M3.js.map +1 -0
- package/dist/chunk-UXMQI6B7.js +2406 -0
- package/dist/chunk-UXMQI6B7.js.map +1 -0
- package/dist/chunk-WN75ORDT.js +571 -0
- package/dist/chunk-WN75ORDT.js.map +1 -0
- package/dist/chunk-Y55PYKXH.cjs +595 -0
- package/dist/chunk-Y55PYKXH.cjs.map +1 -0
- package/dist/chunk-YEZBTYCP.cjs +77 -0
- package/dist/chunk-YEZBTYCP.cjs.map +1 -0
- package/dist/chunk-ZQOIYCGA.cjs +1126 -0
- package/dist/chunk-ZQOIYCGA.cjs.map +1 -0
- package/dist/chunk-ZY3TSHMJ.cjs +2665 -0
- package/dist/chunk-ZY3TSHMJ.cjs.map +1 -0
- package/dist/client-DkVBHMWb.d.cts +2613 -0
- package/dist/client-V4AF6Bz9.d.ts +2613 -0
- package/dist/common/pda/index.cjs +145 -0
- package/dist/common/pda/index.cjs.map +1 -0
- package/dist/common/pda/index.d.cts +1250 -0
- package/dist/common/pda/index.d.ts +1250 -0
- package/dist/common/pda/index.js +8 -0
- package/dist/common/pda/index.js.map +1 -0
- package/dist/constants/index.cjs +38 -164
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +8 -425
- package/dist/constants/index.d.ts +8 -425
- package/dist/constants/index.js +15 -124
- package/dist/constants/index.js.map +1 -1
- package/dist/crypto/index.cjs +583 -0
- package/dist/crypto/index.cjs.map +1 -0
- package/dist/crypto/index.d.cts +6731 -0
- package/dist/crypto/index.d.ts +6731 -0
- package/dist/crypto/index.js +14 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/{cryptography-BTGC72u-.d.ts → cryptography-BFSJcvi6.d.ts} +3 -2465
- package/dist/{cryptography-BTGC72u-.d.cts → cryptography-D6tPDh-Y.d.cts} +3 -2465
- package/dist/errors/index.cjs +64 -54
- package/dist/errors/index.d.cts +7 -797
- package/dist/errors/index.d.ts +7 -797
- package/dist/errors/index.js +3 -1
- package/dist/errors-B9EoPeWV.d.cts +593 -0
- package/dist/errors-B9EoPeWV.d.ts +593 -0
- package/dist/errors-DAIrstEL.d.cts +300 -0
- package/dist/errors-DPNMfyh0.d.ts +300 -0
- package/dist/index-BG0yjL7C.d.cts +6006 -0
- package/dist/index-ByynoyBO.d.ts +6006 -0
- package/dist/index.cjs +5133 -16116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1031 -7685
- package/dist/index.d.ts +1031 -7685
- package/dist/index.js +3228 -14905
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.cts +14 -6
- package/dist/interfaces/index.d.ts +14 -6
- package/dist/interfaces-43cReBcS.d.cts +3346 -0
- package/dist/interfaces-B8xKNl_6.d.ts +997 -0
- package/dist/interfaces-D2NO6kDD.d.cts +997 -0
- package/dist/interfaces-z_xYJlgV.d.ts +3346 -0
- package/dist/math/index.cjs +115 -0
- package/dist/math/index.cjs.map +1 -0
- package/dist/math/index.d.cts +1327 -0
- package/dist/math/index.d.ts +1327 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/networks-RMd3abPE.d.ts +44 -0
- package/dist/networks-yAoO8peQ.d.cts +44 -0
- package/dist/relayer-NRRMSMNB.js +4 -0
- package/dist/relayer-NRRMSMNB.js.map +1 -0
- package/dist/relayer-RJHEIXJG.cjs +21 -0
- package/dist/relayer-RJHEIXJG.cjs.map +1 -0
- package/dist/solana/index.cjs +56 -0
- package/dist/solana/index.cjs.map +1 -0
- package/dist/solana/index.d.cts +105 -0
- package/dist/solana/index.d.ts +105 -0
- package/dist/solana/index.js +7 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/{index-CLj_zWSD.d.ts → temporal-BbRaEPoO.d.ts} +1 -1
- package/dist/{index-CX6_pIRS.d.cts → temporal-oUj7iCaq.d.cts} +1 -1
- package/dist/transaction-forwarder-5mAMTjw6.d.ts +1155 -0
- package/dist/transaction-forwarder-C6gMUG7a.d.cts +1155 -0
- package/dist/types/index.cjs +232 -231
- package/dist/types/index.d.cts +15 -1485
- package/dist/types/index.d.ts +15 -1485
- package/dist/types/index.js +2 -1
- package/dist/types-BohhvPth.d.cts +87 -0
- package/dist/types-CW0oTT0j.d.ts +87 -0
- package/dist/types-C_V_CaKK.d.cts +2468 -0
- package/dist/types-C_V_CaKK.d.ts +2468 -0
- package/dist/types-Ca7frykr.d.ts +793 -0
- package/dist/types-CuKeoI19.d.cts +1296 -0
- package/dist/types-CxfTIpN9.d.ts +1052 -0
- package/dist/{types-n-sHFcgr.d.ts → types-D1jDUjfN.d.ts} +2 -2
- package/dist/types-DKEDUlH9.d.ts +1296 -0
- package/dist/types-EKuIfxTz.d.cts +1052 -0
- package/dist/{types-BBuELtY8.d.cts → types-IMGYmlv-.d.cts} +2 -2
- package/dist/types-PwNLi_2k.d.cts +793 -0
- package/dist/utils/index.cjs +823 -525
- package/dist/utils/index.d.cts +1711 -4021
- package/dist/utils/index.d.ts +1711 -4021
- package/dist/utils/index.js +9 -3
- package/dist/{versions-D9PqsEvj.d.cts → versions-BRlR36EA.d.cts} +1 -0
- package/dist/{versions-D9PqsEvj.d.ts → versions-BRlR36EA.d.ts} +1 -0
- package/package.json +79 -18
- package/dist/chunk-2Q75CQQJ.js.map +0 -1
- package/dist/chunk-BM7N6N7E.js.map +0 -1
- package/dist/chunk-GXKSUB2U.cjs +0 -4416
- package/dist/chunk-GXKSUB2U.cjs.map +0 -1
- package/dist/chunk-HOEXDXRC.cjs.map +0 -1
- package/dist/chunk-MDFSBU5W.cjs.map +0 -1
- package/dist/chunk-MQY7HDIA.js +0 -600
- package/dist/chunk-MQY7HDIA.js.map +0 -1
- package/dist/chunk-MVKTV3FT.cjs.map +0 -1
- package/dist/chunk-PG2J6V6Y.js +0 -4094
- package/dist/chunk-PG2J6V6Y.js.map +0 -1
- package/dist/chunk-VEGLTTYQ.cjs +0 -621
- package/dist/chunk-VEGLTTYQ.cjs.map +0 -1
- package/dist/chunk-WVHQ46DD.js +0 -758
- package/dist/chunk-WVHQ46DD.js.map +0 -1
- package/dist/index-B9pDY73x.d.ts +0 -12933
- package/dist/index-D33yo0qB.d.cts +0 -12933
- package/dist/networks-C-orpSFW.d.ts +0 -65
- package/dist/networks-FxYERGD1.d.cts +0 -65
|
@@ -1,358 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkQJAUUYZU_cjs = require('./chunk-QJAUUYZU.cjs');
|
|
3
4
|
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
4
5
|
|
|
5
|
-
// src/
|
|
6
|
-
var
|
|
6
|
+
// src/arcium/errors.ts
|
|
7
|
+
var ComputationMonitorError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
7
8
|
static {
|
|
8
|
-
chunkPK6SKIKE_cjs.__name(this, "
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A machine-readable error code for programmatic error handling.
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* Defaults to `"UMBRA_ERROR"` when no code is supplied in the constructor options.
|
|
15
|
-
* Sub-classes or specific throw sites should supply a more specific code to allow
|
|
16
|
-
* callers to branch on error identity without string-matching `message`.
|
|
17
|
-
*
|
|
18
|
-
* @readonly
|
|
19
|
-
*/
|
|
20
|
-
code;
|
|
21
|
-
/**
|
|
22
|
-
* Additional context about the error.
|
|
23
|
-
*
|
|
24
|
-
* @remarks
|
|
25
|
-
* A free-form key-value map of diagnostic data attached to the error at the throw site.
|
|
26
|
-
* Useful for logging and debugging — consumers should not rely on specific keys for
|
|
27
|
-
* control flow; use `code` for programmatic branching instead.
|
|
28
|
-
*
|
|
29
|
-
* Will be `undefined` when no context was provided to the constructor.
|
|
30
|
-
*
|
|
31
|
-
* @readonly
|
|
32
|
-
*/
|
|
33
|
-
context;
|
|
34
|
-
/**
|
|
35
|
-
* The original error that caused this error, if any.
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* When an SDK function wraps a lower-level error (e.g., a failed RPC call or a
|
|
39
|
-
* cryptographic library error), it sets `cause` to the original thrown value so
|
|
40
|
-
* callers can inspect the full error chain.
|
|
41
|
-
*
|
|
42
|
-
* Will be `undefined` when there is no underlying cause.
|
|
43
|
-
*
|
|
44
|
-
* @readonly
|
|
45
|
-
*/
|
|
46
|
-
cause;
|
|
47
|
-
/**
|
|
48
|
-
* Creates a new UmbraError.
|
|
49
|
-
*
|
|
50
|
-
* @param message - Human-readable description of what went wrong. Should be
|
|
51
|
-
* actionable and specific enough for a developer to understand the failure
|
|
52
|
-
* without reading source code.
|
|
53
|
-
* @param options - Optional structured metadata attached to the error.
|
|
54
|
-
* @param options.code - Machine-readable error code for programmatic branching.
|
|
55
|
-
* Defaults to `"UMBRA_ERROR"` if omitted.
|
|
56
|
-
* @param options.context - Free-form diagnostic key-value pairs. Omit or set to
|
|
57
|
-
* `undefined` to leave the `context` property unset.
|
|
58
|
-
* @param options.cause - The original error that triggered this one. Enables
|
|
59
|
-
* full error-chain inspection. Omit or set to `undefined` when there is no
|
|
60
|
-
* underlying cause.
|
|
61
|
-
*
|
|
62
|
-
* @defaultValue `options` — `undefined` (all options optional)
|
|
63
|
-
* @defaultValue `options.code` — `"UMBRA_ERROR"`
|
|
64
|
-
*/
|
|
65
|
-
constructor(message, options) {
|
|
66
|
-
super(message);
|
|
67
|
-
this.name = "UmbraError";
|
|
68
|
-
this.code = options?.code ?? "UMBRA_ERROR";
|
|
69
|
-
if (options?.context !== void 0) {
|
|
70
|
-
this.context = options.context;
|
|
71
|
-
}
|
|
72
|
-
if (options?.cause !== void 0) {
|
|
73
|
-
this.cause = options.cause;
|
|
74
|
-
}
|
|
75
|
-
Error.captureStackTrace(this, _UmbraError);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
function isUmbraError(error) {
|
|
79
|
-
return error instanceof UmbraError;
|
|
80
|
-
}
|
|
81
|
-
chunkPK6SKIKE_cjs.__name(isUmbraError, "isUmbraError");
|
|
82
|
-
var MathematicsAssertionError = class _MathematicsAssertionError extends Error {
|
|
83
|
-
static {
|
|
84
|
-
chunkPK6SKIKE_cjs.__name(this, "MathematicsAssertionError");
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* The actual value that failed the assertion.
|
|
88
|
-
*
|
|
89
|
-
* @remarks
|
|
90
|
-
* The runtime type reflects what was actually passed to the assertion function:
|
|
91
|
-
* - `bigint` for integer assertions (`assertU8`, `assertU256`, etc.)
|
|
92
|
-
* - `Uint8Array` for byte-array assertions (`assertU256LeBytes`, `assertU32LeBytes`, etc.)
|
|
93
|
-
* - Any other type when a non-numeric value was passed unexpectedly
|
|
94
|
-
*
|
|
95
|
-
* @readonly
|
|
96
|
-
*/
|
|
97
|
-
value;
|
|
98
|
-
/**
|
|
99
|
-
* The type that was expected.
|
|
100
|
-
*
|
|
101
|
-
* @remarks
|
|
102
|
-
* Contains the branded type name exactly as it appears in the SDK type system,
|
|
103
|
-
* e.g., `"U8"`, `"U256"`, `"U32LeBytes"`. Use this for structured logging or
|
|
104
|
-
* to build user-facing error messages without parsing the `message` string.
|
|
105
|
-
*
|
|
106
|
-
* @readonly
|
|
107
|
-
*/
|
|
108
|
-
expectedType;
|
|
109
|
-
/**
|
|
110
|
-
* Description of the constraint that was violated.
|
|
111
|
-
*
|
|
112
|
-
* @remarks
|
|
113
|
-
* Is `undefined` when only a type check failed (e.g., a `string` was passed where a
|
|
114
|
-
* `bigint` was expected). Contains a human-readable inequality or length rule when a
|
|
115
|
-
* value of the correct type was out of the allowed range.
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* - `"0 <= value <= 255"` — U8 range violation
|
|
119
|
-
* - `"length === 32"` — U256LeBytes length violation
|
|
120
|
-
* - `"value >= 0"` — negative value passed to an unsigned integer assertion
|
|
121
|
-
*
|
|
122
|
-
* @readonly
|
|
123
|
-
*/
|
|
124
|
-
constraint;
|
|
125
|
-
/**
|
|
126
|
-
* Creates a new MathematicsAssertionError.
|
|
127
|
-
*
|
|
128
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
129
|
-
* the assertion function, the expected type, and the constraint that was violated.
|
|
130
|
-
* @param options - Structured diagnostic details attached to the error.
|
|
131
|
-
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
132
|
-
* @param options.expectedType - The name of the branded type that was expected
|
|
133
|
-
* (e.g., `"U8"`, `"U256LeBytes"`).
|
|
134
|
-
* @param options.constraint - Optional human-readable constraint description
|
|
135
|
-
* (e.g., `"0 <= value <= 255"`). Omit when the failure is a type mismatch rather
|
|
136
|
-
* than a range violation.
|
|
137
|
-
*/
|
|
138
|
-
constructor(message, options) {
|
|
139
|
-
super(message);
|
|
140
|
-
this.name = "MathematicsAssertionError";
|
|
141
|
-
this.value = options.value;
|
|
142
|
-
this.expectedType = options.expectedType;
|
|
143
|
-
this.constraint = options.constraint;
|
|
144
|
-
Error.captureStackTrace(this, _MathematicsAssertionError);
|
|
145
|
-
Object.setPrototypeOf(this, _MathematicsAssertionError.prototype);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
var CryptographyAssertionError = class _CryptographyAssertionError extends Error {
|
|
149
|
-
static {
|
|
150
|
-
chunkPK6SKIKE_cjs.__name(this, "CryptographyAssertionError");
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* The actual value that failed the assertion.
|
|
154
|
-
*
|
|
155
|
-
* @remarks
|
|
156
|
-
* The runtime type reflects what was actually passed to the assertion function:
|
|
157
|
-
* - `bigint` for field element assertions (`assertBn254FieldElement`, etc.)
|
|
158
|
-
* - `Uint8Array` for byte-array assertions (`assertAesKey`, `assertX25519PrivateKey`, etc.)
|
|
159
|
-
* - Any other type when an entirely wrong value type was supplied
|
|
160
|
-
*
|
|
161
|
-
* @readonly
|
|
162
|
-
*/
|
|
163
|
-
value;
|
|
164
|
-
/**
|
|
165
|
-
* The type that was expected (e.g., `"Bn254FieldElement"`, `"PoseidonKey"`, `"AesKey"`).
|
|
166
|
-
*
|
|
167
|
-
* @remarks
|
|
168
|
-
* Contains the branded type name exactly as it appears in the SDK type system.
|
|
169
|
-
* Use this property for structured logging without parsing the `message` string.
|
|
170
|
-
*
|
|
171
|
-
* @readonly
|
|
172
|
-
*/
|
|
173
|
-
expectedType;
|
|
174
|
-
/**
|
|
175
|
-
* Description of the constraint that was violated.
|
|
176
|
-
*
|
|
177
|
-
* @remarks
|
|
178
|
-
* Is `undefined` for pure type-mismatch failures (e.g., `string` instead of `bigint`).
|
|
179
|
-
* Contains a human-readable constraint description for range and length violations
|
|
180
|
-
* (e.g., `"value < BN254_FIELD_PRIME"`, `"length === 32"`).
|
|
181
|
-
*
|
|
182
|
-
* @readonly
|
|
183
|
-
*/
|
|
184
|
-
constraint;
|
|
185
|
-
/**
|
|
186
|
-
* Creates a new CryptographyAssertionError.
|
|
187
|
-
*
|
|
188
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
189
|
-
* the assertion function, the expected type, and the constraint that was violated.
|
|
190
|
-
* @param options - Structured diagnostic details attached to the error.
|
|
191
|
-
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
192
|
-
* @param options.expectedType - The name of the branded cryptographic type that was
|
|
193
|
-
* expected (e.g., `"Bn254FieldElement"`, `"AesKey"`).
|
|
194
|
-
* @param options.constraint - Optional human-readable constraint description.
|
|
195
|
-
* Omit when the failure is a type mismatch rather than a range or length violation.
|
|
196
|
-
*/
|
|
197
|
-
constructor(message, options) {
|
|
198
|
-
super(message);
|
|
199
|
-
this.name = "CryptographyAssertionError";
|
|
200
|
-
this.value = options.value;
|
|
201
|
-
this.expectedType = options.expectedType;
|
|
202
|
-
this.constraint = options.constraint;
|
|
203
|
-
Error.captureStackTrace(this, _CryptographyAssertionError);
|
|
204
|
-
Object.setPrototypeOf(this, _CryptographyAssertionError.prototype);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
var SolanaAssertionError = class _SolanaAssertionError extends Error {
|
|
208
|
-
static {
|
|
209
|
-
chunkPK6SKIKE_cjs.__name(this, "SolanaAssertionError");
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* The actual value that failed the assertion.
|
|
213
|
-
*
|
|
214
|
-
* @remarks
|
|
215
|
-
* The runtime type reflects what was actually passed to the assertion function:
|
|
216
|
-
* - `string` for Base58-encoded assertions (`assertTransactionSignature`, etc.)
|
|
217
|
-
* - `Uint8Array` for byte-array assertions (`assertSignatureBytes`, etc.)
|
|
218
|
-
* - Any other type when a completely wrong value type was supplied
|
|
219
|
-
*
|
|
220
|
-
* @readonly
|
|
221
|
-
*/
|
|
222
|
-
value;
|
|
223
|
-
/**
|
|
224
|
-
* The type that was expected (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
|
|
225
|
-
*
|
|
226
|
-
* @remarks
|
|
227
|
-
* Contains the branded type name exactly as it appears in the SDK type system.
|
|
228
|
-
* Use this for structured logging without parsing the `message` string.
|
|
229
|
-
*
|
|
230
|
-
* @readonly
|
|
231
|
-
*/
|
|
232
|
-
expectedType;
|
|
233
|
-
/**
|
|
234
|
-
* Description of the constraint that was violated.
|
|
235
|
-
*
|
|
236
|
-
* @remarks
|
|
237
|
-
* Is `undefined` for pure type-mismatch failures. Contains a human-readable rule
|
|
238
|
-
* for encoding or length violations (e.g., `"valid Base58"`, `"length === 64"`).
|
|
239
|
-
*
|
|
240
|
-
* @readonly
|
|
241
|
-
*/
|
|
242
|
-
constraint;
|
|
243
|
-
/**
|
|
244
|
-
* Creates a new SolanaAssertionError.
|
|
245
|
-
*
|
|
246
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
247
|
-
* the assertion function, the expected type, and the constraint that was violated.
|
|
248
|
-
* @param options - Structured diagnostic details attached to the error.
|
|
249
|
-
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
250
|
-
* @param options.expectedType - The name of the branded Solana type that was expected
|
|
251
|
-
* (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
|
|
252
|
-
* @param options.constraint - Optional human-readable constraint description.
|
|
253
|
-
* Omit when the failure is a type mismatch rather than an encoding or length violation.
|
|
254
|
-
*/
|
|
255
|
-
constructor(message, options) {
|
|
256
|
-
super(message);
|
|
257
|
-
this.name = "SolanaAssertionError";
|
|
258
|
-
this.value = options.value;
|
|
259
|
-
this.expectedType = options.expectedType;
|
|
260
|
-
this.constraint = options.constraint;
|
|
261
|
-
Error.captureStackTrace(this, _SolanaAssertionError);
|
|
262
|
-
Object.setPrototypeOf(this, _SolanaAssertionError.prototype);
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
var TemporalAssertionError = class extends Error {
|
|
266
|
-
static {
|
|
267
|
-
chunkPK6SKIKE_cjs.__name(this, "TemporalAssertionError");
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* The actual value that failed the assertion.
|
|
271
|
-
*
|
|
272
|
-
* @remarks
|
|
273
|
-
* Will be a `bigint` for all temporal assertions since the temporal types are
|
|
274
|
-
* BigInt-backed branded types (e.g., `Year`, `Month`, `Day`). May also be any
|
|
275
|
-
* other type when a non-bigint value was supplied unexpectedly.
|
|
276
|
-
*
|
|
277
|
-
* @readonly
|
|
278
|
-
*/
|
|
279
|
-
value;
|
|
280
|
-
/**
|
|
281
|
-
* The type that was expected (e.g., `"Year"`, `"Month"`, `"Hour"`).
|
|
282
|
-
*
|
|
283
|
-
* @remarks
|
|
284
|
-
* Contains the branded temporal type name exactly as it appears in the SDK type system.
|
|
285
|
-
* Use this for structured logging without parsing the `message` string.
|
|
286
|
-
*
|
|
287
|
-
* @readonly
|
|
288
|
-
*/
|
|
289
|
-
expectedType;
|
|
290
|
-
/**
|
|
291
|
-
* Description of the constraint that was violated.
|
|
292
|
-
*
|
|
293
|
-
* @remarks
|
|
294
|
-
* Contains a human-readable range rule for out-of-range values
|
|
295
|
-
* (e.g., `"1 <= value <= 12"` for a month violation). Is `undefined` only for
|
|
296
|
-
* pure type-mismatch failures (e.g., a `string` passed where a `bigint` was expected),
|
|
297
|
-
* which should not occur in normal usage.
|
|
298
|
-
*
|
|
299
|
-
* @readonly
|
|
300
|
-
*/
|
|
301
|
-
constraint;
|
|
302
|
-
/**
|
|
303
|
-
* Creates a new TemporalAssertionError.
|
|
304
|
-
*
|
|
305
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
306
|
-
* the assertion function, the expected type, and the violated range constraint.
|
|
307
|
-
* @param details - Structured diagnostic details attached to the error.
|
|
308
|
-
* @param details.value - The actual `bigint` value (or other type) that was supplied
|
|
309
|
-
* and failed the temporal assertion.
|
|
310
|
-
* @param details.expectedType - The name of the branded temporal type that was expected
|
|
311
|
-
* (e.g., `"Year"`, `"Month"`, `"Hour"`).
|
|
312
|
-
* @param details.constraint - Optional human-readable range description
|
|
313
|
-
* (e.g., `"1 <= value <= 12"`). Omit when the failure is a type mismatch.
|
|
314
|
-
*/
|
|
315
|
-
constructor(message, details) {
|
|
316
|
-
super(message);
|
|
317
|
-
this.name = "TemporalAssertionError";
|
|
318
|
-
this.value = details.value;
|
|
319
|
-
this.expectedType = details.expectedType;
|
|
320
|
-
this.constraint = details.constraint;
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
// src/crypto/errors.ts
|
|
325
|
-
var CryptographyError = class extends UmbraError {
|
|
326
|
-
static {
|
|
327
|
-
chunkPK6SKIKE_cjs.__name(this, "CryptographyError");
|
|
9
|
+
chunkPK6SKIKE_cjs.__name(this, "ComputationMonitorError");
|
|
328
10
|
}
|
|
11
|
+
/** The monitoring stage where the failure occurred. */
|
|
12
|
+
stage;
|
|
329
13
|
/**
|
|
330
|
-
* The
|
|
14
|
+
* @param stage - The monitoring pipeline stage where the failure occurred.
|
|
15
|
+
* @param message - A human-readable description of the error.
|
|
16
|
+
* @param cause - The underlying error that caused this failure, if any.
|
|
331
17
|
*/
|
|
332
|
-
|
|
333
|
-
constructor(message, options) {
|
|
18
|
+
constructor(stage, message, cause) {
|
|
334
19
|
super(message, {
|
|
335
|
-
code:
|
|
336
|
-
|
|
337
|
-
context: options.context
|
|
338
|
-
},
|
|
339
|
-
...options?.cause !== void 0 && {
|
|
340
|
-
cause: options.cause
|
|
341
|
-
}
|
|
20
|
+
code: `COMPUTATION_MONITOR_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
21
|
+
cause
|
|
342
22
|
});
|
|
343
|
-
this.name = "
|
|
344
|
-
|
|
345
|
-
this.operation = options.operation;
|
|
346
|
-
}
|
|
23
|
+
this.name = "ComputationMonitorError";
|
|
24
|
+
this.stage = stage;
|
|
347
25
|
}
|
|
348
26
|
};
|
|
349
|
-
function
|
|
350
|
-
return error instanceof
|
|
27
|
+
function isComputationMonitorError(error) {
|
|
28
|
+
return error instanceof ComputationMonitorError;
|
|
351
29
|
}
|
|
352
|
-
chunkPK6SKIKE_cjs.__name(
|
|
30
|
+
chunkPK6SKIKE_cjs.__name(isComputationMonitorError, "isComputationMonitorError");
|
|
353
31
|
|
|
354
32
|
// src/solana/errors.ts
|
|
355
|
-
var InstructionError = class extends UmbraError {
|
|
33
|
+
var InstructionError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
356
34
|
static {
|
|
357
35
|
chunkPK6SKIKE_cjs.__name(this, "InstructionError");
|
|
358
36
|
}
|
|
@@ -391,7 +69,7 @@ var InstructionError = class extends UmbraError {
|
|
|
391
69
|
}
|
|
392
70
|
}
|
|
393
71
|
};
|
|
394
|
-
var RpcError = class extends UmbraError {
|
|
72
|
+
var RpcError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
395
73
|
static {
|
|
396
74
|
chunkPK6SKIKE_cjs.__name(this, "RpcError");
|
|
397
75
|
}
|
|
@@ -454,7 +132,7 @@ var RpcError = class extends UmbraError {
|
|
|
454
132
|
}
|
|
455
133
|
}
|
|
456
134
|
};
|
|
457
|
-
var TransactionError = class extends UmbraError {
|
|
135
|
+
var TransactionError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
458
136
|
static {
|
|
459
137
|
chunkPK6SKIKE_cjs.__name(this, "TransactionError");
|
|
460
138
|
}
|
|
@@ -610,7 +288,7 @@ function isTransactionSigningError(error) {
|
|
|
610
288
|
chunkPK6SKIKE_cjs.__name(isTransactionSigningError, "isTransactionSigningError");
|
|
611
289
|
|
|
612
290
|
// src/umbra/errors.ts
|
|
613
|
-
var EncryptedDepositError = class extends UmbraError {
|
|
291
|
+
var EncryptedDepositError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
614
292
|
static {
|
|
615
293
|
chunkPK6SKIKE_cjs.__name(this, "EncryptedDepositError");
|
|
616
294
|
}
|
|
@@ -628,7 +306,7 @@ function isEncryptedDepositError(error) {
|
|
|
628
306
|
return error instanceof EncryptedDepositError;
|
|
629
307
|
}
|
|
630
308
|
chunkPK6SKIKE_cjs.__name(isEncryptedDepositError, "isEncryptedDepositError");
|
|
631
|
-
var EncryptedWithdrawalError = class extends UmbraError {
|
|
309
|
+
var EncryptedWithdrawalError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
632
310
|
static {
|
|
633
311
|
chunkPK6SKIKE_cjs.__name(this, "EncryptedWithdrawalError");
|
|
634
312
|
}
|
|
@@ -646,7 +324,7 @@ function isEncryptedWithdrawalError(error) {
|
|
|
646
324
|
return error instanceof EncryptedWithdrawalError;
|
|
647
325
|
}
|
|
648
326
|
chunkPK6SKIKE_cjs.__name(isEncryptedWithdrawalError, "isEncryptedWithdrawalError");
|
|
649
|
-
var RegistrationError = class extends UmbraError {
|
|
327
|
+
var RegistrationError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
650
328
|
static {
|
|
651
329
|
chunkPK6SKIKE_cjs.__name(this, "RegistrationError");
|
|
652
330
|
}
|
|
@@ -664,7 +342,7 @@ function isRegistrationError(error) {
|
|
|
664
342
|
return error instanceof RegistrationError;
|
|
665
343
|
}
|
|
666
344
|
chunkPK6SKIKE_cjs.__name(isRegistrationError, "isRegistrationError");
|
|
667
|
-
var ConversionError = class extends UmbraError {
|
|
345
|
+
var ConversionError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
668
346
|
static {
|
|
669
347
|
chunkPK6SKIKE_cjs.__name(this, "ConversionError");
|
|
670
348
|
}
|
|
@@ -682,7 +360,7 @@ function isConversionError(error) {
|
|
|
682
360
|
return error instanceof ConversionError;
|
|
683
361
|
}
|
|
684
362
|
chunkPK6SKIKE_cjs.__name(isConversionError, "isConversionError");
|
|
685
|
-
var CreateUtxoError = class extends UmbraError {
|
|
363
|
+
var CreateUtxoError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
686
364
|
static {
|
|
687
365
|
chunkPK6SKIKE_cjs.__name(this, "CreateUtxoError");
|
|
688
366
|
}
|
|
@@ -700,7 +378,7 @@ function isCreateUtxoError(error) {
|
|
|
700
378
|
return error instanceof CreateUtxoError;
|
|
701
379
|
}
|
|
702
380
|
chunkPK6SKIKE_cjs.__name(isCreateUtxoError, "isCreateUtxoError");
|
|
703
|
-
var FetchUtxosError = class extends UmbraError {
|
|
381
|
+
var FetchUtxosError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
704
382
|
static {
|
|
705
383
|
chunkPK6SKIKE_cjs.__name(this, "FetchUtxosError");
|
|
706
384
|
}
|
|
@@ -718,7 +396,7 @@ function isFetchUtxosError(error) {
|
|
|
718
396
|
return error instanceof FetchUtxosError;
|
|
719
397
|
}
|
|
720
398
|
chunkPK6SKIKE_cjs.__name(isFetchUtxosError, "isFetchUtxosError");
|
|
721
|
-
var ClaimUtxoError = class extends UmbraError {
|
|
399
|
+
var ClaimUtxoError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
722
400
|
static {
|
|
723
401
|
chunkPK6SKIKE_cjs.__name(this, "ClaimUtxoError");
|
|
724
402
|
}
|
|
@@ -736,7 +414,7 @@ function isClaimUtxoError(error) {
|
|
|
736
414
|
return error instanceof ClaimUtxoError;
|
|
737
415
|
}
|
|
738
416
|
chunkPK6SKIKE_cjs.__name(isClaimUtxoError, "isClaimUtxoError");
|
|
739
|
-
var QueryError = class extends UmbraError {
|
|
417
|
+
var QueryError = class extends chunkQJAUUYZU_cjs.UmbraError {
|
|
740
418
|
static {
|
|
741
419
|
chunkPK6SKIKE_cjs.__name(this, "QueryError");
|
|
742
420
|
}
|
|
@@ -756,28 +434,23 @@ function isQueryError(error) {
|
|
|
756
434
|
chunkPK6SKIKE_cjs.__name(isQueryError, "isQueryError");
|
|
757
435
|
|
|
758
436
|
exports.ClaimUtxoError = ClaimUtxoError;
|
|
437
|
+
exports.ComputationMonitorError = ComputationMonitorError;
|
|
759
438
|
exports.ConversionError = ConversionError;
|
|
760
439
|
exports.CreateUtxoError = CreateUtxoError;
|
|
761
|
-
exports.CryptographyAssertionError = CryptographyAssertionError;
|
|
762
|
-
exports.CryptographyError = CryptographyError;
|
|
763
440
|
exports.EncryptedDepositError = EncryptedDepositError;
|
|
764
441
|
exports.EncryptedWithdrawalError = EncryptedWithdrawalError;
|
|
765
442
|
exports.FetchUtxosError = FetchUtxosError;
|
|
766
443
|
exports.InstructionError = InstructionError;
|
|
767
444
|
exports.MasterSeedSigningRejectedError = MasterSeedSigningRejectedError;
|
|
768
|
-
exports.MathematicsAssertionError = MathematicsAssertionError;
|
|
769
445
|
exports.QueryError = QueryError;
|
|
770
446
|
exports.RegistrationError = RegistrationError;
|
|
771
447
|
exports.RpcError = RpcError;
|
|
772
|
-
exports.SolanaAssertionError = SolanaAssertionError;
|
|
773
|
-
exports.TemporalAssertionError = TemporalAssertionError;
|
|
774
448
|
exports.TransactionError = TransactionError;
|
|
775
449
|
exports.TransactionSigningError = TransactionSigningError;
|
|
776
|
-
exports.UmbraError = UmbraError;
|
|
777
450
|
exports.isClaimUtxoError = isClaimUtxoError;
|
|
451
|
+
exports.isComputationMonitorError = isComputationMonitorError;
|
|
778
452
|
exports.isConversionError = isConversionError;
|
|
779
453
|
exports.isCreateUtxoError = isCreateUtxoError;
|
|
780
|
-
exports.isCryptographyError = isCryptographyError;
|
|
781
454
|
exports.isEncryptedDepositError = isEncryptedDepositError;
|
|
782
455
|
exports.isEncryptedWithdrawalError = isEncryptedWithdrawalError;
|
|
783
456
|
exports.isFetchUtxosError = isFetchUtxosError;
|
|
@@ -787,6 +460,5 @@ exports.isRegistrationError = isRegistrationError;
|
|
|
787
460
|
exports.isRpcError = isRpcError;
|
|
788
461
|
exports.isTransactionError = isTransactionError;
|
|
789
462
|
exports.isTransactionSigningError = isTransactionSigningError;
|
|
790
|
-
|
|
791
|
-
//# sourceMappingURL=chunk-
|
|
792
|
-
//# sourceMappingURL=chunk-HOEXDXRC.cjs.map
|
|
463
|
+
//# sourceMappingURL=chunk-BL6WXLPV.cjs.map
|
|
464
|
+
//# sourceMappingURL=chunk-BL6WXLPV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/arcium/errors.ts","../src/solana/errors.ts","../src/umbra/errors.ts"],"names":["UmbraError","__name"],"mappings":";;;;;;AA0EO,IAAM,uBAAA,GAAN,cAAsCA,4BAAA,CAAW;AAAA,EA1ExD;AA0EwD,IAAAC,wBAAA,CAAA,IAAA,EAAA,yBAAA,CAAA;AAAA;AAAA;AAAA,EAE7C,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAgC,OAAA,EAAiB,KAAA,EAAe;AAC1E,IAAA,KAAA,CAAM,OAAA,EAAS;AAAA,MACb,IAAA,EAAM,uBAAuB,KAAA,CAAM,WAAA,GAAc,UAAA,CAAW,GAAA,EAAK,GAAG,CAAC,CAAA,CAAA;AAAA,MACrE;AAAA,KACD,CAAA;AACD,IAAA,IAAA,CAAK,IAAA,GAAO,yBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF;AAqBO,SAAS,0BAA0B,KAAA,EAAkD;AAC1F,EAAA,OAAO,KAAA,YAAiB,uBAAA;AAC1B;AAFgBA,wBAAA,CAAA,yBAAA,EAAA,2BAAA,CAAA;;;AChBT,IAAM,gBAAA,GAAN,cAA+BD,4BAAA,CAAW;AAAA,EAhGjD;AAgGiD,IAAAC,wBAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStC,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYT,WAAA,CACE,SACA,OAAA,EAMA;AACA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AAA;AAAA,MAC5D;AAAA,KACD,CAAA;AACD,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF;AAGO,SAAS,iBAAiB,KAAA,EAAyC;AACxE,EAAA,OAAO,KAAA,YAAiB,cAAA;AAC1B;AAFgBA,wBAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA;AA6BT,IAAM,UAAA,GAAN,cAAyBD,4BAAA,CAAW;AAAA,EAlZ3C;AAkZ2C,IAAAC,wBAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AAAA;AAAA,EAChC,KAAA;AAAA,EAET,WAAA,CAAY,KAAA,EAAmB,OAAA,EAAiB,KAAA,EAAiB;AAC/D,IAAA,KAAA,CAAM,OAAA,EAAS;AAAA,MACb,IAAA,EAAM,SAAS,KAAA,CAAM,WAAA,GAAc,UAAA,CAAW,GAAA,EAAK,GAAG,CAAC,CAAA,CAAA;AAAA,MACvD;AAAA,KACD,CAAA;AACD,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF;AAGO,SAAS,aAAa,KAAA,EAAqC;AAChE,EAAA,OAAO,KAAA,YAAiB,UAAA;AAC1B;AAFgBA,wBAAA,CAAA,YAAA,EAAA,cAAA,CAAA","file":"chunk-BL6WXLPV.cjs","sourcesContent":["/**\n * Arcium Error Classes\n *\n * Provides error classes for Arcium MPC computation monitoring failures.\n * Each error carries a {@link ComputationMonitorStage} field that identifies\n * exactly where in the monitoring pipeline the failure occurred.\n *\n * @module arcium/errors\n * @since 2.0.0\n */\n\nimport { UmbraError } from \"../common/errors\";\n\n// =============================================================================\n// COMPUTATION MONITOR\n// =============================================================================\n\n/**\n * Stage of the computation monitoring operation where an error occurred.\n *\n * @remarks\n * Each stage represents a distinct phase in the monitoring flow:\n *\n * - `subscription` — WebSocket subscription setup or notification stream failed\n * - `account-fetch` — HTTP RPC fetch of the ComputationAccount failed\n * - `account-decode` — Failed to decode the ComputationAccount from raw bytes\n * - `timeout` — Monitoring timed out before the computation finalized\n * - `signature-retrieval` — `getSignaturesForAddress` call failed after finalization\n *\n * @since 2.0.0\n * @public\n */\nexport type ComputationMonitorStage =\n | \"subscription\"\n | \"account-fetch\"\n | \"account-decode\"\n | \"timeout\"\n | \"signature-retrieval\";\n\n/**\n * Error thrown when a computation monitoring operation fails.\n *\n * @remarks\n * Thrown by {@link ComputationMonitor} implementations when the monitoring\n * loop encounters an unrecoverable failure. The {@link stage} field identifies\n * exactly where in the monitoring pipeline the failure occurred, enabling\n * callers to implement targeted recovery strategies.\n *\n * The error code follows the format `COMPUTATION_MONITOR_{STAGE}` where\n * `{STAGE}` is the uppercase, underscore-delimited stage name.\n *\n * @example\n * ```typescript\n * try {\n * const result = await monitor.awaitComputation(computationAddress, {\n * timeoutMs: 60_000,\n * });\n * } catch (error) {\n * if (isComputationMonitorError(error)) {\n * switch (error.stage) {\n * case \"timeout\":\n * console.log(\"MPC computation did not finalize in time\");\n * break;\n * case \"subscription\":\n * console.log(\"WebSocket connection failed — try polling monitor\");\n * break;\n * }\n * }\n * }\n * ```\n *\n * @since 2.0.0\n * @public\n */\nexport class ComputationMonitorError extends UmbraError {\n /** The monitoring stage where the failure occurred. */\n readonly stage: ComputationMonitorStage;\n\n /**\n * @param stage - The monitoring pipeline stage where the failure occurred.\n * @param message - A human-readable description of the error.\n * @param cause - The underlying error that caused this failure, if any.\n */\n constructor(stage: ComputationMonitorStage, message: string, cause?: Error) {\n super(message, {\n code: `COMPUTATION_MONITOR_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"ComputationMonitorError\";\n this.stage = stage;\n }\n}\n\n/**\n * Type guard to check if a value is a {@link ComputationMonitorError}.\n *\n * @param error - The value to test.\n * @returns `true` and narrows `error` to {@link ComputationMonitorError} when\n * the value is an instance of `ComputationMonitorError`.\n *\n * @example\n * ```typescript\n * catch (error) {\n * if (isComputationMonitorError(error)) {\n * console.log(error.stage); // TypeScript knows this is ComputationMonitorStage\n * }\n * }\n * ```\n *\n * @since 2.0.0\n * @public\n */\nexport function isComputationMonitorError(error: unknown): error is ComputationMonitorError {\n return error instanceof ComputationMonitorError;\n}\n","/**\n * Solana-Specific Error Classes.\n *\n * This module defines the structured error hierarchy for Solana-related failures\n * in the Umbra SDK. All classes extend `UmbraError` from `../common/errors` and\n * carry structured context that makes programmatic error handling and logging\n * straightforward.\n *\n * @remarks\n * The error hierarchy is:\n * ```\n * UmbraError (base)\n * ├── InstructionError — instruction build/validation failures\n * ├── RpcError — JSON-RPC request failures\n * └── TransactionError — transaction lifecycle failures\n * ├── TransactionSigningError — signing-phase failures\n * │ └── MasterSeedSigningRejectedError — master seed derivation rejection\n * ```\n *\n * **Type guards** — Each concrete error class has a matching `is*` type guard\n * function ({@link isInstructionError}, {@link isRpcError},\n * {@link isTransactionError}, {@link isTransactionSigningError}). Prefer these\n * over `instanceof` checks in code that may cross module or bundle boundaries,\n * where `instanceof` can fail due to different class references.\n *\n * **Recovery strategies by error type:**\n *\n * - `InstructionError` — inspect `instructionName` and `context` to determine\n * which account is missing or which parameter is invalid; fix the call site.\n *\n * - `RpcError` — check `statusCode` (HTTP) and `rpcErrorCode` (JSON-RPC) to\n * distinguish rate limiting (429), node overload (503), or invalid request\n * (400). Transient errors are typically retryable.\n *\n * - `TransactionError` — check `simulationLogs` for program error messages that\n * identify the on-chain failure. If `signature` is set, the transaction landed\n * on-chain but was reverted.\n *\n * - `TransactionSigningError` — check `wasRejected` to distinguish a deliberate\n * user rejection from a hardware wallet communication failure.\n *\n * - `MasterSeedSigningRejectedError` — the user declined the master seed\n * derivation message; prompt the user and retry with `getUmbraClient`.\n *\n * @packageDocumentation\n */\n\nimport { UmbraError } from \"../common/errors\";\n\n/**\n * Error thrown when building or validating a Solana instruction fails.\n *\n * This error is raised during the instruction-construction phase — before any\n * RPC or network interaction occurs. Common causes include missing required\n * accounts, invalid parameter values, PDA derivation failures, and instruction\n * serialization errors.\n *\n * @remarks\n * The `instructionName` field identifies which instruction failed, which is\n * particularly useful when a single SDK operation constructs multiple\n * instructions. The `context` field (inherited from `UmbraError`) carries\n * arbitrary key-value pairs for additional diagnostic information, such as\n * the list of missing accounts or the conflicting parameter values.\n *\n * **Default error code** — `\"INSTRUCTION_ERROR\"`. Sub-classes or callers may\n * override this via the `code` option.\n *\n * @example\n * Catching and inspecting an instruction build failure:\n * ```typescript\n * import { isInstructionError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const instruction = buildRegisterInstruction(params);\n * } catch (error) {\n * if (isInstructionError(error)) {\n * console.error(`Instruction \"${error.instructionName}\" failed: ${error.message}`);\n * console.error(\"Context:\", error.context);\n * }\n * }\n * ```\n *\n * @example\n * Throwing an `InstructionError` from a builder:\n * ```typescript\n * import { InstructionError } from \"@umbra-privacy/sdk\";\n *\n * throw new InstructionError(\"Required account 'poolConfig' not found\", {\n * instructionName: \"encryptedDeposit\",\n * context: { missingAccounts: [\"poolConfig\"], providedMint: mint.toString() },\n * });\n * ```\n *\n * @see {@link isInstructionError} for the corresponding type guard\n * @public\n */\nexport class InstructionError extends UmbraError {\n /**\n * The name of the instruction that failed during construction or validation.\n *\n * @remarks\n * Matches the Anchor instruction name (camelCase), e.g. `\"encryptedDeposit\"`,\n * `\"initUserAccount\"`. May be `undefined` if the failing instruction could\n * not be identified at the throw site.\n */\n readonly instructionName?: string;\n\n /**\n * Creates a new `InstructionError`.\n *\n * @param message - Human-readable description of the instruction failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"INSTRUCTION_ERROR\"`.\n * @param options.instructionName - The name of the failing instruction.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n instructionName?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"INSTRUCTION_ERROR\",\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"InstructionError\";\n if (options?.instructionName !== undefined) {\n this.instructionName = options.instructionName;\n }\n }\n}\n\n/**\n * Error thrown when a Solana JSON-RPC request fails.\n *\n * This error covers all network-level and protocol-level failures that occur\n * while communicating with a Solana RPC node: unreachable endpoints, HTTP\n * errors, rate limiting, malformed responses, and JSON-RPC error objects\n * returned by the node.\n *\n * @remarks\n * **HTTP errors** — Use `statusCode` to check for common HTTP failure modes:\n * - `429` — rate limited; back off and retry with exponential delay\n * - `503` — node overloaded or temporarily unavailable; retry after a pause\n * - `400` — malformed request; usually a client bug, not retryable\n *\n * **JSON-RPC errors** — Use `rpcErrorCode` to distinguish Solana-specific\n * error codes returned in the `error.code` field of an RPC response body.\n * Common codes: `-32002` (transaction not found), `-32005` (node behind),\n * `-32007` (slot skipped).\n *\n * **Retryability** — `statusCode >= 500` or `statusCode === 429` generally\n * indicates a transient error. Client-side errors (`statusCode === 400`) are\n * not retryable without fixing the request.\n *\n * **Default error code** — `\"RPC_ERROR\"`.\n *\n * @example\n * Distinguishing rate-limit errors from other RPC failures:\n * ```typescript\n * import { isRpcError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const account = await rpc.getAccountInfo(address);\n * } catch (error) {\n * if (isRpcError(error)) {\n * if (error.statusCode === 429) {\n * console.warn(\"Rate limited — retry after delay\");\n * } else {\n * console.error(`RPC failure at ${error.endpoint}: ${error.message}`);\n * }\n * }\n * }\n * ```\n *\n * @example\n * Constructing an `RpcError`:\n * ```typescript\n * import { RpcError } from \"@umbra-privacy/sdk\";\n *\n * throw new RpcError(\"Failed to fetch account\", {\n * endpoint: \"https://api.mainnet-beta.solana.com\",\n * statusCode: 503,\n * cause: originalError,\n * });\n * ```\n *\n * @see {@link isRpcError} for the corresponding type guard\n * @public\n */\nexport class RpcError extends UmbraError {\n /**\n * The RPC endpoint URL that was called when the error occurred.\n *\n * @remarks\n * May be `undefined` if the endpoint was not known at the throw site (e.g.,\n * when the error originates deep within `@solana/kit` internals).\n */\n readonly endpoint?: string;\n\n /**\n * The HTTP status code returned by the RPC node, if applicable.\n *\n * @remarks\n * `undefined` for network-level failures (e.g., DNS resolution failure,\n * connection refused) where no HTTP response was received.\n */\n readonly statusCode?: number;\n\n /**\n * The JSON-RPC error code from the response body, if any.\n *\n * @remarks\n * Set when the RPC node returns a well-formed JSON-RPC error object with a\n * numeric `code` field. `undefined` for HTTP-level failures or when the node\n * returns a malformed response body.\n */\n readonly rpcErrorCode?: number;\n\n /**\n * Creates a new `RpcError`.\n *\n * @param message - Human-readable description of the RPC failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"RPC_ERROR\"`.\n * @param options.endpoint - The RPC endpoint URL that was called.\n * @param options.statusCode - HTTP status code from the response, if any.\n * @param options.rpcErrorCode - JSON-RPC error code from the response, if any.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n endpoint?: string;\n statusCode?: number;\n rpcErrorCode?: number;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"RPC_ERROR\",\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"RpcError\";\n if (options?.endpoint !== undefined) {\n this.endpoint = options.endpoint;\n }\n if (options?.statusCode !== undefined) {\n this.statusCode = options.statusCode;\n }\n if (options?.rpcErrorCode !== undefined) {\n this.rpcErrorCode = options.rpcErrorCode;\n }\n }\n}\n\n/**\n * Error thrown when a transaction operation fails.\n *\n * This error covers failures across the full transaction lifecycle: building the\n * transaction message, running preflight simulation, submitting to the network,\n * and waiting for confirmation. It is the base class for more specific\n * transaction-related errors.\n *\n * @remarks\n * **Simulation logs** — When available, `simulationLogs` contain the program\n * log output from a failed preflight simulation. These logs often include the\n * Anchor error code and a human-readable message describing why the on-chain\n * program rejected the transaction.\n *\n * **Signature** — When `signature` is present, the transaction was accepted by\n * the network and executed but the execution itself failed (on-chain error).\n * When `signature` is absent, the transaction was rejected before reaching the\n * network (e.g., preflight failure, malformed transaction).\n *\n * **Default error code** — `\"TRANSACTION_ERROR\"`.\n *\n * @example\n * Inspecting simulation logs on failure:\n * ```typescript\n * import { isTransactionError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const signatures = await forwarder.forwardSequentially([signedTx]);\n * } catch (error) {\n * if (isTransactionError(error)) {\n * console.error(\"Transaction failed:\", error.message);\n * if (error.simulationLogs) {\n * console.error(\"Simulation logs:\");\n * for (const log of error.simulationLogs) {\n * console.error(\" \", log);\n * }\n * }\n * if (error.signature) {\n * console.error(\"Failed signature:\", error.signature);\n * }\n * }\n * }\n * ```\n *\n * @example\n * Constructing a `TransactionError`:\n * ```typescript\n * import { TransactionError } from \"@umbra-privacy/sdk\";\n *\n * throw new TransactionError(\"Transaction simulation failed\", {\n * simulationLogs: [\"Program log: AnchorError: Error Code: 6001\"],\n * cause: originalError,\n * });\n * ```\n *\n * @see {@link isTransactionError} for the corresponding type guard\n * @see {@link TransactionSigningError} for signing-phase failures\n * @public\n */\nexport class TransactionError extends UmbraError {\n /**\n * The transaction signature, if available.\n *\n * @remarks\n * Base58-encoded signature string. Present when the transaction was submitted\n * to the network but failed during execution. Use this to look up the failed\n * transaction in a block explorer.\n */\n readonly signature?: string;\n\n /**\n * Simulation log output from the transaction preflight, if available.\n *\n * @remarks\n * Each entry in the array is one line of program log output (e.g.,\n * `\"Program log: ...\"` or `\"Program <address> failed: ...\"`). Anchor programs\n * emit error codes and names here when constraints are violated.\n */\n readonly simulationLogs?: string[];\n\n /**\n * Creates a new `TransactionError`.\n *\n * @param message - Human-readable description of the transaction failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"TRANSACTION_ERROR\"`.\n * @param options.signature - Base58-encoded transaction signature, if available.\n * @param options.simulationLogs - Program log output from preflight simulation.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n signature?: string;\n simulationLogs?: string[];\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"TRANSACTION_ERROR\",\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"TransactionError\";\n if (options?.signature !== undefined) {\n this.signature = options.signature;\n }\n if (options?.simulationLogs !== undefined) {\n this.simulationLogs = options.simulationLogs;\n }\n }\n}\n\n/**\n * Error thrown when transaction signing fails.\n *\n * This is a specific sub-class of {@link TransactionError} that occurs during\n * the signing phase — after the transaction is built but before it is submitted\n * to the network. Common causes include explicit user rejection in a wallet UI,\n * hardware wallet disconnection or timeout, and missing key material.\n *\n * @remarks\n * **User rejection** — When `wasRejected` is `true`, the user deliberately\n * declined to sign in the wallet prompt. This is not an error condition in the\n * traditional sense — the user made an intentional choice. UIs should catch this\n * and show a user-friendly cancellation message rather than an error dialog.\n *\n * **Hardware wallet issues** — When `wasRejected` is `false`, the failure was\n * not deliberate. It may indicate a disconnected Ledger, a timeout waiting for\n * the user to confirm on-device, or an incompatible app version on the device.\n *\n * **Signer address** — `signerAddress` identifies which signer's key was needed\n * at the time of failure. In multi-signer flows this helps identify which party\n * must re-sign.\n *\n * **Default error code** — `\"TRANSACTION_SIGNING_ERROR\"`.\n *\n * @example\n * Handling user rejection gracefully:\n * ```typescript\n * import { isTransactionSigningError } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const signedTx = await walletSigner.signTransaction(tx);\n * } catch (error) {\n * if (isTransactionSigningError(error)) {\n * if (error.wasRejected) {\n * showToast(\"Transaction cancelled by user\");\n * } else {\n * showToast(`Signing failed: ${error.message}`);\n * }\n * }\n * }\n * ```\n *\n * @example\n * Constructing a `TransactionSigningError`:\n * ```typescript\n * import { TransactionSigningError } from \"@umbra-privacy/sdk\";\n *\n * throw new TransactionSigningError(\"User rejected the transaction\", {\n * wasRejected: true,\n * signerAddress: wallet.publicKey.toString(),\n * });\n * ```\n *\n * @see {@link isTransactionSigningError} for the corresponding type guard\n * @see {@link MasterSeedSigningRejectedError} for the master seed rejection sub-class\n * @public\n */\nexport class TransactionSigningError extends TransactionError {\n /**\n * Whether the signing was explicitly rejected by the user.\n *\n * @remarks\n * `true` when the wallet UI presented a sign request and the user actively\n * clicked \"Reject\" or equivalent. `false` when the failure was due to a\n * technical issue (disconnected device, timeout, missing key).\n *\n * @defaultValue `false`\n */\n readonly wasRejected: boolean;\n\n /**\n * The address of the signer that failed to produce a signature.\n *\n * @remarks\n * Base58-encoded public key string. May be `undefined` if the failing signer\n * could not be identified at the throw site.\n */\n readonly signerAddress?: string;\n\n /**\n * Creates a new `TransactionSigningError`.\n *\n * @param message - Human-readable description of the signing failure.\n * @param options - Optional structured metadata.\n * @param options.code - Error code string. Defaults to `\"TRANSACTION_SIGNING_ERROR\"`.\n * @param options.wasRejected - Whether the user deliberately rejected. Defaults to `false`.\n * @param options.signerAddress - Base58 address of the signer that failed.\n * @param options.signature - Transaction signature, if the transaction was partially signed.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message: string,\n options?: {\n code?: string;\n wasRejected?: boolean;\n signerAddress?: string;\n signature?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: options?.code ?? \"TRANSACTION_SIGNING_ERROR\",\n ...(options?.signature !== undefined && {\n signature: options.signature,\n }),\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"TransactionSigningError\";\n this.wasRejected = options?.wasRejected ?? false;\n if (options?.signerAddress !== undefined) {\n this.signerAddress = options.signerAddress;\n }\n }\n}\n\n/**\n * Error thrown when master seed signing is rejected by the user.\n *\n * The Umbra privacy protocol derives a deterministic master seed by asking the\n * user's wallet to sign a fixed message. This seed is the root of the key\n * hierarchy used for encrypting and decrypting confidential balances. If the\n * user declines to sign this message, no Umbra operations that require private\n * key material can proceed.\n *\n * @remarks\n * This error always has `wasRejected: true` because it is only thrown when the\n * user deliberately declines — hardware wallet failures or timeouts during the\n * seed derivation flow produce a generic {@link TransactionSigningError} instead.\n *\n * **Recovery** — Prompt the user to explain that the Umbra seed derivation\n * signature is used only to derive encryption keys locally and is never\n * broadcast to the network. Then call `getUmbraClient` again.\n *\n * **Default error code** — `\"MASTER_SEED_SIGNING_REJECTED\"`.\n *\n * @example\n * Distinguishing master seed rejection from other signing errors:\n * ```typescript\n * import {\n * MasterSeedSigningRejectedError,\n * isTransactionSigningError,\n * } from \"@umbra-privacy/sdk\";\n *\n * try {\n * const client = await getUmbraClient({ signer });\n * } catch (error) {\n * if (error instanceof MasterSeedSigningRejectedError) {\n * showModal(\n * \"Umbra needs a signature to derive your private keys locally. \" +\n * \"This signature is never sent to the network.\",\n * );\n * } else if (isTransactionSigningError(error)) {\n * showToast(`Signing error: ${error.message}`);\n * }\n * }\n * ```\n *\n * @see {@link TransactionSigningError} for the parent class\n * @public\n */\nexport class MasterSeedSigningRejectedError extends TransactionSigningError {\n /**\n * Creates a new `MasterSeedSigningRejectedError`.\n *\n * @param message - Human-readable description. Defaults to a standard rejection\n * message explaining that the user declined the required derivation signature.\n * @param options - Optional structured metadata.\n * @param options.signerAddress - Base58 address of the wallet that rejected.\n * @param options.context - Arbitrary key-value pairs for diagnostic context.\n * @param options.cause - The underlying error that caused this failure, if any.\n */\n constructor(\n message = \"Master seed derivation was rejected. The user declined to sign the required message.\",\n options?: {\n signerAddress?: string;\n context?: Record<string, unknown>;\n cause?: unknown;\n },\n ) {\n super(message, {\n code: \"MASTER_SEED_SIGNING_REJECTED\",\n wasRejected: true,\n ...(options?.signerAddress !== undefined && {\n signerAddress: options.signerAddress,\n }),\n ...(options?.context !== undefined && {\n context: options.context,\n }),\n ...(options?.cause !== undefined && {\n cause: options.cause,\n }),\n });\n this.name = \"MasterSeedSigningRejectedError\";\n }\n}\n\n/**\n * Type guard to check whether an unknown value is an {@link InstructionError}.\n *\n * @remarks\n * Prefer this function over `instanceof InstructionError` in code that may\n * cross module or bundle boundaries where the class reference might differ.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `InstructionError`, narrowing\n * the type accordingly.\n *\n * @example\n * ```typescript\n * if (isInstructionError(error)) {\n * console.error(\"Instruction:\", error.instructionName);\n * }\n * ```\n *\n * @see {@link InstructionError}\n * @public\n */\nexport function isInstructionError(error: unknown): error is InstructionError {\n return error instanceof InstructionError;\n}\n\n/**\n * Type guard to check whether an unknown value is an {@link RpcError}.\n *\n * @remarks\n * Prefer this function over `instanceof RpcError` in code that may cross\n * module or bundle boundaries where the class reference might differ.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `RpcError`, narrowing the type\n * accordingly.\n *\n * @example\n * ```typescript\n * if (isRpcError(error) && error.statusCode === 429) {\n * await sleep(backoffMs);\n * return retry();\n * }\n * ```\n *\n * @see {@link RpcError}\n * @public\n */\nexport function isRpcError(error: unknown): error is RpcError {\n return error instanceof RpcError;\n}\n\n/**\n * Type guard to check whether an unknown value is a {@link TransactionError}.\n *\n * @remarks\n * Because {@link TransactionSigningError} and {@link MasterSeedSigningRejectedError}\n * extend `TransactionError`, this guard returns `true` for those sub-classes as\n * well. Use the more specific guards ({@link isTransactionSigningError}) when the\n * sub-type matters.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `TransactionError` or any of its\n * sub-classes, narrowing the type accordingly.\n *\n * @example\n * ```typescript\n * if (isTransactionError(error) && error.simulationLogs) {\n * console.error(\"Simulation logs:\", error.simulationLogs.join(\"\\n\"));\n * }\n * ```\n *\n * @see {@link TransactionError}\n * @see {@link isTransactionSigningError}\n * @public\n */\nexport function isTransactionError(error: unknown): error is TransactionError {\n return error instanceof TransactionError;\n}\n\n/**\n * Type guard to check whether an unknown value is a {@link TransactionSigningError}.\n *\n * @remarks\n * Because {@link MasterSeedSigningRejectedError} extends `TransactionSigningError`,\n * this guard returns `true` for that sub-class as well.\n *\n * @param error - The value to test.\n * @returns `true` if `error` is an instance of `TransactionSigningError` or any\n * of its sub-classes, narrowing the type accordingly.\n *\n * @example\n * ```typescript\n * if (isTransactionSigningError(error) && error.wasRejected) {\n * showCancellationMessage();\n * }\n * ```\n *\n * @see {@link TransactionSigningError}\n * @see {@link MasterSeedSigningRejectedError}\n * @public\n */\nexport function isTransactionSigningError(error: unknown): error is TransactionSigningError {\n return error instanceof TransactionSigningError;\n}\n","/**\n * Umbra Error Classes\n *\n * This module provides error classes for all Umbra SDK operation failures,\n * each carrying a `stage` field that identifies exactly where in the pipeline\n * the failure occurred.\n *\n * @since 2.0.0\n * @module umbra/errors\n */\n\nimport { UmbraError } from \"../common/errors\";\n\n// =============================================================================\n// DEPOSIT\n// =============================================================================\n\n/**\n * Stage of the encrypted deposit operation where an error occurred.\n *\n * Each stage represents a distinct phase in the deposit flow:\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Input parameter validation failed |\n * | `mint-fetch` | Failed to fetch mint account data |\n * | `fee-calculation` | Failed to calculate transfer fee |\n * | `pda-derivation` | PDA address generation failed |\n * | `account-fetch` | Failed to fetch account data from RPC |\n * | `instruction-build` | Failed to build the deposit instruction |\n * | `transaction-build` | Failed to build transaction message |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Failed to sign the transaction |\n * | `transaction-validate` | Transaction validation failed |\n * | `transaction-send` | Failed to send or confirm the transaction |\n */\nexport type EncryptedDepositStage =\n | \"initialization\"\n | \"validation\"\n | \"mint-fetch\"\n | \"fee-calculation\"\n | \"pda-derivation\"\n | \"account-fetch\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when an encrypted deposit operation fails. */\nexport class EncryptedDepositError extends UmbraError {\n readonly stage: EncryptedDepositStage;\n\n constructor(stage: EncryptedDepositStage, message: string, cause?: Error) {\n super(message, {\n code: `ENCRYPTED_DEPOSIT_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"EncryptedDepositError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is an EncryptedDepositError. */\nexport function isEncryptedDepositError(error: unknown): error is EncryptedDepositError {\n return error instanceof EncryptedDepositError;\n}\n\n// =============================================================================\n// WITHDRAWAL\n// =============================================================================\n\n/**\n * Stage of the encrypted withdrawal operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Input parameter validation failed |\n * | `mint-fetch` | Failed to fetch mint account data |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build the withdrawal instruction |\n * | `transaction-build` | Failed to build transaction message |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Failed to sign the transaction |\n * | `transaction-send` | Failed to send or confirm the transaction |\n */\nexport type EncryptedWithdrawalStage =\n | \"initialization\"\n | \"validation\"\n | \"mint-fetch\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-send\";\n\n/** Error thrown when an encrypted withdrawal operation fails. */\nexport class EncryptedWithdrawalError extends UmbraError {\n readonly stage: EncryptedWithdrawalStage;\n\n constructor(stage: EncryptedWithdrawalStage, message: string, cause?: Error) {\n super(message, {\n code: `ENCRYPTED_WITHDRAWAL_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"EncryptedWithdrawalError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is an EncryptedWithdrawalError. */\nexport function isEncryptedWithdrawalError(error: unknown): error is EncryptedWithdrawalError {\n return error instanceof EncryptedWithdrawalError;\n}\n\n// =============================================================================\n// REGISTRATION\n// =============================================================================\n\n/**\n * Stage of the user registration operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `master-seed-derivation` | Master seed signing was rejected or failed |\n * | `account-fetch` | RPC call to read existing registration state failed |\n * | `key-derivation` | Cryptographic key derivation from master seed failed |\n * | `zk-proof-generation` | Groth16 proof generation failed (anonymous step) |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build an instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing |\n * | `transaction-validate` | Pre-flight simulation failed |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type RegistrationStage =\n | \"initialization\"\n | \"master-seed-derivation\"\n | \"account-fetch\"\n | \"key-derivation\"\n | \"zk-proof-generation\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when a user registration operation fails. */\nexport class RegistrationError extends UmbraError {\n readonly stage: RegistrationStage;\n\n constructor(stage: RegistrationStage, message: string, cause?: unknown) {\n super(message, {\n code: `REGISTRATION_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"RegistrationError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a RegistrationError. */\nexport function isRegistrationError(error: unknown): error is RegistrationError {\n return error instanceof RegistrationError;\n}\n\n// =============================================================================\n// CONVERSION\n// =============================================================================\n\n/**\n * Stage of the MXE-to-Shared conversion operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `account-fetch` | Batch RPC fetch of token account PDAs failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build a conversion instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing for a per-mint transaction |\n * | `transaction-validate` | Pre-flight simulation failed |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type ConversionStage =\n | \"initialization\"\n | \"account-fetch\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when an MXE-to-Shared conversion operation fails. */\nexport class ConversionError extends UmbraError {\n readonly stage: ConversionStage;\n\n constructor(stage: ConversionStage, message: string, cause?: unknown) {\n super(message, {\n code: `CONVERSION_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"ConversionError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a ConversionError. */\nexport function isConversionError(error: unknown): error is ConversionError {\n return error instanceof ConversionError;\n}\n\n// =============================================================================\n// CREATE UTXO\n// =============================================================================\n\n/**\n * Stage of a UTXO creation operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Input parameter validation failed |\n * | `account-fetch` | Failed to fetch recipient or token account data |\n * | `mint-fetch` | Failed to fetch mint account data |\n * | `fee-calculation` | Token-2022 transfer fee calculation failed |\n * | `key-derivation` | Key derivation from master seed failed |\n * | `zk-proof-generation` | Groth16 proof generation failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build an instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing |\n * | `transaction-validate` | Pre-flight simulation failed |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type CreateUtxoStage =\n | \"initialization\"\n | \"validation\"\n | \"account-fetch\"\n | \"mint-fetch\"\n | \"fee-calculation\"\n | \"key-derivation\"\n | \"zk-proof-generation\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when a UTXO creation operation fails. */\nexport class CreateUtxoError extends UmbraError {\n readonly stage: CreateUtxoStage;\n\n constructor(stage: CreateUtxoStage, message: string, cause?: unknown) {\n super(message, {\n code: `CREATE_UTXO_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"CreateUtxoError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a CreateUtxoError. */\nexport function isCreateUtxoError(error: unknown): error is CreateUtxoError {\n return error instanceof CreateUtxoError;\n}\n\n// =============================================================================\n// FETCH UTXOS\n// =============================================================================\n\n/**\n * Stage of a UTXO fetch operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory construction failed — missing indexerApiEndpoint |\n * | `validation` | Invalid tree index or insertion index parameters |\n * | `key-derivation` | X25519 private key derivation from master seed failed |\n * | `indexer-fetch` | Indexer HTTP call failed |\n * | `proof-fetch` | Merkle proof HTTP call failed |\n */\nexport type FetchUtxosStage =\n | \"initialization\"\n | \"validation\"\n | \"key-derivation\"\n | \"indexer-fetch\"\n | \"proof-fetch\"\n | \"proof-enrichment\";\n\n/** Error thrown when a UTXO fetch operation fails. */\nexport class FetchUtxosError extends UmbraError {\n readonly stage: FetchUtxosStage;\n\n constructor(stage: FetchUtxosStage, message: string, cause?: unknown) {\n super(message, {\n code: `FETCH_UTXOS_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"FetchUtxosError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a FetchUtxosError. */\nexport function isFetchUtxosError(error: unknown): error is FetchUtxosError {\n return error instanceof FetchUtxosError;\n}\n\n// =============================================================================\n// CLAIM UTXO\n// =============================================================================\n\n/**\n * Stage of a UTXO claim operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `validation` | Invalid UTXO data or Merkle proof parameters |\n * | `key-derivation` | Key derivation from master seed failed |\n * | `zk-proof-generation` | Groth16 proof generation failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `instruction-build` | Failed to build an instruction |\n * | `transaction-build` | Blockhash fetch or transaction assembly failed |\n * | `transaction-compile` | Failed to compile the transaction |\n * | `transaction-sign` | Wallet rejected signing |\n * | `transaction-validate` | Pre-flight simulation failed — also surfaces stale Merkle proof |\n * | `transaction-send` | Transaction sent but confirmation timed out |\n */\nexport type ClaimUtxoStage =\n | \"initialization\"\n | \"validation\"\n | \"key-derivation\"\n | \"zk-proof-generation\"\n | \"pda-derivation\"\n | \"instruction-build\"\n | \"transaction-build\"\n | \"transaction-compile\"\n | \"transaction-sign\"\n | \"transaction-validate\"\n | \"transaction-send\";\n\n/** Error thrown when a UTXO claim operation fails. */\nexport class ClaimUtxoError extends UmbraError {\n readonly stage: ClaimUtxoStage;\n\n constructor(stage: ClaimUtxoStage, message: string, cause?: unknown) {\n super(message, {\n code: `CLAIM_UTXO_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"ClaimUtxoError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a ClaimUtxoError. */\nexport function isClaimUtxoError(error: unknown): error is ClaimUtxoError {\n return error instanceof ClaimUtxoError;\n}\n\n// =============================================================================\n// QUERY\n// =============================================================================\n\n/**\n * Stage of a query operation where an error occurred.\n *\n * | Stage | Description |\n * |-------|-------------|\n * | `initialization` | Factory-level validation failed |\n * | `pda-derivation` | PDA address generation failed |\n * | `account-fetch` | RPC fetch failed |\n * | `account-decode` | On-chain account data could not be decoded |\n * | `key-derivation` | X25519 key derivation failed (encrypted balance query) |\n * | `decryption` | Rescue cipher decryption failed (encrypted balance query) |\n */\nexport type QueryStage =\n | \"initialization\"\n | \"pda-derivation\"\n | \"account-fetch\"\n | \"account-decode\"\n | \"key-derivation\"\n | \"decryption\";\n\n/** Error thrown when a query operation fails. */\nexport class QueryError extends UmbraError {\n readonly stage: QueryStage;\n\n constructor(stage: QueryStage, message: string, cause?: unknown) {\n super(message, {\n code: `QUERY_${stage.toUpperCase().replaceAll(\"-\", \"_\")}`,\n cause,\n });\n this.name = \"QueryError\";\n this.stage = stage;\n }\n}\n\n/** Type guard to check if an error is a QueryError. */\nexport function isQueryError(error: unknown): error is QueryError {\n return error instanceof QueryError;\n}\n"]}
|