@umbra-privacy/sdk 1.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.
- package/LICENSE +21 -0
- package/README.md +122 -0
- package/dist/addresses-Brzgurv_.d.ts +145 -0
- package/dist/addresses-D_0YAS6B.d.cts +145 -0
- package/dist/chunk-2Q75CQQJ.js +12 -0
- package/dist/chunk-2Q75CQQJ.js.map +1 -0
- package/dist/chunk-7QVYU63E.js +6 -0
- package/dist/chunk-7QVYU63E.js.map +1 -0
- package/dist/chunk-BM7N6N7E.js +1883 -0
- package/dist/chunk-BM7N6N7E.js.map +1 -0
- package/dist/chunk-GXKSUB2U.cjs +4416 -0
- package/dist/chunk-GXKSUB2U.cjs.map +1 -0
- package/dist/chunk-HOEXDXRC.cjs +792 -0
- package/dist/chunk-HOEXDXRC.cjs.map +1 -0
- package/dist/chunk-MDFSBU5W.cjs +2033 -0
- package/dist/chunk-MDFSBU5W.cjs.map +1 -0
- package/dist/chunk-MQY7HDIA.js +600 -0
- package/dist/chunk-MQY7HDIA.js.map +1 -0
- package/dist/chunk-MVKTV3FT.cjs +20 -0
- package/dist/chunk-MVKTV3FT.cjs.map +1 -0
- package/dist/chunk-PG2J6V6Y.js +4094 -0
- package/dist/chunk-PG2J6V6Y.js.map +1 -0
- package/dist/chunk-PK6SKIKE.cjs +8 -0
- package/dist/chunk-PK6SKIKE.cjs.map +1 -0
- package/dist/chunk-VEGLTTYQ.cjs +621 -0
- package/dist/chunk-VEGLTTYQ.cjs.map +1 -0
- package/dist/chunk-WVHQ46DD.js +758 -0
- package/dist/chunk-WVHQ46DD.js.map +1 -0
- package/dist/constants/index.cjs +316 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +739 -0
- package/dist/constants/index.d.ts +739 -0
- package/dist/constants/index.js +193 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/cryptography-BTGC72u-.d.cts +4809 -0
- package/dist/cryptography-BTGC72u-.d.ts +4809 -0
- package/dist/errors/index.cjs +141 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.cts +1415 -0
- package/dist/errors/index.d.ts +1415 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index-B9pDY73x.d.ts +12933 -0
- package/dist/index-CLj_zWSD.d.ts +235 -0
- package/dist/index-CX6_pIRS.d.cts +235 -0
- package/dist/index-D33yo0qB.d.cts +12933 -0
- package/dist/index.cjs +22464 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11694 -0
- package/dist/index.d.ts +11694 -0
- package/dist/index.js +22314 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.cjs +4 -0
- package/dist/interfaces/index.cjs.map +1 -0
- package/dist/interfaces/index.d.cts +8 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/networks-C-orpSFW.d.ts +65 -0
- package/dist/networks-FxYERGD1.d.cts +65 -0
- package/dist/types/index.cjs +605 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +1853 -0
- package/dist/types/index.d.ts +1853 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types-BBuELtY8.d.cts +495 -0
- package/dist/types-n-sHFcgr.d.ts +495 -0
- package/dist/utils/index.cjs +1295 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +9559 -0
- package/dist/utils/index.d.ts +9559 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/versions-D9PqsEvj.d.cts +173 -0
- package/dist/versions-D9PqsEvj.d.ts +173 -0
- package/package.json +151 -0
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
import { __name } from './chunk-7QVYU63E.js';
|
|
2
|
+
|
|
3
|
+
// src/common/errors.ts
|
|
4
|
+
var UmbraError = class _UmbraError extends Error {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "UmbraError");
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A machine-readable error code for programmatic error handling.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Defaults to `"UMBRA_ERROR"` when no code is supplied in the constructor options.
|
|
13
|
+
* Sub-classes or specific throw sites should supply a more specific code to allow
|
|
14
|
+
* callers to branch on error identity without string-matching `message`.
|
|
15
|
+
*
|
|
16
|
+
* @readonly
|
|
17
|
+
*/
|
|
18
|
+
code;
|
|
19
|
+
/**
|
|
20
|
+
* Additional context about the error.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* A free-form key-value map of diagnostic data attached to the error at the throw site.
|
|
24
|
+
* Useful for logging and debugging — consumers should not rely on specific keys for
|
|
25
|
+
* control flow; use `code` for programmatic branching instead.
|
|
26
|
+
*
|
|
27
|
+
* Will be `undefined` when no context was provided to the constructor.
|
|
28
|
+
*
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
31
|
+
context;
|
|
32
|
+
/**
|
|
33
|
+
* The original error that caused this error, if any.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* When an SDK function wraps a lower-level error (e.g., a failed RPC call or a
|
|
37
|
+
* cryptographic library error), it sets `cause` to the original thrown value so
|
|
38
|
+
* callers can inspect the full error chain.
|
|
39
|
+
*
|
|
40
|
+
* Will be `undefined` when there is no underlying cause.
|
|
41
|
+
*
|
|
42
|
+
* @readonly
|
|
43
|
+
*/
|
|
44
|
+
cause;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new UmbraError.
|
|
47
|
+
*
|
|
48
|
+
* @param message - Human-readable description of what went wrong. Should be
|
|
49
|
+
* actionable and specific enough for a developer to understand the failure
|
|
50
|
+
* without reading source code.
|
|
51
|
+
* @param options - Optional structured metadata attached to the error.
|
|
52
|
+
* @param options.code - Machine-readable error code for programmatic branching.
|
|
53
|
+
* Defaults to `"UMBRA_ERROR"` if omitted.
|
|
54
|
+
* @param options.context - Free-form diagnostic key-value pairs. Omit or set to
|
|
55
|
+
* `undefined` to leave the `context` property unset.
|
|
56
|
+
* @param options.cause - The original error that triggered this one. Enables
|
|
57
|
+
* full error-chain inspection. Omit or set to `undefined` when there is no
|
|
58
|
+
* underlying cause.
|
|
59
|
+
*
|
|
60
|
+
* @defaultValue `options` — `undefined` (all options optional)
|
|
61
|
+
* @defaultValue `options.code` — `"UMBRA_ERROR"`
|
|
62
|
+
*/
|
|
63
|
+
constructor(message, options) {
|
|
64
|
+
super(message);
|
|
65
|
+
this.name = "UmbraError";
|
|
66
|
+
this.code = options?.code ?? "UMBRA_ERROR";
|
|
67
|
+
if (options?.context !== void 0) {
|
|
68
|
+
this.context = options.context;
|
|
69
|
+
}
|
|
70
|
+
if (options?.cause !== void 0) {
|
|
71
|
+
this.cause = options.cause;
|
|
72
|
+
}
|
|
73
|
+
Error.captureStackTrace(this, _UmbraError);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
function isUmbraError(error) {
|
|
77
|
+
return error instanceof UmbraError;
|
|
78
|
+
}
|
|
79
|
+
__name(isUmbraError, "isUmbraError");
|
|
80
|
+
var MathematicsAssertionError = class _MathematicsAssertionError extends Error {
|
|
81
|
+
static {
|
|
82
|
+
__name(this, "MathematicsAssertionError");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The actual value that failed the assertion.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* The runtime type reflects what was actually passed to the assertion function:
|
|
89
|
+
* - `bigint` for integer assertions (`assertU8`, `assertU256`, etc.)
|
|
90
|
+
* - `Uint8Array` for byte-array assertions (`assertU256LeBytes`, `assertU32LeBytes`, etc.)
|
|
91
|
+
* - Any other type when a non-numeric value was passed unexpectedly
|
|
92
|
+
*
|
|
93
|
+
* @readonly
|
|
94
|
+
*/
|
|
95
|
+
value;
|
|
96
|
+
/**
|
|
97
|
+
* The type that was expected.
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* Contains the branded type name exactly as it appears in the SDK type system,
|
|
101
|
+
* e.g., `"U8"`, `"U256"`, `"U32LeBytes"`. Use this for structured logging or
|
|
102
|
+
* to build user-facing error messages without parsing the `message` string.
|
|
103
|
+
*
|
|
104
|
+
* @readonly
|
|
105
|
+
*/
|
|
106
|
+
expectedType;
|
|
107
|
+
/**
|
|
108
|
+
* Description of the constraint that was violated.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* Is `undefined` when only a type check failed (e.g., a `string` was passed where a
|
|
112
|
+
* `bigint` was expected). Contains a human-readable inequality or length rule when a
|
|
113
|
+
* value of the correct type was out of the allowed range.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* - `"0 <= value <= 255"` — U8 range violation
|
|
117
|
+
* - `"length === 32"` — U256LeBytes length violation
|
|
118
|
+
* - `"value >= 0"` — negative value passed to an unsigned integer assertion
|
|
119
|
+
*
|
|
120
|
+
* @readonly
|
|
121
|
+
*/
|
|
122
|
+
constraint;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a new MathematicsAssertionError.
|
|
125
|
+
*
|
|
126
|
+
* @param message - Human-readable description of the assertion failure. Should name
|
|
127
|
+
* the assertion function, the expected type, and the constraint that was violated.
|
|
128
|
+
* @param options - Structured diagnostic details attached to the error.
|
|
129
|
+
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
130
|
+
* @param options.expectedType - The name of the branded type that was expected
|
|
131
|
+
* (e.g., `"U8"`, `"U256LeBytes"`).
|
|
132
|
+
* @param options.constraint - Optional human-readable constraint description
|
|
133
|
+
* (e.g., `"0 <= value <= 255"`). Omit when the failure is a type mismatch rather
|
|
134
|
+
* than a range violation.
|
|
135
|
+
*/
|
|
136
|
+
constructor(message, options) {
|
|
137
|
+
super(message);
|
|
138
|
+
this.name = "MathematicsAssertionError";
|
|
139
|
+
this.value = options.value;
|
|
140
|
+
this.expectedType = options.expectedType;
|
|
141
|
+
this.constraint = options.constraint;
|
|
142
|
+
Error.captureStackTrace(this, _MathematicsAssertionError);
|
|
143
|
+
Object.setPrototypeOf(this, _MathematicsAssertionError.prototype);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var CryptographyAssertionError = class _CryptographyAssertionError extends Error {
|
|
147
|
+
static {
|
|
148
|
+
__name(this, "CryptographyAssertionError");
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The actual value that failed the assertion.
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* The runtime type reflects what was actually passed to the assertion function:
|
|
155
|
+
* - `bigint` for field element assertions (`assertBn254FieldElement`, etc.)
|
|
156
|
+
* - `Uint8Array` for byte-array assertions (`assertAesKey`, `assertX25519PrivateKey`, etc.)
|
|
157
|
+
* - Any other type when an entirely wrong value type was supplied
|
|
158
|
+
*
|
|
159
|
+
* @readonly
|
|
160
|
+
*/
|
|
161
|
+
value;
|
|
162
|
+
/**
|
|
163
|
+
* The type that was expected (e.g., `"Bn254FieldElement"`, `"PoseidonKey"`, `"AesKey"`).
|
|
164
|
+
*
|
|
165
|
+
* @remarks
|
|
166
|
+
* Contains the branded type name exactly as it appears in the SDK type system.
|
|
167
|
+
* Use this property for structured logging without parsing the `message` string.
|
|
168
|
+
*
|
|
169
|
+
* @readonly
|
|
170
|
+
*/
|
|
171
|
+
expectedType;
|
|
172
|
+
/**
|
|
173
|
+
* Description of the constraint that was violated.
|
|
174
|
+
*
|
|
175
|
+
* @remarks
|
|
176
|
+
* Is `undefined` for pure type-mismatch failures (e.g., `string` instead of `bigint`).
|
|
177
|
+
* Contains a human-readable constraint description for range and length violations
|
|
178
|
+
* (e.g., `"value < BN254_FIELD_PRIME"`, `"length === 32"`).
|
|
179
|
+
*
|
|
180
|
+
* @readonly
|
|
181
|
+
*/
|
|
182
|
+
constraint;
|
|
183
|
+
/**
|
|
184
|
+
* Creates a new CryptographyAssertionError.
|
|
185
|
+
*
|
|
186
|
+
* @param message - Human-readable description of the assertion failure. Should name
|
|
187
|
+
* the assertion function, the expected type, and the constraint that was violated.
|
|
188
|
+
* @param options - Structured diagnostic details attached to the error.
|
|
189
|
+
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
190
|
+
* @param options.expectedType - The name of the branded cryptographic type that was
|
|
191
|
+
* expected (e.g., `"Bn254FieldElement"`, `"AesKey"`).
|
|
192
|
+
* @param options.constraint - Optional human-readable constraint description.
|
|
193
|
+
* Omit when the failure is a type mismatch rather than a range or length violation.
|
|
194
|
+
*/
|
|
195
|
+
constructor(message, options) {
|
|
196
|
+
super(message);
|
|
197
|
+
this.name = "CryptographyAssertionError";
|
|
198
|
+
this.value = options.value;
|
|
199
|
+
this.expectedType = options.expectedType;
|
|
200
|
+
this.constraint = options.constraint;
|
|
201
|
+
Error.captureStackTrace(this, _CryptographyAssertionError);
|
|
202
|
+
Object.setPrototypeOf(this, _CryptographyAssertionError.prototype);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var SolanaAssertionError = class _SolanaAssertionError extends Error {
|
|
206
|
+
static {
|
|
207
|
+
__name(this, "SolanaAssertionError");
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The actual value that failed the assertion.
|
|
211
|
+
*
|
|
212
|
+
* @remarks
|
|
213
|
+
* The runtime type reflects what was actually passed to the assertion function:
|
|
214
|
+
* - `string` for Base58-encoded assertions (`assertTransactionSignature`, etc.)
|
|
215
|
+
* - `Uint8Array` for byte-array assertions (`assertSignatureBytes`, etc.)
|
|
216
|
+
* - Any other type when a completely wrong value type was supplied
|
|
217
|
+
*
|
|
218
|
+
* @readonly
|
|
219
|
+
*/
|
|
220
|
+
value;
|
|
221
|
+
/**
|
|
222
|
+
* The type that was expected (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
|
|
223
|
+
*
|
|
224
|
+
* @remarks
|
|
225
|
+
* Contains the branded type name exactly as it appears in the SDK type system.
|
|
226
|
+
* Use this for structured logging without parsing the `message` string.
|
|
227
|
+
*
|
|
228
|
+
* @readonly
|
|
229
|
+
*/
|
|
230
|
+
expectedType;
|
|
231
|
+
/**
|
|
232
|
+
* Description of the constraint that was violated.
|
|
233
|
+
*
|
|
234
|
+
* @remarks
|
|
235
|
+
* Is `undefined` for pure type-mismatch failures. Contains a human-readable rule
|
|
236
|
+
* for encoding or length violations (e.g., `"valid Base58"`, `"length === 64"`).
|
|
237
|
+
*
|
|
238
|
+
* @readonly
|
|
239
|
+
*/
|
|
240
|
+
constraint;
|
|
241
|
+
/**
|
|
242
|
+
* Creates a new SolanaAssertionError.
|
|
243
|
+
*
|
|
244
|
+
* @param message - Human-readable description of the assertion failure. Should name
|
|
245
|
+
* the assertion function, the expected type, and the constraint that was violated.
|
|
246
|
+
* @param options - Structured diagnostic details attached to the error.
|
|
247
|
+
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
248
|
+
* @param options.expectedType - The name of the branded Solana type that was expected
|
|
249
|
+
* (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
|
|
250
|
+
* @param options.constraint - Optional human-readable constraint description.
|
|
251
|
+
* Omit when the failure is a type mismatch rather than an encoding or length violation.
|
|
252
|
+
*/
|
|
253
|
+
constructor(message, options) {
|
|
254
|
+
super(message);
|
|
255
|
+
this.name = "SolanaAssertionError";
|
|
256
|
+
this.value = options.value;
|
|
257
|
+
this.expectedType = options.expectedType;
|
|
258
|
+
this.constraint = options.constraint;
|
|
259
|
+
Error.captureStackTrace(this, _SolanaAssertionError);
|
|
260
|
+
Object.setPrototypeOf(this, _SolanaAssertionError.prototype);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
var TemporalAssertionError = class extends Error {
|
|
264
|
+
static {
|
|
265
|
+
__name(this, "TemporalAssertionError");
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The actual value that failed the assertion.
|
|
269
|
+
*
|
|
270
|
+
* @remarks
|
|
271
|
+
* Will be a `bigint` for all temporal assertions since the temporal types are
|
|
272
|
+
* BigInt-backed branded types (e.g., `Year`, `Month`, `Day`). May also be any
|
|
273
|
+
* other type when a non-bigint value was supplied unexpectedly.
|
|
274
|
+
*
|
|
275
|
+
* @readonly
|
|
276
|
+
*/
|
|
277
|
+
value;
|
|
278
|
+
/**
|
|
279
|
+
* The type that was expected (e.g., `"Year"`, `"Month"`, `"Hour"`).
|
|
280
|
+
*
|
|
281
|
+
* @remarks
|
|
282
|
+
* Contains the branded temporal type name exactly as it appears in the SDK type system.
|
|
283
|
+
* Use this for structured logging without parsing the `message` string.
|
|
284
|
+
*
|
|
285
|
+
* @readonly
|
|
286
|
+
*/
|
|
287
|
+
expectedType;
|
|
288
|
+
/**
|
|
289
|
+
* Description of the constraint that was violated.
|
|
290
|
+
*
|
|
291
|
+
* @remarks
|
|
292
|
+
* Contains a human-readable range rule for out-of-range values
|
|
293
|
+
* (e.g., `"1 <= value <= 12"` for a month violation). Is `undefined` only for
|
|
294
|
+
* pure type-mismatch failures (e.g., a `string` passed where a `bigint` was expected),
|
|
295
|
+
* which should not occur in normal usage.
|
|
296
|
+
*
|
|
297
|
+
* @readonly
|
|
298
|
+
*/
|
|
299
|
+
constraint;
|
|
300
|
+
/**
|
|
301
|
+
* Creates a new TemporalAssertionError.
|
|
302
|
+
*
|
|
303
|
+
* @param message - Human-readable description of the assertion failure. Should name
|
|
304
|
+
* the assertion function, the expected type, and the violated range constraint.
|
|
305
|
+
* @param details - Structured diagnostic details attached to the error.
|
|
306
|
+
* @param details.value - The actual `bigint` value (or other type) that was supplied
|
|
307
|
+
* and failed the temporal assertion.
|
|
308
|
+
* @param details.expectedType - The name of the branded temporal type that was expected
|
|
309
|
+
* (e.g., `"Year"`, `"Month"`, `"Hour"`).
|
|
310
|
+
* @param details.constraint - Optional human-readable range description
|
|
311
|
+
* (e.g., `"1 <= value <= 12"`). Omit when the failure is a type mismatch.
|
|
312
|
+
*/
|
|
313
|
+
constructor(message, details) {
|
|
314
|
+
super(message);
|
|
315
|
+
this.name = "TemporalAssertionError";
|
|
316
|
+
this.value = details.value;
|
|
317
|
+
this.expectedType = details.expectedType;
|
|
318
|
+
this.constraint = details.constraint;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/crypto/errors.ts
|
|
323
|
+
var CryptographyError = class extends UmbraError {
|
|
324
|
+
static {
|
|
325
|
+
__name(this, "CryptographyError");
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* The cryptographic operation that failed.
|
|
329
|
+
*/
|
|
330
|
+
operation;
|
|
331
|
+
constructor(message, options) {
|
|
332
|
+
super(message, {
|
|
333
|
+
code: options?.code ?? "CRYPTOGRAPHY_ERROR",
|
|
334
|
+
...options?.context !== void 0 && {
|
|
335
|
+
context: options.context
|
|
336
|
+
},
|
|
337
|
+
...options?.cause !== void 0 && {
|
|
338
|
+
cause: options.cause
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
this.name = "CryptographyError";
|
|
342
|
+
if (options?.operation !== void 0) {
|
|
343
|
+
this.operation = options.operation;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
function isCryptographyError(error) {
|
|
348
|
+
return error instanceof CryptographyError;
|
|
349
|
+
}
|
|
350
|
+
__name(isCryptographyError, "isCryptographyError");
|
|
351
|
+
|
|
352
|
+
// src/solana/errors.ts
|
|
353
|
+
var InstructionError = class extends UmbraError {
|
|
354
|
+
static {
|
|
355
|
+
__name(this, "InstructionError");
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* The name of the instruction that failed during construction or validation.
|
|
359
|
+
*
|
|
360
|
+
* @remarks
|
|
361
|
+
* Matches the Anchor instruction name (camelCase), e.g. `"encryptedDeposit"`,
|
|
362
|
+
* `"initUserAccount"`. May be `undefined` if the failing instruction could
|
|
363
|
+
* not be identified at the throw site.
|
|
364
|
+
*/
|
|
365
|
+
instructionName;
|
|
366
|
+
/**
|
|
367
|
+
* Creates a new `InstructionError`.
|
|
368
|
+
*
|
|
369
|
+
* @param message - Human-readable description of the instruction failure.
|
|
370
|
+
* @param options - Optional structured metadata.
|
|
371
|
+
* @param options.code - Error code string. Defaults to `"INSTRUCTION_ERROR"`.
|
|
372
|
+
* @param options.instructionName - The name of the failing instruction.
|
|
373
|
+
* @param options.context - Arbitrary key-value pairs for diagnostic context.
|
|
374
|
+
* @param options.cause - The underlying error that caused this failure, if any.
|
|
375
|
+
*/
|
|
376
|
+
constructor(message, options) {
|
|
377
|
+
super(message, {
|
|
378
|
+
code: options?.code ?? "INSTRUCTION_ERROR",
|
|
379
|
+
...options?.context !== void 0 && {
|
|
380
|
+
context: options.context
|
|
381
|
+
},
|
|
382
|
+
...options?.cause !== void 0 && {
|
|
383
|
+
cause: options.cause
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
this.name = "InstructionError";
|
|
387
|
+
if (options?.instructionName !== void 0) {
|
|
388
|
+
this.instructionName = options.instructionName;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
var RpcError = class extends UmbraError {
|
|
393
|
+
static {
|
|
394
|
+
__name(this, "RpcError");
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* The RPC endpoint URL that was called when the error occurred.
|
|
398
|
+
*
|
|
399
|
+
* @remarks
|
|
400
|
+
* May be `undefined` if the endpoint was not known at the throw site (e.g.,
|
|
401
|
+
* when the error originates deep within `@solana/kit` internals).
|
|
402
|
+
*/
|
|
403
|
+
endpoint;
|
|
404
|
+
/**
|
|
405
|
+
* The HTTP status code returned by the RPC node, if applicable.
|
|
406
|
+
*
|
|
407
|
+
* @remarks
|
|
408
|
+
* `undefined` for network-level failures (e.g., DNS resolution failure,
|
|
409
|
+
* connection refused) where no HTTP response was received.
|
|
410
|
+
*/
|
|
411
|
+
statusCode;
|
|
412
|
+
/**
|
|
413
|
+
* The JSON-RPC error code from the response body, if any.
|
|
414
|
+
*
|
|
415
|
+
* @remarks
|
|
416
|
+
* Set when the RPC node returns a well-formed JSON-RPC error object with a
|
|
417
|
+
* numeric `code` field. `undefined` for HTTP-level failures or when the node
|
|
418
|
+
* returns a malformed response body.
|
|
419
|
+
*/
|
|
420
|
+
rpcErrorCode;
|
|
421
|
+
/**
|
|
422
|
+
* Creates a new `RpcError`.
|
|
423
|
+
*
|
|
424
|
+
* @param message - Human-readable description of the RPC failure.
|
|
425
|
+
* @param options - Optional structured metadata.
|
|
426
|
+
* @param options.code - Error code string. Defaults to `"RPC_ERROR"`.
|
|
427
|
+
* @param options.endpoint - The RPC endpoint URL that was called.
|
|
428
|
+
* @param options.statusCode - HTTP status code from the response, if any.
|
|
429
|
+
* @param options.rpcErrorCode - JSON-RPC error code from the response, if any.
|
|
430
|
+
* @param options.context - Arbitrary key-value pairs for diagnostic context.
|
|
431
|
+
* @param options.cause - The underlying error that caused this failure, if any.
|
|
432
|
+
*/
|
|
433
|
+
constructor(message, options) {
|
|
434
|
+
super(message, {
|
|
435
|
+
code: options?.code ?? "RPC_ERROR",
|
|
436
|
+
...options?.context !== void 0 && {
|
|
437
|
+
context: options.context
|
|
438
|
+
},
|
|
439
|
+
...options?.cause !== void 0 && {
|
|
440
|
+
cause: options.cause
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
this.name = "RpcError";
|
|
444
|
+
if (options?.endpoint !== void 0) {
|
|
445
|
+
this.endpoint = options.endpoint;
|
|
446
|
+
}
|
|
447
|
+
if (options?.statusCode !== void 0) {
|
|
448
|
+
this.statusCode = options.statusCode;
|
|
449
|
+
}
|
|
450
|
+
if (options?.rpcErrorCode !== void 0) {
|
|
451
|
+
this.rpcErrorCode = options.rpcErrorCode;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
var TransactionError = class extends UmbraError {
|
|
456
|
+
static {
|
|
457
|
+
__name(this, "TransactionError");
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* The transaction signature, if available.
|
|
461
|
+
*
|
|
462
|
+
* @remarks
|
|
463
|
+
* Base58-encoded signature string. Present when the transaction was submitted
|
|
464
|
+
* to the network but failed during execution. Use this to look up the failed
|
|
465
|
+
* transaction in a block explorer.
|
|
466
|
+
*/
|
|
467
|
+
signature;
|
|
468
|
+
/**
|
|
469
|
+
* Simulation log output from the transaction preflight, if available.
|
|
470
|
+
*
|
|
471
|
+
* @remarks
|
|
472
|
+
* Each entry in the array is one line of program log output (e.g.,
|
|
473
|
+
* `"Program log: ..."` or `"Program <address> failed: ..."`). Anchor programs
|
|
474
|
+
* emit error codes and names here when constraints are violated.
|
|
475
|
+
*/
|
|
476
|
+
simulationLogs;
|
|
477
|
+
/**
|
|
478
|
+
* Creates a new `TransactionError`.
|
|
479
|
+
*
|
|
480
|
+
* @param message - Human-readable description of the transaction failure.
|
|
481
|
+
* @param options - Optional structured metadata.
|
|
482
|
+
* @param options.code - Error code string. Defaults to `"TRANSACTION_ERROR"`.
|
|
483
|
+
* @param options.signature - Base58-encoded transaction signature, if available.
|
|
484
|
+
* @param options.simulationLogs - Program log output from preflight simulation.
|
|
485
|
+
* @param options.context - Arbitrary key-value pairs for diagnostic context.
|
|
486
|
+
* @param options.cause - The underlying error that caused this failure, if any.
|
|
487
|
+
*/
|
|
488
|
+
constructor(message, options) {
|
|
489
|
+
super(message, {
|
|
490
|
+
code: options?.code ?? "TRANSACTION_ERROR",
|
|
491
|
+
...options?.context !== void 0 && {
|
|
492
|
+
context: options.context
|
|
493
|
+
},
|
|
494
|
+
...options?.cause !== void 0 && {
|
|
495
|
+
cause: options.cause
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
this.name = "TransactionError";
|
|
499
|
+
if (options?.signature !== void 0) {
|
|
500
|
+
this.signature = options.signature;
|
|
501
|
+
}
|
|
502
|
+
if (options?.simulationLogs !== void 0) {
|
|
503
|
+
this.simulationLogs = options.simulationLogs;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
var TransactionSigningError = class extends TransactionError {
|
|
508
|
+
static {
|
|
509
|
+
__name(this, "TransactionSigningError");
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Whether the signing was explicitly rejected by the user.
|
|
513
|
+
*
|
|
514
|
+
* @remarks
|
|
515
|
+
* `true` when the wallet UI presented a sign request and the user actively
|
|
516
|
+
* clicked "Reject" or equivalent. `false` when the failure was due to a
|
|
517
|
+
* technical issue (disconnected device, timeout, missing key).
|
|
518
|
+
*
|
|
519
|
+
* @defaultValue `false`
|
|
520
|
+
*/
|
|
521
|
+
wasRejected;
|
|
522
|
+
/**
|
|
523
|
+
* The address of the signer that failed to produce a signature.
|
|
524
|
+
*
|
|
525
|
+
* @remarks
|
|
526
|
+
* Base58-encoded public key string. May be `undefined` if the failing signer
|
|
527
|
+
* could not be identified at the throw site.
|
|
528
|
+
*/
|
|
529
|
+
signerAddress;
|
|
530
|
+
/**
|
|
531
|
+
* Creates a new `TransactionSigningError`.
|
|
532
|
+
*
|
|
533
|
+
* @param message - Human-readable description of the signing failure.
|
|
534
|
+
* @param options - Optional structured metadata.
|
|
535
|
+
* @param options.code - Error code string. Defaults to `"TRANSACTION_SIGNING_ERROR"`.
|
|
536
|
+
* @param options.wasRejected - Whether the user deliberately rejected. Defaults to `false`.
|
|
537
|
+
* @param options.signerAddress - Base58 address of the signer that failed.
|
|
538
|
+
* @param options.signature - Transaction signature, if the transaction was partially signed.
|
|
539
|
+
* @param options.context - Arbitrary key-value pairs for diagnostic context.
|
|
540
|
+
* @param options.cause - The underlying error that caused this failure, if any.
|
|
541
|
+
*/
|
|
542
|
+
constructor(message, options) {
|
|
543
|
+
super(message, {
|
|
544
|
+
code: options?.code ?? "TRANSACTION_SIGNING_ERROR",
|
|
545
|
+
...options?.signature !== void 0 && {
|
|
546
|
+
signature: options.signature
|
|
547
|
+
},
|
|
548
|
+
...options?.context !== void 0 && {
|
|
549
|
+
context: options.context
|
|
550
|
+
},
|
|
551
|
+
...options?.cause !== void 0 && {
|
|
552
|
+
cause: options.cause
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
this.name = "TransactionSigningError";
|
|
556
|
+
this.wasRejected = options?.wasRejected ?? false;
|
|
557
|
+
if (options?.signerAddress !== void 0) {
|
|
558
|
+
this.signerAddress = options.signerAddress;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
var MasterSeedSigningRejectedError = class extends TransactionSigningError {
|
|
563
|
+
static {
|
|
564
|
+
__name(this, "MasterSeedSigningRejectedError");
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Creates a new `MasterSeedSigningRejectedError`.
|
|
568
|
+
*
|
|
569
|
+
* @param message - Human-readable description. Defaults to a standard rejection
|
|
570
|
+
* message explaining that the user declined the required derivation signature.
|
|
571
|
+
* @param options - Optional structured metadata.
|
|
572
|
+
* @param options.signerAddress - Base58 address of the wallet that rejected.
|
|
573
|
+
* @param options.context - Arbitrary key-value pairs for diagnostic context.
|
|
574
|
+
* @param options.cause - The underlying error that caused this failure, if any.
|
|
575
|
+
*/
|
|
576
|
+
constructor(message = "Master seed derivation was rejected. The user declined to sign the required message.", options) {
|
|
577
|
+
super(message, {
|
|
578
|
+
code: "MASTER_SEED_SIGNING_REJECTED",
|
|
579
|
+
wasRejected: true,
|
|
580
|
+
...options?.signerAddress !== void 0 && {
|
|
581
|
+
signerAddress: options.signerAddress
|
|
582
|
+
},
|
|
583
|
+
...options?.context !== void 0 && {
|
|
584
|
+
context: options.context
|
|
585
|
+
},
|
|
586
|
+
...options?.cause !== void 0 && {
|
|
587
|
+
cause: options.cause
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
this.name = "MasterSeedSigningRejectedError";
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
function isInstructionError(error) {
|
|
594
|
+
return error instanceof InstructionError;
|
|
595
|
+
}
|
|
596
|
+
__name(isInstructionError, "isInstructionError");
|
|
597
|
+
function isRpcError(error) {
|
|
598
|
+
return error instanceof RpcError;
|
|
599
|
+
}
|
|
600
|
+
__name(isRpcError, "isRpcError");
|
|
601
|
+
function isTransactionError(error) {
|
|
602
|
+
return error instanceof TransactionError;
|
|
603
|
+
}
|
|
604
|
+
__name(isTransactionError, "isTransactionError");
|
|
605
|
+
function isTransactionSigningError(error) {
|
|
606
|
+
return error instanceof TransactionSigningError;
|
|
607
|
+
}
|
|
608
|
+
__name(isTransactionSigningError, "isTransactionSigningError");
|
|
609
|
+
|
|
610
|
+
// src/umbra/errors.ts
|
|
611
|
+
var EncryptedDepositError = class extends UmbraError {
|
|
612
|
+
static {
|
|
613
|
+
__name(this, "EncryptedDepositError");
|
|
614
|
+
}
|
|
615
|
+
stage;
|
|
616
|
+
constructor(stage, message, cause) {
|
|
617
|
+
super(message, {
|
|
618
|
+
code: `ENCRYPTED_DEPOSIT_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
619
|
+
cause
|
|
620
|
+
});
|
|
621
|
+
this.name = "EncryptedDepositError";
|
|
622
|
+
this.stage = stage;
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
function isEncryptedDepositError(error) {
|
|
626
|
+
return error instanceof EncryptedDepositError;
|
|
627
|
+
}
|
|
628
|
+
__name(isEncryptedDepositError, "isEncryptedDepositError");
|
|
629
|
+
var EncryptedWithdrawalError = class extends UmbraError {
|
|
630
|
+
static {
|
|
631
|
+
__name(this, "EncryptedWithdrawalError");
|
|
632
|
+
}
|
|
633
|
+
stage;
|
|
634
|
+
constructor(stage, message, cause) {
|
|
635
|
+
super(message, {
|
|
636
|
+
code: `ENCRYPTED_WITHDRAWAL_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
637
|
+
cause
|
|
638
|
+
});
|
|
639
|
+
this.name = "EncryptedWithdrawalError";
|
|
640
|
+
this.stage = stage;
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
function isEncryptedWithdrawalError(error) {
|
|
644
|
+
return error instanceof EncryptedWithdrawalError;
|
|
645
|
+
}
|
|
646
|
+
__name(isEncryptedWithdrawalError, "isEncryptedWithdrawalError");
|
|
647
|
+
var RegistrationError = class extends UmbraError {
|
|
648
|
+
static {
|
|
649
|
+
__name(this, "RegistrationError");
|
|
650
|
+
}
|
|
651
|
+
stage;
|
|
652
|
+
constructor(stage, message, cause) {
|
|
653
|
+
super(message, {
|
|
654
|
+
code: `REGISTRATION_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
655
|
+
cause
|
|
656
|
+
});
|
|
657
|
+
this.name = "RegistrationError";
|
|
658
|
+
this.stage = stage;
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
function isRegistrationError(error) {
|
|
662
|
+
return error instanceof RegistrationError;
|
|
663
|
+
}
|
|
664
|
+
__name(isRegistrationError, "isRegistrationError");
|
|
665
|
+
var ConversionError = class extends UmbraError {
|
|
666
|
+
static {
|
|
667
|
+
__name(this, "ConversionError");
|
|
668
|
+
}
|
|
669
|
+
stage;
|
|
670
|
+
constructor(stage, message, cause) {
|
|
671
|
+
super(message, {
|
|
672
|
+
code: `CONVERSION_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
673
|
+
cause
|
|
674
|
+
});
|
|
675
|
+
this.name = "ConversionError";
|
|
676
|
+
this.stage = stage;
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
function isConversionError(error) {
|
|
680
|
+
return error instanceof ConversionError;
|
|
681
|
+
}
|
|
682
|
+
__name(isConversionError, "isConversionError");
|
|
683
|
+
var CreateUtxoError = class extends UmbraError {
|
|
684
|
+
static {
|
|
685
|
+
__name(this, "CreateUtxoError");
|
|
686
|
+
}
|
|
687
|
+
stage;
|
|
688
|
+
constructor(stage, message, cause) {
|
|
689
|
+
super(message, {
|
|
690
|
+
code: `CREATE_UTXO_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
691
|
+
cause
|
|
692
|
+
});
|
|
693
|
+
this.name = "CreateUtxoError";
|
|
694
|
+
this.stage = stage;
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
function isCreateUtxoError(error) {
|
|
698
|
+
return error instanceof CreateUtxoError;
|
|
699
|
+
}
|
|
700
|
+
__name(isCreateUtxoError, "isCreateUtxoError");
|
|
701
|
+
var FetchUtxosError = class extends UmbraError {
|
|
702
|
+
static {
|
|
703
|
+
__name(this, "FetchUtxosError");
|
|
704
|
+
}
|
|
705
|
+
stage;
|
|
706
|
+
constructor(stage, message, cause) {
|
|
707
|
+
super(message, {
|
|
708
|
+
code: `FETCH_UTXOS_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
709
|
+
cause
|
|
710
|
+
});
|
|
711
|
+
this.name = "FetchUtxosError";
|
|
712
|
+
this.stage = stage;
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
function isFetchUtxosError(error) {
|
|
716
|
+
return error instanceof FetchUtxosError;
|
|
717
|
+
}
|
|
718
|
+
__name(isFetchUtxosError, "isFetchUtxosError");
|
|
719
|
+
var ClaimUtxoError = class extends UmbraError {
|
|
720
|
+
static {
|
|
721
|
+
__name(this, "ClaimUtxoError");
|
|
722
|
+
}
|
|
723
|
+
stage;
|
|
724
|
+
constructor(stage, message, cause) {
|
|
725
|
+
super(message, {
|
|
726
|
+
code: `CLAIM_UTXO_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
727
|
+
cause
|
|
728
|
+
});
|
|
729
|
+
this.name = "ClaimUtxoError";
|
|
730
|
+
this.stage = stage;
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
function isClaimUtxoError(error) {
|
|
734
|
+
return error instanceof ClaimUtxoError;
|
|
735
|
+
}
|
|
736
|
+
__name(isClaimUtxoError, "isClaimUtxoError");
|
|
737
|
+
var QueryError = class extends UmbraError {
|
|
738
|
+
static {
|
|
739
|
+
__name(this, "QueryError");
|
|
740
|
+
}
|
|
741
|
+
stage;
|
|
742
|
+
constructor(stage, message, cause) {
|
|
743
|
+
super(message, {
|
|
744
|
+
code: `QUERY_${stage.toUpperCase().replaceAll("-", "_")}`,
|
|
745
|
+
cause
|
|
746
|
+
});
|
|
747
|
+
this.name = "QueryError";
|
|
748
|
+
this.stage = stage;
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
function isQueryError(error) {
|
|
752
|
+
return error instanceof QueryError;
|
|
753
|
+
}
|
|
754
|
+
__name(isQueryError, "isQueryError");
|
|
755
|
+
|
|
756
|
+
export { ClaimUtxoError, ConversionError, CreateUtxoError, CryptographyAssertionError, CryptographyError, EncryptedDepositError, EncryptedWithdrawalError, FetchUtxosError, InstructionError, MasterSeedSigningRejectedError, MathematicsAssertionError, QueryError, RegistrationError, RpcError, SolanaAssertionError, TemporalAssertionError, TransactionError, TransactionSigningError, UmbraError, isClaimUtxoError, isConversionError, isCreateUtxoError, isCryptographyError, isEncryptedDepositError, isEncryptedWithdrawalError, isFetchUtxosError, isInstructionError, isQueryError, isRegistrationError, isRpcError, isTransactionError, isTransactionSigningError, isUmbraError };
|
|
757
|
+
//# sourceMappingURL=chunk-WVHQ46DD.js.map
|
|
758
|
+
//# sourceMappingURL=chunk-WVHQ46DD.js.map
|