@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.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -0
  3. package/dist/addresses-Brzgurv_.d.ts +145 -0
  4. package/dist/addresses-D_0YAS6B.d.cts +145 -0
  5. package/dist/chunk-2Q75CQQJ.js +12 -0
  6. package/dist/chunk-2Q75CQQJ.js.map +1 -0
  7. package/dist/chunk-7QVYU63E.js +6 -0
  8. package/dist/chunk-7QVYU63E.js.map +1 -0
  9. package/dist/chunk-BM7N6N7E.js +1883 -0
  10. package/dist/chunk-BM7N6N7E.js.map +1 -0
  11. package/dist/chunk-GXKSUB2U.cjs +4416 -0
  12. package/dist/chunk-GXKSUB2U.cjs.map +1 -0
  13. package/dist/chunk-HOEXDXRC.cjs +792 -0
  14. package/dist/chunk-HOEXDXRC.cjs.map +1 -0
  15. package/dist/chunk-MDFSBU5W.cjs +2033 -0
  16. package/dist/chunk-MDFSBU5W.cjs.map +1 -0
  17. package/dist/chunk-MQY7HDIA.js +600 -0
  18. package/dist/chunk-MQY7HDIA.js.map +1 -0
  19. package/dist/chunk-MVKTV3FT.cjs +20 -0
  20. package/dist/chunk-MVKTV3FT.cjs.map +1 -0
  21. package/dist/chunk-PG2J6V6Y.js +4094 -0
  22. package/dist/chunk-PG2J6V6Y.js.map +1 -0
  23. package/dist/chunk-PK6SKIKE.cjs +8 -0
  24. package/dist/chunk-PK6SKIKE.cjs.map +1 -0
  25. package/dist/chunk-VEGLTTYQ.cjs +621 -0
  26. package/dist/chunk-VEGLTTYQ.cjs.map +1 -0
  27. package/dist/chunk-WVHQ46DD.js +758 -0
  28. package/dist/chunk-WVHQ46DD.js.map +1 -0
  29. package/dist/constants/index.cjs +316 -0
  30. package/dist/constants/index.cjs.map +1 -0
  31. package/dist/constants/index.d.cts +739 -0
  32. package/dist/constants/index.d.ts +739 -0
  33. package/dist/constants/index.js +193 -0
  34. package/dist/constants/index.js.map +1 -0
  35. package/dist/cryptography-BTGC72u-.d.cts +4809 -0
  36. package/dist/cryptography-BTGC72u-.d.ts +4809 -0
  37. package/dist/errors/index.cjs +141 -0
  38. package/dist/errors/index.cjs.map +1 -0
  39. package/dist/errors/index.d.cts +1415 -0
  40. package/dist/errors/index.d.ts +1415 -0
  41. package/dist/errors/index.js +4 -0
  42. package/dist/errors/index.js.map +1 -0
  43. package/dist/index-B9pDY73x.d.ts +12933 -0
  44. package/dist/index-CLj_zWSD.d.ts +235 -0
  45. package/dist/index-CX6_pIRS.d.cts +235 -0
  46. package/dist/index-D33yo0qB.d.cts +12933 -0
  47. package/dist/index.cjs +22464 -0
  48. package/dist/index.cjs.map +1 -0
  49. package/dist/index.d.cts +11694 -0
  50. package/dist/index.d.ts +11694 -0
  51. package/dist/index.js +22314 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/interfaces/index.cjs +4 -0
  54. package/dist/interfaces/index.cjs.map +1 -0
  55. package/dist/interfaces/index.d.cts +8 -0
  56. package/dist/interfaces/index.d.ts +8 -0
  57. package/dist/interfaces/index.js +3 -0
  58. package/dist/interfaces/index.js.map +1 -0
  59. package/dist/networks-C-orpSFW.d.ts +65 -0
  60. package/dist/networks-FxYERGD1.d.cts +65 -0
  61. package/dist/types/index.cjs +605 -0
  62. package/dist/types/index.cjs.map +1 -0
  63. package/dist/types/index.d.cts +1853 -0
  64. package/dist/types/index.d.ts +1853 -0
  65. package/dist/types/index.js +4 -0
  66. package/dist/types/index.js.map +1 -0
  67. package/dist/types-BBuELtY8.d.cts +495 -0
  68. package/dist/types-n-sHFcgr.d.ts +495 -0
  69. package/dist/utils/index.cjs +1295 -0
  70. package/dist/utils/index.cjs.map +1 -0
  71. package/dist/utils/index.d.cts +9559 -0
  72. package/dist/utils/index.d.ts +9559 -0
  73. package/dist/utils/index.js +6 -0
  74. package/dist/utils/index.js.map +1 -0
  75. package/dist/versions-D9PqsEvj.d.cts +173 -0
  76. package/dist/versions-D9PqsEvj.d.ts +173 -0
  77. package/package.json +151 -0
@@ -0,0 +1,792 @@
1
+ 'use strict';
2
+
3
+ var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
4
+
5
+ // src/common/errors.ts
6
+ var UmbraError = class _UmbraError extends Error {
7
+ static {
8
+ chunkPK6SKIKE_cjs.__name(this, "UmbraError");
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");
328
+ }
329
+ /**
330
+ * The cryptographic operation that failed.
331
+ */
332
+ operation;
333
+ constructor(message, options) {
334
+ super(message, {
335
+ code: options?.code ?? "CRYPTOGRAPHY_ERROR",
336
+ ...options?.context !== void 0 && {
337
+ context: options.context
338
+ },
339
+ ...options?.cause !== void 0 && {
340
+ cause: options.cause
341
+ }
342
+ });
343
+ this.name = "CryptographyError";
344
+ if (options?.operation !== void 0) {
345
+ this.operation = options.operation;
346
+ }
347
+ }
348
+ };
349
+ function isCryptographyError(error) {
350
+ return error instanceof CryptographyError;
351
+ }
352
+ chunkPK6SKIKE_cjs.__name(isCryptographyError, "isCryptographyError");
353
+
354
+ // src/solana/errors.ts
355
+ var InstructionError = class extends UmbraError {
356
+ static {
357
+ chunkPK6SKIKE_cjs.__name(this, "InstructionError");
358
+ }
359
+ /**
360
+ * The name of the instruction that failed during construction or validation.
361
+ *
362
+ * @remarks
363
+ * Matches the Anchor instruction name (camelCase), e.g. `"encryptedDeposit"`,
364
+ * `"initUserAccount"`. May be `undefined` if the failing instruction could
365
+ * not be identified at the throw site.
366
+ */
367
+ instructionName;
368
+ /**
369
+ * Creates a new `InstructionError`.
370
+ *
371
+ * @param message - Human-readable description of the instruction failure.
372
+ * @param options - Optional structured metadata.
373
+ * @param options.code - Error code string. Defaults to `"INSTRUCTION_ERROR"`.
374
+ * @param options.instructionName - The name of the failing instruction.
375
+ * @param options.context - Arbitrary key-value pairs for diagnostic context.
376
+ * @param options.cause - The underlying error that caused this failure, if any.
377
+ */
378
+ constructor(message, options) {
379
+ super(message, {
380
+ code: options?.code ?? "INSTRUCTION_ERROR",
381
+ ...options?.context !== void 0 && {
382
+ context: options.context
383
+ },
384
+ ...options?.cause !== void 0 && {
385
+ cause: options.cause
386
+ }
387
+ });
388
+ this.name = "InstructionError";
389
+ if (options?.instructionName !== void 0) {
390
+ this.instructionName = options.instructionName;
391
+ }
392
+ }
393
+ };
394
+ var RpcError = class extends UmbraError {
395
+ static {
396
+ chunkPK6SKIKE_cjs.__name(this, "RpcError");
397
+ }
398
+ /**
399
+ * The RPC endpoint URL that was called when the error occurred.
400
+ *
401
+ * @remarks
402
+ * May be `undefined` if the endpoint was not known at the throw site (e.g.,
403
+ * when the error originates deep within `@solana/kit` internals).
404
+ */
405
+ endpoint;
406
+ /**
407
+ * The HTTP status code returned by the RPC node, if applicable.
408
+ *
409
+ * @remarks
410
+ * `undefined` for network-level failures (e.g., DNS resolution failure,
411
+ * connection refused) where no HTTP response was received.
412
+ */
413
+ statusCode;
414
+ /**
415
+ * The JSON-RPC error code from the response body, if any.
416
+ *
417
+ * @remarks
418
+ * Set when the RPC node returns a well-formed JSON-RPC error object with a
419
+ * numeric `code` field. `undefined` for HTTP-level failures or when the node
420
+ * returns a malformed response body.
421
+ */
422
+ rpcErrorCode;
423
+ /**
424
+ * Creates a new `RpcError`.
425
+ *
426
+ * @param message - Human-readable description of the RPC failure.
427
+ * @param options - Optional structured metadata.
428
+ * @param options.code - Error code string. Defaults to `"RPC_ERROR"`.
429
+ * @param options.endpoint - The RPC endpoint URL that was called.
430
+ * @param options.statusCode - HTTP status code from the response, if any.
431
+ * @param options.rpcErrorCode - JSON-RPC error code from the response, if any.
432
+ * @param options.context - Arbitrary key-value pairs for diagnostic context.
433
+ * @param options.cause - The underlying error that caused this failure, if any.
434
+ */
435
+ constructor(message, options) {
436
+ super(message, {
437
+ code: options?.code ?? "RPC_ERROR",
438
+ ...options?.context !== void 0 && {
439
+ context: options.context
440
+ },
441
+ ...options?.cause !== void 0 && {
442
+ cause: options.cause
443
+ }
444
+ });
445
+ this.name = "RpcError";
446
+ if (options?.endpoint !== void 0) {
447
+ this.endpoint = options.endpoint;
448
+ }
449
+ if (options?.statusCode !== void 0) {
450
+ this.statusCode = options.statusCode;
451
+ }
452
+ if (options?.rpcErrorCode !== void 0) {
453
+ this.rpcErrorCode = options.rpcErrorCode;
454
+ }
455
+ }
456
+ };
457
+ var TransactionError = class extends UmbraError {
458
+ static {
459
+ chunkPK6SKIKE_cjs.__name(this, "TransactionError");
460
+ }
461
+ /**
462
+ * The transaction signature, if available.
463
+ *
464
+ * @remarks
465
+ * Base58-encoded signature string. Present when the transaction was submitted
466
+ * to the network but failed during execution. Use this to look up the failed
467
+ * transaction in a block explorer.
468
+ */
469
+ signature;
470
+ /**
471
+ * Simulation log output from the transaction preflight, if available.
472
+ *
473
+ * @remarks
474
+ * Each entry in the array is one line of program log output (e.g.,
475
+ * `"Program log: ..."` or `"Program <address> failed: ..."`). Anchor programs
476
+ * emit error codes and names here when constraints are violated.
477
+ */
478
+ simulationLogs;
479
+ /**
480
+ * Creates a new `TransactionError`.
481
+ *
482
+ * @param message - Human-readable description of the transaction failure.
483
+ * @param options - Optional structured metadata.
484
+ * @param options.code - Error code string. Defaults to `"TRANSACTION_ERROR"`.
485
+ * @param options.signature - Base58-encoded transaction signature, if available.
486
+ * @param options.simulationLogs - Program log output from preflight simulation.
487
+ * @param options.context - Arbitrary key-value pairs for diagnostic context.
488
+ * @param options.cause - The underlying error that caused this failure, if any.
489
+ */
490
+ constructor(message, options) {
491
+ super(message, {
492
+ code: options?.code ?? "TRANSACTION_ERROR",
493
+ ...options?.context !== void 0 && {
494
+ context: options.context
495
+ },
496
+ ...options?.cause !== void 0 && {
497
+ cause: options.cause
498
+ }
499
+ });
500
+ this.name = "TransactionError";
501
+ if (options?.signature !== void 0) {
502
+ this.signature = options.signature;
503
+ }
504
+ if (options?.simulationLogs !== void 0) {
505
+ this.simulationLogs = options.simulationLogs;
506
+ }
507
+ }
508
+ };
509
+ var TransactionSigningError = class extends TransactionError {
510
+ static {
511
+ chunkPK6SKIKE_cjs.__name(this, "TransactionSigningError");
512
+ }
513
+ /**
514
+ * Whether the signing was explicitly rejected by the user.
515
+ *
516
+ * @remarks
517
+ * `true` when the wallet UI presented a sign request and the user actively
518
+ * clicked "Reject" or equivalent. `false` when the failure was due to a
519
+ * technical issue (disconnected device, timeout, missing key).
520
+ *
521
+ * @defaultValue `false`
522
+ */
523
+ wasRejected;
524
+ /**
525
+ * The address of the signer that failed to produce a signature.
526
+ *
527
+ * @remarks
528
+ * Base58-encoded public key string. May be `undefined` if the failing signer
529
+ * could not be identified at the throw site.
530
+ */
531
+ signerAddress;
532
+ /**
533
+ * Creates a new `TransactionSigningError`.
534
+ *
535
+ * @param message - Human-readable description of the signing failure.
536
+ * @param options - Optional structured metadata.
537
+ * @param options.code - Error code string. Defaults to `"TRANSACTION_SIGNING_ERROR"`.
538
+ * @param options.wasRejected - Whether the user deliberately rejected. Defaults to `false`.
539
+ * @param options.signerAddress - Base58 address of the signer that failed.
540
+ * @param options.signature - Transaction signature, if the transaction was partially signed.
541
+ * @param options.context - Arbitrary key-value pairs for diagnostic context.
542
+ * @param options.cause - The underlying error that caused this failure, if any.
543
+ */
544
+ constructor(message, options) {
545
+ super(message, {
546
+ code: options?.code ?? "TRANSACTION_SIGNING_ERROR",
547
+ ...options?.signature !== void 0 && {
548
+ signature: options.signature
549
+ },
550
+ ...options?.context !== void 0 && {
551
+ context: options.context
552
+ },
553
+ ...options?.cause !== void 0 && {
554
+ cause: options.cause
555
+ }
556
+ });
557
+ this.name = "TransactionSigningError";
558
+ this.wasRejected = options?.wasRejected ?? false;
559
+ if (options?.signerAddress !== void 0) {
560
+ this.signerAddress = options.signerAddress;
561
+ }
562
+ }
563
+ };
564
+ var MasterSeedSigningRejectedError = class extends TransactionSigningError {
565
+ static {
566
+ chunkPK6SKIKE_cjs.__name(this, "MasterSeedSigningRejectedError");
567
+ }
568
+ /**
569
+ * Creates a new `MasterSeedSigningRejectedError`.
570
+ *
571
+ * @param message - Human-readable description. Defaults to a standard rejection
572
+ * message explaining that the user declined the required derivation signature.
573
+ * @param options - Optional structured metadata.
574
+ * @param options.signerAddress - Base58 address of the wallet that rejected.
575
+ * @param options.context - Arbitrary key-value pairs for diagnostic context.
576
+ * @param options.cause - The underlying error that caused this failure, if any.
577
+ */
578
+ constructor(message = "Master seed derivation was rejected. The user declined to sign the required message.", options) {
579
+ super(message, {
580
+ code: "MASTER_SEED_SIGNING_REJECTED",
581
+ wasRejected: true,
582
+ ...options?.signerAddress !== void 0 && {
583
+ signerAddress: options.signerAddress
584
+ },
585
+ ...options?.context !== void 0 && {
586
+ context: options.context
587
+ },
588
+ ...options?.cause !== void 0 && {
589
+ cause: options.cause
590
+ }
591
+ });
592
+ this.name = "MasterSeedSigningRejectedError";
593
+ }
594
+ };
595
+ function isInstructionError(error) {
596
+ return error instanceof InstructionError;
597
+ }
598
+ chunkPK6SKIKE_cjs.__name(isInstructionError, "isInstructionError");
599
+ function isRpcError(error) {
600
+ return error instanceof RpcError;
601
+ }
602
+ chunkPK6SKIKE_cjs.__name(isRpcError, "isRpcError");
603
+ function isTransactionError(error) {
604
+ return error instanceof TransactionError;
605
+ }
606
+ chunkPK6SKIKE_cjs.__name(isTransactionError, "isTransactionError");
607
+ function isTransactionSigningError(error) {
608
+ return error instanceof TransactionSigningError;
609
+ }
610
+ chunkPK6SKIKE_cjs.__name(isTransactionSigningError, "isTransactionSigningError");
611
+
612
+ // src/umbra/errors.ts
613
+ var EncryptedDepositError = class extends UmbraError {
614
+ static {
615
+ chunkPK6SKIKE_cjs.__name(this, "EncryptedDepositError");
616
+ }
617
+ stage;
618
+ constructor(stage, message, cause) {
619
+ super(message, {
620
+ code: `ENCRYPTED_DEPOSIT_${stage.toUpperCase().replaceAll("-", "_")}`,
621
+ cause
622
+ });
623
+ this.name = "EncryptedDepositError";
624
+ this.stage = stage;
625
+ }
626
+ };
627
+ function isEncryptedDepositError(error) {
628
+ return error instanceof EncryptedDepositError;
629
+ }
630
+ chunkPK6SKIKE_cjs.__name(isEncryptedDepositError, "isEncryptedDepositError");
631
+ var EncryptedWithdrawalError = class extends UmbraError {
632
+ static {
633
+ chunkPK6SKIKE_cjs.__name(this, "EncryptedWithdrawalError");
634
+ }
635
+ stage;
636
+ constructor(stage, message, cause) {
637
+ super(message, {
638
+ code: `ENCRYPTED_WITHDRAWAL_${stage.toUpperCase().replaceAll("-", "_")}`,
639
+ cause
640
+ });
641
+ this.name = "EncryptedWithdrawalError";
642
+ this.stage = stage;
643
+ }
644
+ };
645
+ function isEncryptedWithdrawalError(error) {
646
+ return error instanceof EncryptedWithdrawalError;
647
+ }
648
+ chunkPK6SKIKE_cjs.__name(isEncryptedWithdrawalError, "isEncryptedWithdrawalError");
649
+ var RegistrationError = class extends UmbraError {
650
+ static {
651
+ chunkPK6SKIKE_cjs.__name(this, "RegistrationError");
652
+ }
653
+ stage;
654
+ constructor(stage, message, cause) {
655
+ super(message, {
656
+ code: `REGISTRATION_${stage.toUpperCase().replaceAll("-", "_")}`,
657
+ cause
658
+ });
659
+ this.name = "RegistrationError";
660
+ this.stage = stage;
661
+ }
662
+ };
663
+ function isRegistrationError(error) {
664
+ return error instanceof RegistrationError;
665
+ }
666
+ chunkPK6SKIKE_cjs.__name(isRegistrationError, "isRegistrationError");
667
+ var ConversionError = class extends UmbraError {
668
+ static {
669
+ chunkPK6SKIKE_cjs.__name(this, "ConversionError");
670
+ }
671
+ stage;
672
+ constructor(stage, message, cause) {
673
+ super(message, {
674
+ code: `CONVERSION_${stage.toUpperCase().replaceAll("-", "_")}`,
675
+ cause
676
+ });
677
+ this.name = "ConversionError";
678
+ this.stage = stage;
679
+ }
680
+ };
681
+ function isConversionError(error) {
682
+ return error instanceof ConversionError;
683
+ }
684
+ chunkPK6SKIKE_cjs.__name(isConversionError, "isConversionError");
685
+ var CreateUtxoError = class extends UmbraError {
686
+ static {
687
+ chunkPK6SKIKE_cjs.__name(this, "CreateUtxoError");
688
+ }
689
+ stage;
690
+ constructor(stage, message, cause) {
691
+ super(message, {
692
+ code: `CREATE_UTXO_${stage.toUpperCase().replaceAll("-", "_")}`,
693
+ cause
694
+ });
695
+ this.name = "CreateUtxoError";
696
+ this.stage = stage;
697
+ }
698
+ };
699
+ function isCreateUtxoError(error) {
700
+ return error instanceof CreateUtxoError;
701
+ }
702
+ chunkPK6SKIKE_cjs.__name(isCreateUtxoError, "isCreateUtxoError");
703
+ var FetchUtxosError = class extends UmbraError {
704
+ static {
705
+ chunkPK6SKIKE_cjs.__name(this, "FetchUtxosError");
706
+ }
707
+ stage;
708
+ constructor(stage, message, cause) {
709
+ super(message, {
710
+ code: `FETCH_UTXOS_${stage.toUpperCase().replaceAll("-", "_")}`,
711
+ cause
712
+ });
713
+ this.name = "FetchUtxosError";
714
+ this.stage = stage;
715
+ }
716
+ };
717
+ function isFetchUtxosError(error) {
718
+ return error instanceof FetchUtxosError;
719
+ }
720
+ chunkPK6SKIKE_cjs.__name(isFetchUtxosError, "isFetchUtxosError");
721
+ var ClaimUtxoError = class extends UmbraError {
722
+ static {
723
+ chunkPK6SKIKE_cjs.__name(this, "ClaimUtxoError");
724
+ }
725
+ stage;
726
+ constructor(stage, message, cause) {
727
+ super(message, {
728
+ code: `CLAIM_UTXO_${stage.toUpperCase().replaceAll("-", "_")}`,
729
+ cause
730
+ });
731
+ this.name = "ClaimUtxoError";
732
+ this.stage = stage;
733
+ }
734
+ };
735
+ function isClaimUtxoError(error) {
736
+ return error instanceof ClaimUtxoError;
737
+ }
738
+ chunkPK6SKIKE_cjs.__name(isClaimUtxoError, "isClaimUtxoError");
739
+ var QueryError = class extends UmbraError {
740
+ static {
741
+ chunkPK6SKIKE_cjs.__name(this, "QueryError");
742
+ }
743
+ stage;
744
+ constructor(stage, message, cause) {
745
+ super(message, {
746
+ code: `QUERY_${stage.toUpperCase().replaceAll("-", "_")}`,
747
+ cause
748
+ });
749
+ this.name = "QueryError";
750
+ this.stage = stage;
751
+ }
752
+ };
753
+ function isQueryError(error) {
754
+ return error instanceof QueryError;
755
+ }
756
+ chunkPK6SKIKE_cjs.__name(isQueryError, "isQueryError");
757
+
758
+ exports.ClaimUtxoError = ClaimUtxoError;
759
+ exports.ConversionError = ConversionError;
760
+ exports.CreateUtxoError = CreateUtxoError;
761
+ exports.CryptographyAssertionError = CryptographyAssertionError;
762
+ exports.CryptographyError = CryptographyError;
763
+ exports.EncryptedDepositError = EncryptedDepositError;
764
+ exports.EncryptedWithdrawalError = EncryptedWithdrawalError;
765
+ exports.FetchUtxosError = FetchUtxosError;
766
+ exports.InstructionError = InstructionError;
767
+ exports.MasterSeedSigningRejectedError = MasterSeedSigningRejectedError;
768
+ exports.MathematicsAssertionError = MathematicsAssertionError;
769
+ exports.QueryError = QueryError;
770
+ exports.RegistrationError = RegistrationError;
771
+ exports.RpcError = RpcError;
772
+ exports.SolanaAssertionError = SolanaAssertionError;
773
+ exports.TemporalAssertionError = TemporalAssertionError;
774
+ exports.TransactionError = TransactionError;
775
+ exports.TransactionSigningError = TransactionSigningError;
776
+ exports.UmbraError = UmbraError;
777
+ exports.isClaimUtxoError = isClaimUtxoError;
778
+ exports.isConversionError = isConversionError;
779
+ exports.isCreateUtxoError = isCreateUtxoError;
780
+ exports.isCryptographyError = isCryptographyError;
781
+ exports.isEncryptedDepositError = isEncryptedDepositError;
782
+ exports.isEncryptedWithdrawalError = isEncryptedWithdrawalError;
783
+ exports.isFetchUtxosError = isFetchUtxosError;
784
+ exports.isInstructionError = isInstructionError;
785
+ exports.isQueryError = isQueryError;
786
+ exports.isRegistrationError = isRegistrationError;
787
+ exports.isRpcError = isRpcError;
788
+ exports.isTransactionError = isTransactionError;
789
+ exports.isTransactionSigningError = isTransactionSigningError;
790
+ exports.isUmbraError = isUmbraError;
791
+ //# sourceMappingURL=chunk-HOEXDXRC.cjs.map
792
+ //# sourceMappingURL=chunk-HOEXDXRC.cjs.map