@umbra-privacy/sdk 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-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-JPDF7BIT.cjs +10892 -0
- package/dist/chunk-JPDF7BIT.cjs.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-RVUYPKKD.js +10750 -0
- package/dist/chunk-RVUYPKKD.js.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 +5126 -16118
- 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 +3219 -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
package/dist/errors/index.d.cts
CHANGED
|
@@ -1,593 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Centralized error hierarchy for the Umbra SDK.
|
|
5
|
-
* Contains the base `UmbraError` and all domain-specific assertion error classes.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* The SDK uses a two-level error hierarchy:
|
|
9
|
-
*
|
|
10
|
-
* 1. `UmbraError` — top-level base class for all SDK errors. Consumers can use
|
|
11
|
-
* `instanceof UmbraError` (or the `isUmbraError` type guard) to distinguish SDK errors
|
|
12
|
-
* from third-party or built-in errors in a catch block.
|
|
13
|
-
*
|
|
14
|
-
* 2. Domain assertion errors — thrown by type-assertion functions when a value fails
|
|
15
|
-
* validation. Each domain has its own class to make it easy to catch errors from a
|
|
16
|
-
* specific subsystem:
|
|
17
|
-
* - `MathematicsAssertionError` — thrown by `assertU8`, `assertU256`, etc.
|
|
18
|
-
* - `CryptographyAssertionError` — thrown by `assertBn254FieldElement`, `assertAesKey`, etc.
|
|
19
|
-
* - `SolanaAssertionError` — thrown by Solana-type assertion functions.
|
|
20
|
-
* - `TemporalAssertionError` — thrown by `assertYear`, `assertMonth`, etc.
|
|
21
|
-
*
|
|
22
|
-
* All four assertion error classes share the same three properties:
|
|
23
|
-
* - `value` — the actual value that failed
|
|
24
|
-
* - `expectedType` — the name of the expected branded type
|
|
25
|
-
* - `constraint` — optional human-readable constraint description
|
|
26
|
-
*
|
|
27
|
-
* @packageDocumentation
|
|
28
|
-
* @module common/errors
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Base error class for all Umbra SDK errors.
|
|
32
|
-
*
|
|
33
|
-
* All errors thrown by the SDK extend this class, allowing consumers
|
|
34
|
-
* to distinguish SDK errors from other errors using `instanceof`.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* Prefer using the `isUmbraError` type guard over `instanceof UmbraError` when writing
|
|
38
|
-
* defensive catch handlers — the type guard also works across module boundaries and
|
|
39
|
-
* iframe/realm boundaries where `instanceof` may fail due to different class references.
|
|
40
|
-
*
|
|
41
|
-
* Sub-classes (domain assertion errors) extend this class so callers can catch either
|
|
42
|
-
* all SDK errors at once (`instanceof UmbraError`) or only a specific domain's failures
|
|
43
|
-
* (e.g., `instanceof MathematicsAssertionError`).
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```typescript
|
|
47
|
-
* try {
|
|
48
|
-
* await umbraClient.register();
|
|
49
|
-
* } catch (error) {
|
|
50
|
-
* if (error instanceof UmbraError) {
|
|
51
|
-
* console.log('SDK error:', error.message);
|
|
52
|
-
* console.log('Error code:', error.code);
|
|
53
|
-
* } else {
|
|
54
|
-
* throw error; // Re-throw non-SDK errors
|
|
55
|
-
* }
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* @see {@link isUmbraError}
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
declare class UmbraError extends Error {
|
|
63
|
-
/**
|
|
64
|
-
* A machine-readable error code for programmatic error handling.
|
|
65
|
-
*
|
|
66
|
-
* @remarks
|
|
67
|
-
* Defaults to `"UMBRA_ERROR"` when no code is supplied in the constructor options.
|
|
68
|
-
* Sub-classes or specific throw sites should supply a more specific code to allow
|
|
69
|
-
* callers to branch on error identity without string-matching `message`.
|
|
70
|
-
*
|
|
71
|
-
* @readonly
|
|
72
|
-
*/
|
|
73
|
-
readonly code: string;
|
|
74
|
-
/**
|
|
75
|
-
* Additional context about the error.
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* A free-form key-value map of diagnostic data attached to the error at the throw site.
|
|
79
|
-
* Useful for logging and debugging — consumers should not rely on specific keys for
|
|
80
|
-
* control flow; use `code` for programmatic branching instead.
|
|
81
|
-
*
|
|
82
|
-
* Will be `undefined` when no context was provided to the constructor.
|
|
83
|
-
*
|
|
84
|
-
* @readonly
|
|
85
|
-
*/
|
|
86
|
-
readonly context?: Record<string, unknown>;
|
|
87
|
-
/**
|
|
88
|
-
* The original error that caused this error, if any.
|
|
89
|
-
*
|
|
90
|
-
* @remarks
|
|
91
|
-
* When an SDK function wraps a lower-level error (e.g., a failed RPC call or a
|
|
92
|
-
* cryptographic library error), it sets `cause` to the original thrown value so
|
|
93
|
-
* callers can inspect the full error chain.
|
|
94
|
-
*
|
|
95
|
-
* Will be `undefined` when there is no underlying cause.
|
|
96
|
-
*
|
|
97
|
-
* @readonly
|
|
98
|
-
*/
|
|
99
|
-
readonly cause?: unknown;
|
|
100
|
-
/**
|
|
101
|
-
* Creates a new UmbraError.
|
|
102
|
-
*
|
|
103
|
-
* @param message - Human-readable description of what went wrong. Should be
|
|
104
|
-
* actionable and specific enough for a developer to understand the failure
|
|
105
|
-
* without reading source code.
|
|
106
|
-
* @param options - Optional structured metadata attached to the error.
|
|
107
|
-
* @param options.code - Machine-readable error code for programmatic branching.
|
|
108
|
-
* Defaults to `"UMBRA_ERROR"` if omitted.
|
|
109
|
-
* @param options.context - Free-form diagnostic key-value pairs. Omit or set to
|
|
110
|
-
* `undefined` to leave the `context` property unset.
|
|
111
|
-
* @param options.cause - The original error that triggered this one. Enables
|
|
112
|
-
* full error-chain inspection. Omit or set to `undefined` when there is no
|
|
113
|
-
* underlying cause.
|
|
114
|
-
*
|
|
115
|
-
* @defaultValue `options` — `undefined` (all options optional)
|
|
116
|
-
* @defaultValue `options.code` — `"UMBRA_ERROR"`
|
|
117
|
-
*/
|
|
118
|
-
constructor(message: string, options?: {
|
|
119
|
-
code?: string;
|
|
120
|
-
context?: Record<string, unknown>;
|
|
121
|
-
cause?: unknown;
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Type guard to check if an error is an UmbraError.
|
|
126
|
-
*
|
|
127
|
-
* @remarks
|
|
128
|
-
* Prefer this guard over `error instanceof UmbraError` in generic catch handlers because
|
|
129
|
-
* it is safe to call with any value (including `null`, primitives, and non-Error objects)
|
|
130
|
-
* and narrows the type to `UmbraError` for TypeScript's type system in the true branch.
|
|
131
|
-
*
|
|
132
|
-
* @param error - The value to test. Typically the caught value in a `catch (error)` block,
|
|
133
|
-
* typed as `unknown`.
|
|
134
|
-
* @returns `true` and narrows `error` to `UmbraError` when the value is an instance of
|
|
135
|
-
* `UmbraError` (or any sub-class such as `MathematicsAssertionError`). Returns `false`
|
|
136
|
-
* for all other values.
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* ```typescript
|
|
140
|
-
* try {
|
|
141
|
-
* await operation();
|
|
142
|
-
* } catch (error) {
|
|
143
|
-
* if (isUmbraError(error)) {
|
|
144
|
-
* // error is narrowed to UmbraError here
|
|
145
|
-
* console.log('SDK error code:', error.code);
|
|
146
|
-
* console.log('SDK error context:', error.context);
|
|
147
|
-
* }
|
|
148
|
-
* }
|
|
149
|
-
* ```
|
|
150
|
-
*
|
|
151
|
-
* @see {@link UmbraError}
|
|
152
|
-
* @public
|
|
153
|
-
*/
|
|
154
|
-
declare function isUmbraError(error: unknown): error is UmbraError;
|
|
155
|
-
/**
|
|
156
|
-
* Error thrown when a value fails a mathematical type assertion.
|
|
157
|
-
*
|
|
158
|
-
* This error provides detailed information about why an assertion failed,
|
|
159
|
-
* including the actual value, the expected type, and the constraint that
|
|
160
|
-
* was violated.
|
|
161
|
-
*
|
|
162
|
-
* @remarks
|
|
163
|
-
* All assertion functions in the mathematics module (e.g., `assertU8`, `assertU256`,
|
|
164
|
-
* `assertU32LeBytes`) throw this error type on failure. Catch it specifically to handle
|
|
165
|
-
* mathematical type validation failures differently from cryptographic or Solana errors.
|
|
166
|
-
*
|
|
167
|
-
* The three diagnostic properties together allow automated logging pipelines to produce
|
|
168
|
-
* structured records without parsing the `message` string:
|
|
169
|
-
* - `value` — the actual value that was supplied
|
|
170
|
-
* - `expectedType` — the branded type name (e.g., `"U8"`, `"U256LeBytes"`)
|
|
171
|
-
* - `constraint` — the violated range or length rule, or `undefined` for type mismatches
|
|
172
|
-
*
|
|
173
|
-
* Note that this class does NOT extend `UmbraError`. It extends `Error` directly to keep
|
|
174
|
-
* the assertion error classes lightweight and independent of the UmbraError hierarchy.
|
|
175
|
-
* Use `isUmbraError` only to detect top-level SDK operational errors; use
|
|
176
|
-
* `instanceof MathematicsAssertionError` for assertion failures.
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* ```typescript
|
|
180
|
-
* import { assertU8, MathematicsAssertionError } from "./mathematics";
|
|
181
|
-
*
|
|
182
|
-
* try {
|
|
183
|
-
* const value = assertU8(256n); // Will throw
|
|
184
|
-
* } catch (error) {
|
|
185
|
-
* if (error instanceof MathematicsAssertionError) {
|
|
186
|
-
* console.error(`Assertion failed for ${error.expectedType}`);
|
|
187
|
-
* console.error(`Value: ${error.value}`);
|
|
188
|
-
* console.error(`Constraint: ${error.constraint}`);
|
|
189
|
-
* // Output:
|
|
190
|
-
* // Assertion failed for U8
|
|
191
|
-
* // Value: 256
|
|
192
|
-
* // Constraint: 0 <= value <= 255
|
|
193
|
-
* }
|
|
194
|
-
* }
|
|
195
|
-
* ```
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
* ```typescript
|
|
199
|
-
* // Safe parse pattern — returns null instead of throwing
|
|
200
|
-
* function safeParseU8(value: bigint): U8 | null {
|
|
201
|
-
* try {
|
|
202
|
-
* return assertU8(value);
|
|
203
|
-
* } catch (error) {
|
|
204
|
-
* if (error instanceof MathematicsAssertionError) {
|
|
205
|
-
* console.warn(`Invalid U8 value: ${value}`);
|
|
206
|
-
* return null;
|
|
207
|
-
* }
|
|
208
|
-
* throw error; // Re-throw unexpected errors
|
|
209
|
-
* }
|
|
210
|
-
* }
|
|
211
|
-
* ```
|
|
212
|
-
*
|
|
213
|
-
* @sealed
|
|
214
|
-
* @public
|
|
215
|
-
*/
|
|
216
|
-
declare class MathematicsAssertionError extends Error {
|
|
217
|
-
/**
|
|
218
|
-
* The actual value that failed the assertion.
|
|
219
|
-
*
|
|
220
|
-
* @remarks
|
|
221
|
-
* The runtime type reflects what was actually passed to the assertion function:
|
|
222
|
-
* - `bigint` for integer assertions (`assertU8`, `assertU256`, etc.)
|
|
223
|
-
* - `Uint8Array` for byte-array assertions (`assertU256LeBytes`, `assertU32LeBytes`, etc.)
|
|
224
|
-
* - Any other type when a non-numeric value was passed unexpectedly
|
|
225
|
-
*
|
|
226
|
-
* @readonly
|
|
227
|
-
*/
|
|
228
|
-
readonly value: unknown;
|
|
229
|
-
/**
|
|
230
|
-
* The type that was expected.
|
|
231
|
-
*
|
|
232
|
-
* @remarks
|
|
233
|
-
* Contains the branded type name exactly as it appears in the SDK type system,
|
|
234
|
-
* e.g., `"U8"`, `"U256"`, `"U32LeBytes"`. Use this for structured logging or
|
|
235
|
-
* to build user-facing error messages without parsing the `message` string.
|
|
236
|
-
*
|
|
237
|
-
* @readonly
|
|
238
|
-
*/
|
|
239
|
-
readonly expectedType: string;
|
|
240
|
-
/**
|
|
241
|
-
* Description of the constraint that was violated.
|
|
242
|
-
*
|
|
243
|
-
* @remarks
|
|
244
|
-
* Is `undefined` when only a type check failed (e.g., a `string` was passed where a
|
|
245
|
-
* `bigint` was expected). Contains a human-readable inequality or length rule when a
|
|
246
|
-
* value of the correct type was out of the allowed range.
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* - `"0 <= value <= 255"` — U8 range violation
|
|
250
|
-
* - `"length === 32"` — U256LeBytes length violation
|
|
251
|
-
* - `"value >= 0"` — negative value passed to an unsigned integer assertion
|
|
252
|
-
*
|
|
253
|
-
* @readonly
|
|
254
|
-
*/
|
|
255
|
-
readonly constraint: string | undefined;
|
|
256
|
-
/**
|
|
257
|
-
* Creates a new MathematicsAssertionError.
|
|
258
|
-
*
|
|
259
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
260
|
-
* the assertion function, the expected type, and the constraint that was violated.
|
|
261
|
-
* @param options - Structured diagnostic details attached to the error.
|
|
262
|
-
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
263
|
-
* @param options.expectedType - The name of the branded type that was expected
|
|
264
|
-
* (e.g., `"U8"`, `"U256LeBytes"`).
|
|
265
|
-
* @param options.constraint - Optional human-readable constraint description
|
|
266
|
-
* (e.g., `"0 <= value <= 255"`). Omit when the failure is a type mismatch rather
|
|
267
|
-
* than a range violation.
|
|
268
|
-
*/
|
|
269
|
-
constructor(message: string, options: {
|
|
270
|
-
value: unknown;
|
|
271
|
-
expectedType: string;
|
|
272
|
-
constraint?: string;
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Error thrown when a value fails a cryptographic type assertion.
|
|
277
|
-
*
|
|
278
|
-
* This error provides detailed information about why an assertion failed,
|
|
279
|
-
* including the actual value, the expected type, and the constraint that
|
|
280
|
-
* was violated.
|
|
281
|
-
*
|
|
282
|
-
* @remarks
|
|
283
|
-
* Thrown by assertion functions in the cryptography module, such as
|
|
284
|
-
* `assertBn254FieldElement`, `assertAesKey`, `assertX25519PrivateKey`, and similar.
|
|
285
|
-
* Each function validates that a value conforms to a branded cryptographic type,
|
|
286
|
-
* throwing this error with a precise `expectedType` and `constraint` when it does not.
|
|
287
|
-
*
|
|
288
|
-
* Common reasons for failure:
|
|
289
|
-
* - A `bigint` field element exceeds the BN254 or Curve25519 field prime
|
|
290
|
-
* - A byte array has the wrong length (e.g., a 31-byte array passed as an AES-256 key)
|
|
291
|
-
* - A wrong JavaScript type was supplied (e.g., a `number` instead of a `bigint`)
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* ```typescript
|
|
295
|
-
* import { assertBn254FieldElement, CryptographyAssertionError } from "./cryptography";
|
|
296
|
-
*
|
|
297
|
-
* try {
|
|
298
|
-
* assertBn254FieldElement(invalidValue); // Will throw
|
|
299
|
-
* } catch (error) {
|
|
300
|
-
* if (error instanceof CryptographyAssertionError) {
|
|
301
|
-
* console.error(`Assertion failed for ${error.expectedType}`);
|
|
302
|
-
* console.error(`Value: ${error.value}`);
|
|
303
|
-
* console.error(`Constraint: ${error.constraint}`);
|
|
304
|
-
* }
|
|
305
|
-
* }
|
|
306
|
-
* ```
|
|
307
|
-
*
|
|
308
|
-
* @example
|
|
309
|
-
* ```typescript
|
|
310
|
-
* // Distinguish cryptographic assertion failures from mathematical ones
|
|
311
|
-
* try {
|
|
312
|
-
* const key = assertAesKey(rawBytes);
|
|
313
|
-
* } catch (error) {
|
|
314
|
-
* if (error instanceof CryptographyAssertionError) {
|
|
315
|
-
* console.warn("Crypto assertion failed:", error.expectedType, error.constraint);
|
|
316
|
-
* } else if (error instanceof MathematicsAssertionError) {
|
|
317
|
-
* console.warn("Math assertion failed:", error.expectedType, error.constraint);
|
|
318
|
-
* }
|
|
319
|
-
* }
|
|
320
|
-
* ```
|
|
321
|
-
*
|
|
322
|
-
* @see {@link MathematicsAssertionError}
|
|
323
|
-
* @see {@link SolanaAssertionError}
|
|
324
|
-
* @see {@link TemporalAssertionError}
|
|
325
|
-
* @sealed
|
|
326
|
-
* @public
|
|
327
|
-
*/
|
|
328
|
-
declare class CryptographyAssertionError extends Error {
|
|
329
|
-
/**
|
|
330
|
-
* The actual value that failed the assertion.
|
|
331
|
-
*
|
|
332
|
-
* @remarks
|
|
333
|
-
* The runtime type reflects what was actually passed to the assertion function:
|
|
334
|
-
* - `bigint` for field element assertions (`assertBn254FieldElement`, etc.)
|
|
335
|
-
* - `Uint8Array` for byte-array assertions (`assertAesKey`, `assertX25519PrivateKey`, etc.)
|
|
336
|
-
* - Any other type when an entirely wrong value type was supplied
|
|
337
|
-
*
|
|
338
|
-
* @readonly
|
|
339
|
-
*/
|
|
340
|
-
readonly value: unknown;
|
|
341
|
-
/**
|
|
342
|
-
* The type that was expected (e.g., `"Bn254FieldElement"`, `"PoseidonKey"`, `"AesKey"`).
|
|
343
|
-
*
|
|
344
|
-
* @remarks
|
|
345
|
-
* Contains the branded type name exactly as it appears in the SDK type system.
|
|
346
|
-
* Use this property for structured logging without parsing the `message` string.
|
|
347
|
-
*
|
|
348
|
-
* @readonly
|
|
349
|
-
*/
|
|
350
|
-
readonly expectedType: string;
|
|
351
|
-
/**
|
|
352
|
-
* Description of the constraint that was violated.
|
|
353
|
-
*
|
|
354
|
-
* @remarks
|
|
355
|
-
* Is `undefined` for pure type-mismatch failures (e.g., `string` instead of `bigint`).
|
|
356
|
-
* Contains a human-readable constraint description for range and length violations
|
|
357
|
-
* (e.g., `"value < BN254_FIELD_PRIME"`, `"length === 32"`).
|
|
358
|
-
*
|
|
359
|
-
* @readonly
|
|
360
|
-
*/
|
|
361
|
-
readonly constraint: string | undefined;
|
|
362
|
-
/**
|
|
363
|
-
* Creates a new CryptographyAssertionError.
|
|
364
|
-
*
|
|
365
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
366
|
-
* the assertion function, the expected type, and the constraint that was violated.
|
|
367
|
-
* @param options - Structured diagnostic details attached to the error.
|
|
368
|
-
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
369
|
-
* @param options.expectedType - The name of the branded cryptographic type that was
|
|
370
|
-
* expected (e.g., `"Bn254FieldElement"`, `"AesKey"`).
|
|
371
|
-
* @param options.constraint - Optional human-readable constraint description.
|
|
372
|
-
* Omit when the failure is a type mismatch rather than a range or length violation.
|
|
373
|
-
*/
|
|
374
|
-
constructor(message: string, options: {
|
|
375
|
-
value: unknown;
|
|
376
|
-
expectedType: string;
|
|
377
|
-
constraint?: string;
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Error thrown when a Solana type assertion fails.
|
|
382
|
-
*
|
|
383
|
-
* This error provides detailed information about why the assertion failed,
|
|
384
|
-
* including the actual value, expected type, and constraint that was violated.
|
|
385
|
-
*
|
|
386
|
-
* @remarks
|
|
387
|
-
* Thrown by assertion functions for Solana-specific branded types, such as
|
|
388
|
-
* `assertTransactionSignature`, `assertSignatureBytes`, and similar validators.
|
|
389
|
-
* These assertions verify that string or byte-array values conform to Solana's
|
|
390
|
-
* encoding and length conventions (e.g., Base58-encoded 64-byte Ed25519 signatures).
|
|
391
|
-
*
|
|
392
|
-
* Common reasons for failure:
|
|
393
|
-
* - A string that fails Base58 decoding or has the wrong decoded length
|
|
394
|
-
* - A `Uint8Array` with the wrong byte length for a signature or public key
|
|
395
|
-
* - A wrong JavaScript type (e.g., `number` instead of `string`)
|
|
396
|
-
*
|
|
397
|
-
* @example
|
|
398
|
-
* ```typescript
|
|
399
|
-
* import { assertTransactionSignature, SolanaAssertionError } from "./solana";
|
|
400
|
-
*
|
|
401
|
-
* try {
|
|
402
|
-
* assertTransactionSignature("invalid!signature"); // Will throw
|
|
403
|
-
* } catch (error) {
|
|
404
|
-
* if (error instanceof SolanaAssertionError) {
|
|
405
|
-
* console.error(`Assertion failed for ${error.expectedType}`);
|
|
406
|
-
* console.error(`Value: ${error.value}`);
|
|
407
|
-
* console.error(`Constraint: ${error.constraint}`);
|
|
408
|
-
* }
|
|
409
|
-
* }
|
|
410
|
-
* ```
|
|
411
|
-
*
|
|
412
|
-
* @example
|
|
413
|
-
* ```typescript
|
|
414
|
-
* // Safe parse pattern — returns null on failure
|
|
415
|
-
* function tryParseSignature(raw: unknown): TransactionSignature | null {
|
|
416
|
-
* try {
|
|
417
|
-
* return assertTransactionSignature(raw);
|
|
418
|
-
* } catch (error) {
|
|
419
|
-
* if (error instanceof SolanaAssertionError) return null;
|
|
420
|
-
* throw error;
|
|
421
|
-
* }
|
|
422
|
-
* }
|
|
423
|
-
* ```
|
|
424
|
-
*
|
|
425
|
-
* @see {@link MathematicsAssertionError}
|
|
426
|
-
* @see {@link CryptographyAssertionError}
|
|
427
|
-
* @see {@link TemporalAssertionError}
|
|
428
|
-
* @sealed
|
|
429
|
-
* @public
|
|
430
|
-
*/
|
|
431
|
-
declare class SolanaAssertionError extends Error {
|
|
432
|
-
/**
|
|
433
|
-
* The actual value that failed the assertion.
|
|
434
|
-
*
|
|
435
|
-
* @remarks
|
|
436
|
-
* The runtime type reflects what was actually passed to the assertion function:
|
|
437
|
-
* - `string` for Base58-encoded assertions (`assertTransactionSignature`, etc.)
|
|
438
|
-
* - `Uint8Array` for byte-array assertions (`assertSignatureBytes`, etc.)
|
|
439
|
-
* - Any other type when a completely wrong value type was supplied
|
|
440
|
-
*
|
|
441
|
-
* @readonly
|
|
442
|
-
*/
|
|
443
|
-
readonly value: unknown;
|
|
444
|
-
/**
|
|
445
|
-
* The type that was expected (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
|
|
446
|
-
*
|
|
447
|
-
* @remarks
|
|
448
|
-
* Contains the branded type name exactly as it appears in the SDK type system.
|
|
449
|
-
* Use this for structured logging without parsing the `message` string.
|
|
450
|
-
*
|
|
451
|
-
* @readonly
|
|
452
|
-
*/
|
|
453
|
-
readonly expectedType: string;
|
|
454
|
-
/**
|
|
455
|
-
* Description of the constraint that was violated.
|
|
456
|
-
*
|
|
457
|
-
* @remarks
|
|
458
|
-
* Is `undefined` for pure type-mismatch failures. Contains a human-readable rule
|
|
459
|
-
* for encoding or length violations (e.g., `"valid Base58"`, `"length === 64"`).
|
|
460
|
-
*
|
|
461
|
-
* @readonly
|
|
462
|
-
*/
|
|
463
|
-
readonly constraint: string | undefined;
|
|
464
|
-
/**
|
|
465
|
-
* Creates a new SolanaAssertionError.
|
|
466
|
-
*
|
|
467
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
468
|
-
* the assertion function, the expected type, and the constraint that was violated.
|
|
469
|
-
* @param options - Structured diagnostic details attached to the error.
|
|
470
|
-
* @param options.value - The actual value that was supplied and failed the assertion.
|
|
471
|
-
* @param options.expectedType - The name of the branded Solana type that was expected
|
|
472
|
-
* (e.g., `"TransactionSignature"`, `"SignatureBytes"`).
|
|
473
|
-
* @param options.constraint - Optional human-readable constraint description.
|
|
474
|
-
* Omit when the failure is a type mismatch rather than an encoding or length violation.
|
|
475
|
-
*/
|
|
476
|
-
constructor(message: string, options: {
|
|
477
|
-
value: unknown;
|
|
478
|
-
expectedType: string;
|
|
479
|
-
constraint?: string;
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Error thrown when a temporal type assertion fails.
|
|
484
|
-
*
|
|
485
|
-
* This error provides detailed information about why an assertion failed,
|
|
486
|
-
* including the actual value, the expected type, and the constraint that
|
|
487
|
-
* was violated.
|
|
488
|
-
*
|
|
489
|
-
* @remarks
|
|
490
|
-
* Thrown by assertion functions for branded temporal types: `assertYear`, `assertMonth`,
|
|
491
|
-
* `assertDay`, `assertHour`, `assertMinute`, and `assertSecond`. These functions validate
|
|
492
|
-
* that a `bigint` value falls within the calendar range appropriate for each component
|
|
493
|
-
* (e.g., months must be in `[1, 12]`, hours in `[0, 23]`).
|
|
494
|
-
*
|
|
495
|
-
* Temporal assertions are used to validate the output of UTC timestamp extraction before
|
|
496
|
-
* the components are used in time-scoped viewing key derivation. In normal operation they
|
|
497
|
-
* should never throw (JavaScript's `Date` always produces in-range values), but callers
|
|
498
|
-
* that construct components manually can encounter these errors.
|
|
499
|
-
*
|
|
500
|
-
* @example
|
|
501
|
-
* ```typescript
|
|
502
|
-
* import { assertMonth, TemporalAssertionError } from "./temporal";
|
|
503
|
-
*
|
|
504
|
-
* try {
|
|
505
|
-
* assertMonth(13n); // Will throw — month must be 1–12
|
|
506
|
-
* } catch (error) {
|
|
507
|
-
* if (error instanceof TemporalAssertionError) {
|
|
508
|
-
* console.error(`Assertion failed for ${error.expectedType}`);
|
|
509
|
-
* console.error(`Value: ${error.value}`);
|
|
510
|
-
* console.error(`Constraint: ${error.constraint}`);
|
|
511
|
-
* // Output:
|
|
512
|
-
* // Assertion failed for Month
|
|
513
|
-
* // Value: 13
|
|
514
|
-
* // Constraint: 1 <= value <= 12
|
|
515
|
-
* }
|
|
516
|
-
* }
|
|
517
|
-
* ```
|
|
518
|
-
*
|
|
519
|
-
* @example
|
|
520
|
-
* ```typescript
|
|
521
|
-
* // Safe parse of a user-supplied year value
|
|
522
|
-
* function tryParseYear(raw: bigint): Year | null {
|
|
523
|
-
* try {
|
|
524
|
-
* return assertYear(raw);
|
|
525
|
-
* } catch (error) {
|
|
526
|
-
* if (error instanceof TemporalAssertionError) return null;
|
|
527
|
-
* throw error;
|
|
528
|
-
* }
|
|
529
|
-
* }
|
|
530
|
-
* ```
|
|
531
|
-
*
|
|
532
|
-
* @see {@link MathematicsAssertionError}
|
|
533
|
-
* @see {@link CryptographyAssertionError}
|
|
534
|
-
* @see {@link SolanaAssertionError}
|
|
535
|
-
* @sealed
|
|
536
|
-
* @public
|
|
537
|
-
*/
|
|
538
|
-
declare class TemporalAssertionError extends Error {
|
|
539
|
-
/**
|
|
540
|
-
* The actual value that failed the assertion.
|
|
541
|
-
*
|
|
542
|
-
* @remarks
|
|
543
|
-
* Will be a `bigint` for all temporal assertions since the temporal types are
|
|
544
|
-
* BigInt-backed branded types (e.g., `Year`, `Month`, `Day`). May also be any
|
|
545
|
-
* other type when a non-bigint value was supplied unexpectedly.
|
|
546
|
-
*
|
|
547
|
-
* @readonly
|
|
548
|
-
*/
|
|
549
|
-
readonly value: unknown;
|
|
550
|
-
/**
|
|
551
|
-
* The type that was expected (e.g., `"Year"`, `"Month"`, `"Hour"`).
|
|
552
|
-
*
|
|
553
|
-
* @remarks
|
|
554
|
-
* Contains the branded temporal type name exactly as it appears in the SDK type system.
|
|
555
|
-
* Use this for structured logging without parsing the `message` string.
|
|
556
|
-
*
|
|
557
|
-
* @readonly
|
|
558
|
-
*/
|
|
559
|
-
readonly expectedType: string;
|
|
560
|
-
/**
|
|
561
|
-
* Description of the constraint that was violated.
|
|
562
|
-
*
|
|
563
|
-
* @remarks
|
|
564
|
-
* Contains a human-readable range rule for out-of-range values
|
|
565
|
-
* (e.g., `"1 <= value <= 12"` for a month violation). Is `undefined` only for
|
|
566
|
-
* pure type-mismatch failures (e.g., a `string` passed where a `bigint` was expected),
|
|
567
|
-
* which should not occur in normal usage.
|
|
568
|
-
*
|
|
569
|
-
* @readonly
|
|
570
|
-
*/
|
|
571
|
-
readonly constraint: string | undefined;
|
|
572
|
-
/**
|
|
573
|
-
* Creates a new TemporalAssertionError.
|
|
574
|
-
*
|
|
575
|
-
* @param message - Human-readable description of the assertion failure. Should name
|
|
576
|
-
* the assertion function, the expected type, and the violated range constraint.
|
|
577
|
-
* @param details - Structured diagnostic details attached to the error.
|
|
578
|
-
* @param details.value - The actual `bigint` value (or other type) that was supplied
|
|
579
|
-
* and failed the temporal assertion.
|
|
580
|
-
* @param details.expectedType - The name of the branded temporal type that was expected
|
|
581
|
-
* (e.g., `"Year"`, `"Month"`, `"Hour"`).
|
|
582
|
-
* @param details.constraint - Optional human-readable range description
|
|
583
|
-
* (e.g., `"1 <= value <= 12"`). Omit when the failure is a type mismatch.
|
|
584
|
-
*/
|
|
585
|
-
constructor(message: string, details: {
|
|
586
|
-
value: unknown;
|
|
587
|
-
expectedType: string;
|
|
588
|
-
constraint?: string;
|
|
589
|
-
});
|
|
590
|
-
}
|
|
1
|
+
export { C as ClaimUtxoError, a as ClaimUtxoStage, b as ComputationMonitorError, c as ComputationMonitorStage, d as ConversionError, e as ConversionStage, f as CreateUtxoError, g as CreateUtxoStage, E as EncryptedDepositError, h as EncryptedDepositStage, i as EncryptedWithdrawalError, j as EncryptedWithdrawalStage, F as FetchUtxosError, k as FetchUtxosStage, Q as QueryError, l as QueryStage, R as RegistrationError, m as RegistrationStage, n as isClaimUtxoError, o as isComputationMonitorError, p as isConversionError, q as isCreateUtxoError, r as isEncryptedDepositError, s as isEncryptedWithdrawalError, t as isFetchUtxosError, u as isQueryError, v as isRegistrationError } from '../errors-DAIrstEL.cjs';
|
|
2
|
+
import { U as UmbraError } from '../errors-B9EoPeWV.cjs';
|
|
3
|
+
export { C as CryptographyAssertionError, M as MathematicsAssertionError, S as SolanaAssertionError, T as TemporalAssertionError, i as isUmbraError } from '../errors-B9EoPeWV.cjs';
|
|
591
4
|
|
|
592
5
|
/**
|
|
593
6
|
* Cryptography Error Classes
|
|
@@ -674,7 +87,7 @@ declare function isCryptographyError(error: unknown): error is CryptographyError
|
|
|
674
87
|
* user rejection from a hardware wallet communication failure.
|
|
675
88
|
*
|
|
676
89
|
* - `MasterSeedSigningRejectedError` — the user declined the master seed
|
|
677
|
-
* derivation message; prompt the user and retry with `
|
|
90
|
+
* derivation message; prompt the user and retry with `getUmbraClient`.
|
|
678
91
|
*
|
|
679
92
|
* @packageDocumentation
|
|
680
93
|
*/
|
|
@@ -1069,7 +482,7 @@ declare class TransactionSigningError extends TransactionError {
|
|
|
1069
482
|
*
|
|
1070
483
|
* **Recovery** — Prompt the user to explain that the Umbra seed derivation
|
|
1071
484
|
* signature is used only to derive encryption keys locally and is never
|
|
1072
|
-
* broadcast to the network. Then call `
|
|
485
|
+
* broadcast to the network. Then call `getUmbraClient` again.
|
|
1073
486
|
*
|
|
1074
487
|
* **Default error code** — `"MASTER_SEED_SIGNING_REJECTED"`.
|
|
1075
488
|
*
|
|
@@ -1082,7 +495,7 @@ declare class TransactionSigningError extends TransactionError {
|
|
|
1082
495
|
* } from "@umbra-privacy/sdk";
|
|
1083
496
|
*
|
|
1084
497
|
* try {
|
|
1085
|
-
* const client = await
|
|
498
|
+
* const client = await getUmbraClient({ signer });
|
|
1086
499
|
* } catch (error) {
|
|
1087
500
|
* if (error instanceof MasterSeedSigningRejectedError) {
|
|
1088
501
|
* showModal(
|
|
@@ -1209,207 +622,4 @@ declare function isTransactionError(error: unknown): error is TransactionError;
|
|
|
1209
622
|
*/
|
|
1210
623
|
declare function isTransactionSigningError(error: unknown): error is TransactionSigningError;
|
|
1211
624
|
|
|
1212
|
-
|
|
1213
|
-
* Umbra Error Classes
|
|
1214
|
-
*
|
|
1215
|
-
* This module provides error classes for all Umbra SDK operation failures,
|
|
1216
|
-
* each carrying a `stage` field that identifies exactly where in the pipeline
|
|
1217
|
-
* the failure occurred.
|
|
1218
|
-
*
|
|
1219
|
-
* @module umbra/errors
|
|
1220
|
-
*/
|
|
1221
|
-
|
|
1222
|
-
/**
|
|
1223
|
-
* Stage of the encrypted deposit operation where an error occurred.
|
|
1224
|
-
*
|
|
1225
|
-
* Each stage represents a distinct phase in the deposit flow:
|
|
1226
|
-
*
|
|
1227
|
-
* | Stage | Description |
|
|
1228
|
-
* |-------|-------------|
|
|
1229
|
-
* | `initialization` | Factory-level validation failed |
|
|
1230
|
-
* | `validation` | Input parameter validation failed |
|
|
1231
|
-
* | `mint-fetch` | Failed to fetch mint account data |
|
|
1232
|
-
* | `fee-calculation` | Failed to calculate transfer fee |
|
|
1233
|
-
* | `pda-derivation` | PDA address generation failed |
|
|
1234
|
-
* | `account-fetch` | Failed to fetch account data from RPC |
|
|
1235
|
-
* | `instruction-build` | Failed to build the deposit instruction |
|
|
1236
|
-
* | `transaction-build` | Failed to build transaction message |
|
|
1237
|
-
* | `transaction-compile` | Failed to compile the transaction |
|
|
1238
|
-
* | `transaction-sign` | Failed to sign the transaction |
|
|
1239
|
-
* | `transaction-validate` | Transaction validation failed |
|
|
1240
|
-
* | `transaction-send` | Failed to send or confirm the transaction |
|
|
1241
|
-
*/
|
|
1242
|
-
type EncryptedDepositStage = "initialization" | "validation" | "mint-fetch" | "fee-calculation" | "pda-derivation" | "account-fetch" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
|
|
1243
|
-
/** Error thrown when an encrypted deposit operation fails. */
|
|
1244
|
-
declare class EncryptedDepositError extends UmbraError {
|
|
1245
|
-
readonly stage: EncryptedDepositStage;
|
|
1246
|
-
constructor(stage: EncryptedDepositStage, message: string, cause?: Error);
|
|
1247
|
-
}
|
|
1248
|
-
/** Type guard to check if an error is an EncryptedDepositError. */
|
|
1249
|
-
declare function isEncryptedDepositError(error: unknown): error is EncryptedDepositError;
|
|
1250
|
-
/**
|
|
1251
|
-
* Stage of the encrypted withdrawal operation where an error occurred.
|
|
1252
|
-
*
|
|
1253
|
-
* | Stage | Description |
|
|
1254
|
-
* |-------|-------------|
|
|
1255
|
-
* | `initialization` | Factory-level validation failed |
|
|
1256
|
-
* | `validation` | Input parameter validation failed |
|
|
1257
|
-
* | `mint-fetch` | Failed to fetch mint account data |
|
|
1258
|
-
* | `pda-derivation` | PDA address generation failed |
|
|
1259
|
-
* | `instruction-build` | Failed to build the withdrawal instruction |
|
|
1260
|
-
* | `transaction-build` | Failed to build transaction message |
|
|
1261
|
-
* | `transaction-compile` | Failed to compile the transaction |
|
|
1262
|
-
* | `transaction-sign` | Failed to sign the transaction |
|
|
1263
|
-
* | `transaction-send` | Failed to send or confirm the transaction |
|
|
1264
|
-
*/
|
|
1265
|
-
type EncryptedWithdrawalStage = "initialization" | "validation" | "mint-fetch" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-send";
|
|
1266
|
-
/** Error thrown when an encrypted withdrawal operation fails. */
|
|
1267
|
-
declare class EncryptedWithdrawalError extends UmbraError {
|
|
1268
|
-
readonly stage: EncryptedWithdrawalStage;
|
|
1269
|
-
constructor(stage: EncryptedWithdrawalStage, message: string, cause?: Error);
|
|
1270
|
-
}
|
|
1271
|
-
/** Type guard to check if an error is an EncryptedWithdrawalError. */
|
|
1272
|
-
declare function isEncryptedWithdrawalError(error: unknown): error is EncryptedWithdrawalError;
|
|
1273
|
-
/**
|
|
1274
|
-
* Stage of the user registration operation where an error occurred.
|
|
1275
|
-
*
|
|
1276
|
-
* | Stage | Description |
|
|
1277
|
-
* |-------|-------------|
|
|
1278
|
-
* | `initialization` | Factory-level validation failed |
|
|
1279
|
-
* | `master-seed-derivation` | Master seed signing was rejected or failed |
|
|
1280
|
-
* | `account-fetch` | RPC call to read existing registration state failed |
|
|
1281
|
-
* | `key-derivation` | Cryptographic key derivation from master seed failed |
|
|
1282
|
-
* | `zk-proof-generation` | Groth16 proof generation failed (anonymous step) |
|
|
1283
|
-
* | `pda-derivation` | PDA address generation failed |
|
|
1284
|
-
* | `instruction-build` | Failed to build an instruction |
|
|
1285
|
-
* | `transaction-build` | Blockhash fetch or transaction assembly failed |
|
|
1286
|
-
* | `transaction-compile` | Failed to compile the transaction |
|
|
1287
|
-
* | `transaction-sign` | Wallet rejected signing |
|
|
1288
|
-
* | `transaction-validate` | Pre-flight simulation failed |
|
|
1289
|
-
* | `transaction-send` | Transaction sent but confirmation timed out |
|
|
1290
|
-
*/
|
|
1291
|
-
type RegistrationStage = "initialization" | "master-seed-derivation" | "account-fetch" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
|
|
1292
|
-
/** Error thrown when a user registration operation fails. */
|
|
1293
|
-
declare class RegistrationError extends UmbraError {
|
|
1294
|
-
readonly stage: RegistrationStage;
|
|
1295
|
-
constructor(stage: RegistrationStage, message: string, cause?: unknown);
|
|
1296
|
-
}
|
|
1297
|
-
/** Type guard to check if an error is a RegistrationError. */
|
|
1298
|
-
declare function isRegistrationError(error: unknown): error is RegistrationError;
|
|
1299
|
-
/**
|
|
1300
|
-
* Stage of the MXE-to-Shared conversion operation where an error occurred.
|
|
1301
|
-
*
|
|
1302
|
-
* | Stage | Description |
|
|
1303
|
-
* |-------|-------------|
|
|
1304
|
-
* | `initialization` | Factory-level validation failed |
|
|
1305
|
-
* | `account-fetch` | Batch RPC fetch of token account PDAs failed |
|
|
1306
|
-
* | `pda-derivation` | PDA address generation failed |
|
|
1307
|
-
* | `instruction-build` | Failed to build a conversion instruction |
|
|
1308
|
-
* | `transaction-build` | Blockhash fetch or transaction assembly failed |
|
|
1309
|
-
* | `transaction-compile` | Failed to compile the transaction |
|
|
1310
|
-
* | `transaction-sign` | Wallet rejected signing for a per-mint transaction |
|
|
1311
|
-
* | `transaction-validate` | Pre-flight simulation failed |
|
|
1312
|
-
* | `transaction-send` | Transaction sent but confirmation timed out |
|
|
1313
|
-
*/
|
|
1314
|
-
type ConversionStage = "initialization" | "account-fetch" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
|
|
1315
|
-
/** Error thrown when an MXE-to-Shared conversion operation fails. */
|
|
1316
|
-
declare class ConversionError extends UmbraError {
|
|
1317
|
-
readonly stage: ConversionStage;
|
|
1318
|
-
constructor(stage: ConversionStage, message: string, cause?: unknown);
|
|
1319
|
-
}
|
|
1320
|
-
/** Type guard to check if an error is a ConversionError. */
|
|
1321
|
-
declare function isConversionError(error: unknown): error is ConversionError;
|
|
1322
|
-
/**
|
|
1323
|
-
* Stage of a UTXO creation operation where an error occurred.
|
|
1324
|
-
*
|
|
1325
|
-
* | Stage | Description |
|
|
1326
|
-
* |-------|-------------|
|
|
1327
|
-
* | `initialization` | Factory-level validation failed |
|
|
1328
|
-
* | `validation` | Input parameter validation failed |
|
|
1329
|
-
* | `account-fetch` | Failed to fetch recipient or token account data |
|
|
1330
|
-
* | `mint-fetch` | Failed to fetch mint account data |
|
|
1331
|
-
* | `fee-calculation` | Token-2022 transfer fee calculation failed |
|
|
1332
|
-
* | `key-derivation` | Key derivation from master seed failed |
|
|
1333
|
-
* | `zk-proof-generation` | Groth16 proof generation failed |
|
|
1334
|
-
* | `pda-derivation` | PDA address generation failed |
|
|
1335
|
-
* | `instruction-build` | Failed to build an instruction |
|
|
1336
|
-
* | `transaction-build` | Blockhash fetch or transaction assembly failed |
|
|
1337
|
-
* | `transaction-compile` | Failed to compile the transaction |
|
|
1338
|
-
* | `transaction-sign` | Wallet rejected signing |
|
|
1339
|
-
* | `transaction-validate` | Pre-flight simulation failed |
|
|
1340
|
-
* | `transaction-send` | Transaction sent but confirmation timed out |
|
|
1341
|
-
*/
|
|
1342
|
-
type CreateUtxoStage = "initialization" | "validation" | "account-fetch" | "mint-fetch" | "fee-calculation" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
|
|
1343
|
-
/** Error thrown when a UTXO creation operation fails. */
|
|
1344
|
-
declare class CreateUtxoError extends UmbraError {
|
|
1345
|
-
readonly stage: CreateUtxoStage;
|
|
1346
|
-
constructor(stage: CreateUtxoStage, message: string, cause?: unknown);
|
|
1347
|
-
}
|
|
1348
|
-
/** Type guard to check if an error is a CreateUtxoError. */
|
|
1349
|
-
declare function isCreateUtxoError(error: unknown): error is CreateUtxoError;
|
|
1350
|
-
/**
|
|
1351
|
-
* Stage of a UTXO fetch operation where an error occurred.
|
|
1352
|
-
*
|
|
1353
|
-
* | Stage | Description |
|
|
1354
|
-
* |-------|-------------|
|
|
1355
|
-
* | `initialization` | Factory construction failed — missing indexerApiEndpoint |
|
|
1356
|
-
* | `validation` | Invalid tree index or insertion index parameters |
|
|
1357
|
-
* | `key-derivation` | X25519 private key derivation from master seed failed |
|
|
1358
|
-
* | `indexer-fetch` | Indexer HTTP call failed |
|
|
1359
|
-
* | `proof-fetch` | Merkle proof HTTP call failed |
|
|
1360
|
-
*/
|
|
1361
|
-
type FetchUtxosStage = "initialization" | "validation" | "key-derivation" | "indexer-fetch" | "proof-fetch";
|
|
1362
|
-
/** Error thrown when a UTXO fetch operation fails. */
|
|
1363
|
-
declare class FetchUtxosError extends UmbraError {
|
|
1364
|
-
readonly stage: FetchUtxosStage;
|
|
1365
|
-
constructor(stage: FetchUtxosStage, message: string, cause?: unknown);
|
|
1366
|
-
}
|
|
1367
|
-
/** Type guard to check if an error is a FetchUtxosError. */
|
|
1368
|
-
declare function isFetchUtxosError(error: unknown): error is FetchUtxosError;
|
|
1369
|
-
/**
|
|
1370
|
-
* Stage of a UTXO claim operation where an error occurred.
|
|
1371
|
-
*
|
|
1372
|
-
* | Stage | Description |
|
|
1373
|
-
* |-------|-------------|
|
|
1374
|
-
* | `initialization` | Factory-level validation failed |
|
|
1375
|
-
* | `validation` | Invalid UTXO data or Merkle proof parameters |
|
|
1376
|
-
* | `key-derivation` | Key derivation from master seed failed |
|
|
1377
|
-
* | `zk-proof-generation` | Groth16 proof generation failed |
|
|
1378
|
-
* | `pda-derivation` | PDA address generation failed |
|
|
1379
|
-
* | `instruction-build` | Failed to build an instruction |
|
|
1380
|
-
* | `transaction-build` | Blockhash fetch or transaction assembly failed |
|
|
1381
|
-
* | `transaction-compile` | Failed to compile the transaction |
|
|
1382
|
-
* | `transaction-sign` | Wallet rejected signing |
|
|
1383
|
-
* | `transaction-validate` | Pre-flight simulation failed — also surfaces stale Merkle proof |
|
|
1384
|
-
* | `transaction-send` | Transaction sent but confirmation timed out |
|
|
1385
|
-
*/
|
|
1386
|
-
type ClaimUtxoStage = "initialization" | "validation" | "key-derivation" | "zk-proof-generation" | "pda-derivation" | "instruction-build" | "transaction-build" | "transaction-compile" | "transaction-sign" | "transaction-validate" | "transaction-send";
|
|
1387
|
-
/** Error thrown when a UTXO claim operation fails. */
|
|
1388
|
-
declare class ClaimUtxoError extends UmbraError {
|
|
1389
|
-
readonly stage: ClaimUtxoStage;
|
|
1390
|
-
constructor(stage: ClaimUtxoStage, message: string, cause?: unknown);
|
|
1391
|
-
}
|
|
1392
|
-
/** Type guard to check if an error is a ClaimUtxoError. */
|
|
1393
|
-
declare function isClaimUtxoError(error: unknown): error is ClaimUtxoError;
|
|
1394
|
-
/**
|
|
1395
|
-
* Stage of a query operation where an error occurred.
|
|
1396
|
-
*
|
|
1397
|
-
* | Stage | Description |
|
|
1398
|
-
* |-------|-------------|
|
|
1399
|
-
* | `initialization` | Factory-level validation failed |
|
|
1400
|
-
* | `pda-derivation` | PDA address generation failed |
|
|
1401
|
-
* | `account-fetch` | RPC fetch failed |
|
|
1402
|
-
* | `account-decode` | On-chain account data could not be decoded |
|
|
1403
|
-
* | `key-derivation` | X25519 key derivation failed (encrypted balance query) |
|
|
1404
|
-
* | `decryption` | Rescue cipher decryption failed (encrypted balance query) |
|
|
1405
|
-
*/
|
|
1406
|
-
type QueryStage = "initialization" | "pda-derivation" | "account-fetch" | "account-decode" | "key-derivation" | "decryption";
|
|
1407
|
-
/** Error thrown when a query operation fails. */
|
|
1408
|
-
declare class QueryError extends UmbraError {
|
|
1409
|
-
readonly stage: QueryStage;
|
|
1410
|
-
constructor(stage: QueryStage, message: string, cause?: unknown);
|
|
1411
|
-
}
|
|
1412
|
-
/** Type guard to check if an error is a QueryError. */
|
|
1413
|
-
declare function isQueryError(error: unknown): error is QueryError;
|
|
1414
|
-
|
|
1415
|
-
export { ClaimUtxoError, type ClaimUtxoStage, ConversionError, type ConversionStage, CreateUtxoError, type CreateUtxoStage, CryptographyAssertionError, CryptographyError, EncryptedDepositError, type EncryptedDepositStage, EncryptedWithdrawalError, type EncryptedWithdrawalStage, FetchUtxosError, type FetchUtxosStage, InstructionError, MasterSeedSigningRejectedError, MathematicsAssertionError, QueryError, type QueryStage, RegistrationError, type RegistrationStage, RpcError, SolanaAssertionError, TemporalAssertionError, TransactionError, TransactionSigningError, UmbraError, isClaimUtxoError, isConversionError, isCreateUtxoError, isCryptographyError, isEncryptedDepositError, isEncryptedWithdrawalError, isFetchUtxosError, isInstructionError, isQueryError, isRegistrationError, isRpcError, isTransactionError, isTransactionSigningError, isUmbraError };
|
|
625
|
+
export { CryptographyError, InstructionError, MasterSeedSigningRejectedError, RpcError, TransactionError, TransactionSigningError, UmbraError, isCryptographyError, isInstructionError, isRpcError, isTransactionError, isTransactionSigningError };
|