@txnod/sdk 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/AGENTS.md +29 -0
  2. package/CHANGELOG.md +22 -0
  3. package/LICENSE +21 -0
  4. package/README.md +434 -0
  5. package/dist/_shared/index.d.ts +68 -0
  6. package/dist/client-sandbox.d.ts +396 -0
  7. package/dist/client-sandbox.d.ts.map +1 -0
  8. package/dist/client-sandbox.js +448 -0
  9. package/dist/client-sandbox.js.map +1 -0
  10. package/dist/client.d.ts +429 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +588 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/env.d.ts +29 -0
  15. package/dist/env.d.ts.map +1 -0
  16. package/dist/env.js +44 -0
  17. package/dist/env.js.map +1 -0
  18. package/dist/errors.d.ts +1887 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +2107 -0
  21. package/dist/errors.js.map +1 -0
  22. package/dist/index.d.ts +35 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +32 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/internals/error-ctor-map.d.ts +11 -0
  27. package/dist/internals/error-ctor-map.d.ts.map +1 -0
  28. package/dist/internals/error-ctor-map.js +75 -0
  29. package/dist/internals/error-ctor-map.js.map +1 -0
  30. package/dist/internals/fetch-with-retry.d.ts +34 -0
  31. package/dist/internals/fetch-with-retry.d.ts.map +1 -0
  32. package/dist/internals/fetch-with-retry.js +233 -0
  33. package/dist/internals/fetch-with-retry.js.map +1 -0
  34. package/dist/internals/hmac.d.ts +2 -0
  35. package/dist/internals/hmac.d.ts.map +1 -0
  36. package/dist/internals/hmac.js +10 -0
  37. package/dist/internals/hmac.js.map +1 -0
  38. package/dist/internals/logger.d.ts +9 -0
  39. package/dist/internals/logger.d.ts.map +1 -0
  40. package/dist/internals/logger.js +16 -0
  41. package/dist/internals/logger.js.map +1 -0
  42. package/dist/internals/parse-problem-details.d.ts +3 -0
  43. package/dist/internals/parse-problem-details.d.ts.map +1 -0
  44. package/dist/internals/parse-problem-details.js +76 -0
  45. package/dist/internals/parse-problem-details.js.map +1 -0
  46. package/dist/internals/synthetic-details.d.ts +12 -0
  47. package/dist/internals/synthetic-details.d.ts.map +1 -0
  48. package/dist/internals/synthetic-details.js +19 -0
  49. package/dist/internals/synthetic-details.js.map +1 -0
  50. package/dist/verify/chains/bsc.d.ts +17 -0
  51. package/dist/verify/chains/bsc.d.ts.map +1 -0
  52. package/dist/verify/chains/bsc.js +15 -0
  53. package/dist/verify/chains/bsc.js.map +1 -0
  54. package/dist/verify/chains/btc.d.ts +22 -0
  55. package/dist/verify/chains/btc.d.ts.map +1 -0
  56. package/dist/verify/chains/btc.js +55 -0
  57. package/dist/verify/chains/btc.js.map +1 -0
  58. package/dist/verify/chains/cardano.d.ts +73 -0
  59. package/dist/verify/chains/cardano.d.ts.map +1 -0
  60. package/dist/verify/chains/cardano.js +175 -0
  61. package/dist/verify/chains/cardano.js.map +1 -0
  62. package/dist/verify/chains/evm.d.ts +21 -0
  63. package/dist/verify/chains/evm.d.ts.map +1 -0
  64. package/dist/verify/chains/evm.js +46 -0
  65. package/dist/verify/chains/evm.js.map +1 -0
  66. package/dist/verify/chains/polygon.d.ts +17 -0
  67. package/dist/verify/chains/polygon.d.ts.map +1 -0
  68. package/dist/verify/chains/polygon.js +15 -0
  69. package/dist/verify/chains/polygon.js.map +1 -0
  70. package/dist/verify/chains/secp256k1-bip32.d.ts +20 -0
  71. package/dist/verify/chains/secp256k1-bip32.d.ts.map +1 -0
  72. package/dist/verify/chains/secp256k1-bip32.js +88 -0
  73. package/dist/verify/chains/secp256k1-bip32.js.map +1 -0
  74. package/dist/verify/chains/ton-cell.d.ts +179 -0
  75. package/dist/verify/chains/ton-cell.d.ts.map +1 -0
  76. package/dist/verify/chains/ton-cell.js +614 -0
  77. package/dist/verify/chains/ton-cell.js.map +1 -0
  78. package/dist/verify/chains/ton.d.ts +84 -0
  79. package/dist/verify/chains/ton.d.ts.map +1 -0
  80. package/dist/verify/chains/ton.js +131 -0
  81. package/dist/verify/chains/ton.js.map +1 -0
  82. package/dist/verify/chains/tron.d.ts +21 -0
  83. package/dist/verify/chains/tron.d.ts.map +1 -0
  84. package/dist/verify/chains/tron.js +42 -0
  85. package/dist/verify/chains/tron.js.map +1 -0
  86. package/dist/verify/config.d.ts +41 -0
  87. package/dist/verify/config.d.ts.map +1 -0
  88. package/dist/verify/config.js +120 -0
  89. package/dist/verify/config.js.map +1 -0
  90. package/dist/verify/errors.d.ts +56 -0
  91. package/dist/verify/errors.d.ts.map +1 -0
  92. package/dist/verify/errors.js +58 -0
  93. package/dist/verify/errors.js.map +1 -0
  94. package/dist/verify/index.d.ts +119 -0
  95. package/dist/verify/index.d.ts.map +1 -0
  96. package/dist/verify/index.js +166 -0
  97. package/dist/verify/index.js.map +1 -0
  98. package/dist/verify/xpub-safety.d.ts +33 -0
  99. package/dist/verify/xpub-safety.d.ts.map +1 -0
  100. package/dist/verify/xpub-safety.js +54 -0
  101. package/dist/verify/xpub-safety.js.map +1 -0
  102. package/dist/verify-webhook-signature.d.ts +30 -0
  103. package/dist/verify-webhook-signature.d.ts.map +1 -0
  104. package/dist/verify-webhook-signature.js +84 -0
  105. package/dist/verify-webhook-signature.js.map +1 -0
  106. package/docs/00-getting-started.md +135 -0
  107. package/docs/01-authentication.md +114 -0
  108. package/docs/02-invoices.md +216 -0
  109. package/docs/03-rates-and-quotes.md +82 -0
  110. package/docs/04-webhooks.md +126 -0
  111. package/docs/05-errors.md +199 -0
  112. package/docs/05-sandbox.md +159 -0
  113. package/docs/06-idempotency.md +132 -0
  114. package/docs/examples/express-webhook-receiver.md +97 -0
  115. package/docs/examples/nextjs-route-handler.md +206 -0
  116. package/docs/examples/sandbox-vitest-suite.md +263 -0
  117. package/docs/index.md +66 -0
  118. package/docs/reference/client.md +392 -0
  119. package/docs/reference/errors.md +161 -0
  120. package/docs/reference/types.md +400 -0
  121. package/package.json +53 -0
@@ -0,0 +1,1887 @@
1
+ import type { Chain, ErrorCode, ProblemDetails } from './_shared/index.js';
2
+ /**
3
+ * Base error thrown by every `TxnodClient` method when the server returns a
4
+ * non-2xx response. Carries the RFC 7807 problem-details envelope so partners
5
+ * can branch on `error_code` or log `request_id` for support.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { TxnodClient, TxnodError } from '@txnod/sdk';
10
+ *
11
+ * const client = new TxnodClient({
12
+ * projectId: process.env.TXNOD_PROJECT_ID!,
13
+ * apiSecret: process.env.TXNOD_API_SECRET!,
14
+ * });
15
+ *
16
+ * try {
17
+ * const invoice = await client.createInvoice({
18
+ * amount_usd: 10.0,
19
+ * coin: 'btc',
20
+ * external_id: 'order-123',
21
+ * callback_url: 'https://my-site.com/webhooks/txnod',
22
+ * });
23
+ * console.log(invoice.id);
24
+ * } catch (err) {
25
+ * if (err instanceof TxnodError) {
26
+ * console.error(err.error_code, err.status, err.request_id);
27
+ * } else {
28
+ * throw err;
29
+ * }
30
+ * }
31
+ * ```
32
+ */
33
+ export declare class TxnodError extends Error {
34
+ readonly kind: string;
35
+ readonly error_code: ErrorCode;
36
+ readonly status: number;
37
+ readonly request_id: string;
38
+ readonly raw: ProblemDetails;
39
+ constructor(details: ProblemDetails);
40
+ }
41
+ /**
42
+ * Thrown by `verifyWebhookSignature` when the `X-Txnod-Signature` header is
43
+ * missing or does not match the expected `t=<unix>,v1=<hex>` shape.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * import { verifyWebhookSignature, TxnodSignatureFormatError } from '@txnod/sdk';
48
+ *
49
+ * try {
50
+ * verifyWebhookSignature(req.headers, rawBody, process.env.TXNOD_WEBHOOK_SECRET!);
51
+ * } catch (err) {
52
+ * if (err instanceof TxnodSignatureFormatError) {
53
+ * return new Response('bad header', { status: 401 });
54
+ * }
55
+ * throw err;
56
+ * }
57
+ * ```
58
+ */
59
+ export declare class TxnodSignatureFormatError extends TxnodError {
60
+ readonly kind: "signature_format";
61
+ constructor();
62
+ }
63
+ /**
64
+ * Thrown by `verifyWebhookSignature` when the computed HMAC-SHA256 does not
65
+ * match the signature carried in the `X-Txnod-Signature` header.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * import { verifyWebhookSignature, TxnodHmacError } from '@txnod/sdk';
70
+ *
71
+ * try {
72
+ * verifyWebhookSignature(req.headers, rawBody, process.env.TXNOD_WEBHOOK_SECRET!);
73
+ * } catch (err) {
74
+ * if (err instanceof TxnodHmacError) {
75
+ * return new Response('bad sig', { status: 401 });
76
+ * }
77
+ * throw err;
78
+ * }
79
+ * ```
80
+ */
81
+ export declare class TxnodHmacError extends TxnodError {
82
+ readonly kind: "hmac";
83
+ constructor();
84
+ }
85
+ /**
86
+ * Thrown by `verifyWebhookSignature` when the timestamp in the
87
+ * `X-Txnod-Signature` header is outside the ±300-second window. The signed
88
+ * `skew_seconds` field reports `now - timestamp` so callers can alert on
89
+ * clock drift.
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * import { verifyWebhookSignature, TxnodTimestampError } from '@txnod/sdk';
94
+ *
95
+ * try {
96
+ * verifyWebhookSignature(req.headers, rawBody, process.env.TXNOD_WEBHOOK_SECRET!);
97
+ * } catch (err) {
98
+ * if (err instanceof TxnodTimestampError) {
99
+ * console.warn('clock skew', err.skew_seconds);
100
+ * return new Response('stale', { status: 401 });
101
+ * }
102
+ * throw err;
103
+ * }
104
+ * ```
105
+ */
106
+ export declare class TxnodTimestampError extends TxnodError {
107
+ readonly kind: "timestamp";
108
+ readonly skew_seconds: number;
109
+ constructor(skewSeconds: number);
110
+ }
111
+ /**
112
+ * Thrown by `verifyWebhookSignature` when the body bytes pass HMAC verification
113
+ * but cannot be parsed as JSON. In a non-compromised setup this never fires;
114
+ * a real occurrence indicates a misbehaving server release that emitted a
115
+ * non-JSON body alongside a valid signature. The `cause` field carries the
116
+ * underlying `SyntaxError` so the partner can log it. Treat it as a 401-class
117
+ * failure (do not parse, do not act) — same handling as `TxnodHmacError`.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * import { verifyWebhookSignature, TxnodWebhookPayloadParseError } from '@txnod/sdk';
122
+ *
123
+ * try {
124
+ * verifyWebhookSignature(req.headers, rawBody, secret);
125
+ * } catch (err) {
126
+ * if (err instanceof TxnodWebhookPayloadParseError) {
127
+ * return new Response('bad payload', { status: 401 });
128
+ * }
129
+ * throw err;
130
+ * }
131
+ * ```
132
+ */
133
+ export declare class TxnodWebhookPayloadParseError extends TxnodError {
134
+ readonly kind: "webhook_payload_parse";
135
+ readonly cause: unknown;
136
+ constructor(cause: unknown);
137
+ }
138
+ /**
139
+ * Thrown when the server responds with `error_code: 'validation_error'` —
140
+ * request payload failed validation (Zod on the server). Inspect
141
+ * `err.raw.errors` for the structured per-field issues.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * import { TxnodClient, TxnodValidationError } from '@txnod/sdk';
146
+ *
147
+ * const client = new TxnodClient({
148
+ * projectId: process.env.TXNOD_PROJECT_ID!,
149
+ * apiSecret: process.env.TXNOD_API_SECRET!,
150
+ * });
151
+ *
152
+ * try {
153
+ * const invoice = await client.createInvoice({
154
+ * amount_usd: 10,
155
+ * coin: 'btc',
156
+ * external_id: 'order-1',
157
+ * });
158
+ * console.log(invoice.id);
159
+ * } catch (err) {
160
+ * if (err instanceof TxnodValidationError) {
161
+ * console.error('validation failed:', err.raw.errors);
162
+ * return;
163
+ * }
164
+ * throw err;
165
+ * }
166
+ * ```
167
+ */
168
+ export declare class TxnodValidationError extends TxnodError {
169
+ readonly kind: "validation_error";
170
+ constructor(details: ProblemDetails);
171
+ }
172
+ /**
173
+ * Thrown when the server responds with `error_code: 'invalid_coin'` — the
174
+ * requested `coin` is not in the supported coins enum.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * import { TxnodClient, TxnodInvalidCoinError } from '@txnod/sdk';
179
+ *
180
+ * const client = new TxnodClient({
181
+ * projectId: process.env.TXNOD_PROJECT_ID!,
182
+ * apiSecret: process.env.TXNOD_API_SECRET!,
183
+ * });
184
+ *
185
+ * try {
186
+ * const invoice = await client.createInvoice({
187
+ * amount_usd: 10,
188
+ * coin: 'btc',
189
+ * external_id: 'order-1',
190
+ * });
191
+ * console.log(invoice.id);
192
+ * } catch (err) {
193
+ * if (err instanceof TxnodInvalidCoinError) {
194
+ * console.error(err.error_code, err.request_id);
195
+ * return;
196
+ * }
197
+ * throw err;
198
+ * }
199
+ * ```
200
+ */
201
+ export declare class TxnodInvalidCoinError extends TxnodError {
202
+ readonly kind: "invalid_coin";
203
+ constructor(details: ProblemDetails);
204
+ }
205
+ /**
206
+ * Thrown when the server responds with `error_code: 'invalid_xpub_format'` —
207
+ * the supplied xpub string is structurally invalid for the chain.
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * import { TxnodClient, TxnodInvalidXpubFormatError } from '@txnod/sdk';
212
+ *
213
+ * const client = new TxnodClient({
214
+ * projectId: process.env.TXNOD_PROJECT_ID!,
215
+ * apiSecret: process.env.TXNOD_API_SECRET!,
216
+ * });
217
+ *
218
+ * try {
219
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
220
+ * console.log(invoice.status);
221
+ * } catch (err) {
222
+ * if (err instanceof TxnodInvalidXpubFormatError) {
223
+ * console.error(err.error_code, err.request_id);
224
+ * return;
225
+ * }
226
+ * throw err;
227
+ * }
228
+ * ```
229
+ */
230
+ export declare class TxnodInvalidXpubFormatError extends TxnodError {
231
+ readonly kind: "invalid_xpub_format";
232
+ constructor(details: ProblemDetails);
233
+ }
234
+ /**
235
+ * Thrown when the server responds with `error_code: 'invalid_webhook_url'` —
236
+ * the configured webhook URL is not a valid https URL.
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * import { TxnodClient, TxnodInvalidWebhookUrlError } from '@txnod/sdk';
241
+ *
242
+ * const client = new TxnodClient({
243
+ * projectId: process.env.TXNOD_PROJECT_ID!,
244
+ * apiSecret: process.env.TXNOD_API_SECRET!,
245
+ * });
246
+ *
247
+ * try {
248
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
249
+ * console.log(invoice.status);
250
+ * } catch (err) {
251
+ * if (err instanceof TxnodInvalidWebhookUrlError) {
252
+ * console.error(err.error_code, err.request_id);
253
+ * return;
254
+ * }
255
+ * throw err;
256
+ * }
257
+ * ```
258
+ */
259
+ export declare class TxnodInvalidWebhookUrlError extends TxnodError {
260
+ readonly kind: "invalid_webhook_url";
261
+ constructor(details: ProblemDetails);
262
+ }
263
+ /**
264
+ * Thrown when the server responds with `error_code: 'auth_invalid'` on an API
265
+ * call — the `X-Project-Id` / `X-Signature` headers are missing, malformed,
266
+ * or do not identify a known project. Distinct from the webhook-local
267
+ * `TxnodSignatureFormatError`: this one is thrown by `TxnodClient` methods
268
+ * on an API 401 response.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * import { TxnodClient, TxnodAuthInvalidError } from '@txnod/sdk';
273
+ *
274
+ * const client = new TxnodClient({
275
+ * projectId: process.env.TXNOD_PROJECT_ID!,
276
+ * apiSecret: process.env.TXNOD_API_SECRET!,
277
+ * });
278
+ *
279
+ * try {
280
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
281
+ * console.log(invoice.status);
282
+ * } catch (err) {
283
+ * if (err instanceof TxnodAuthInvalidError) {
284
+ * console.error(err.error_code, err.request_id);
285
+ * return;
286
+ * }
287
+ * throw err;
288
+ * }
289
+ * ```
290
+ */
291
+ export declare class TxnodAuthInvalidError extends TxnodError {
292
+ readonly kind: "auth_invalid";
293
+ constructor(details: ProblemDetails);
294
+ }
295
+ /**
296
+ * Thrown when the server responds with `error_code: 'signature_invalid'` on
297
+ * an API call — the computed HMAC for the outbound request did not match.
298
+ * Distinct from the webhook-local `TxnodHmacError`.
299
+ *
300
+ * @example
301
+ * ```ts
302
+ * import { TxnodClient, TxnodSignatureInvalidError } from '@txnod/sdk';
303
+ *
304
+ * const client = new TxnodClient({
305
+ * projectId: process.env.TXNOD_PROJECT_ID!,
306
+ * apiSecret: process.env.TXNOD_API_SECRET!,
307
+ * });
308
+ *
309
+ * try {
310
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
311
+ * console.log(invoice.status);
312
+ * } catch (err) {
313
+ * if (err instanceof TxnodSignatureInvalidError) {
314
+ * console.error(err.error_code, err.request_id);
315
+ * return;
316
+ * }
317
+ * throw err;
318
+ * }
319
+ * ```
320
+ */
321
+ export declare class TxnodSignatureInvalidError extends TxnodError {
322
+ readonly kind: "signature_invalid";
323
+ constructor(details: ProblemDetails);
324
+ }
325
+ /**
326
+ * Thrown when the server responds with `error_code: 'signature_replayed'` —
327
+ * the same signed `(timestamp, signature)` triple has already been processed
328
+ * within the freshness window. Re-sign the request (fresh timestamp) and try
329
+ * again. Persistent occurrence indicates a stuck retry loop on the caller
330
+ * side or, rarer, replay of a captured request.
331
+ *
332
+ * @example
333
+ * ```ts
334
+ * import { TxnodClient, TxnodSignatureReplayedError } from '@txnod/sdk';
335
+ *
336
+ * const client = new TxnodClient({
337
+ * projectId: process.env.TXNOD_PROJECT_ID!,
338
+ * apiSecret: process.env.TXNOD_API_SECRET!,
339
+ * });
340
+ *
341
+ * try {
342
+ * const invoice = await client.createInvoice({
343
+ * amount_usd: 10,
344
+ * coin: 'btc',
345
+ * external_id: 'order-1',
346
+ * });
347
+ * console.log(invoice.id);
348
+ * } catch (err) {
349
+ * if (err instanceof TxnodSignatureReplayedError) {
350
+ * // The previous attempt's signature was already accepted. The SDK
351
+ * // signs every request with a fresh timestamp, so this normally only
352
+ * // surfaces when something else (a proxy, a retry loop) sends the
353
+ * // exact same signed bytes a second time.
354
+ * console.error('signed request already processed', err.request_id);
355
+ * return;
356
+ * }
357
+ * throw err;
358
+ * }
359
+ * ```
360
+ */
361
+ export declare class TxnodSignatureReplayedError extends TxnodError {
362
+ readonly kind: "signature_replayed";
363
+ constructor(details: ProblemDetails);
364
+ }
365
+ /**
366
+ * Thrown when the server responds with `error_code: 'timestamp_out_of_window'`
367
+ * on an API call — the `X-Timestamp` header is outside the ±300-second
368
+ * window. Distinct from the webhook-local `TxnodTimestampError`, which
369
+ * exposes a `skew_seconds` field.
370
+ *
371
+ * @example
372
+ * ```ts
373
+ * import { TxnodClient, TxnodTimestampOutOfWindowError } from '@txnod/sdk';
374
+ *
375
+ * const client = new TxnodClient({
376
+ * projectId: process.env.TXNOD_PROJECT_ID!,
377
+ * apiSecret: process.env.TXNOD_API_SECRET!,
378
+ * });
379
+ *
380
+ * try {
381
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
382
+ * console.log(invoice.status);
383
+ * } catch (err) {
384
+ * if (err instanceof TxnodTimestampOutOfWindowError) {
385
+ * console.error(err.error_code, err.request_id);
386
+ * return;
387
+ * }
388
+ * throw err;
389
+ * }
390
+ * ```
391
+ */
392
+ export declare class TxnodTimestampOutOfWindowError extends TxnodError {
393
+ readonly kind: "timestamp_out_of_window";
394
+ constructor(details: ProblemDetails);
395
+ }
396
+ /**
397
+ * Thrown when the server responds with `error_code: 'key_suspended'` — the
398
+ * owner of the API key has been suspended.
399
+ *
400
+ * @example
401
+ * ```ts
402
+ * import { TxnodClient, TxnodKeySuspendedError } from '@txnod/sdk';
403
+ *
404
+ * const client = new TxnodClient({
405
+ * projectId: process.env.TXNOD_PROJECT_ID!,
406
+ * apiSecret: process.env.TXNOD_API_SECRET!,
407
+ * });
408
+ *
409
+ * try {
410
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
411
+ * console.log(invoice.status);
412
+ * } catch (err) {
413
+ * if (err instanceof TxnodKeySuspendedError) {
414
+ * console.error(err.error_code, err.request_id);
415
+ * return;
416
+ * }
417
+ * throw err;
418
+ * }
419
+ * ```
420
+ */
421
+ export declare class TxnodKeySuspendedError extends TxnodError {
422
+ readonly kind: "key_suspended";
423
+ constructor(details: ProblemDetails);
424
+ }
425
+ /**
426
+ * Thrown when the server responds with `error_code: 'project_suspended'` —
427
+ * the target project has been suspended.
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * import { TxnodClient, TxnodProjectSuspendedError } from '@txnod/sdk';
432
+ *
433
+ * const client = new TxnodClient({
434
+ * projectId: process.env.TXNOD_PROJECT_ID!,
435
+ * apiSecret: process.env.TXNOD_API_SECRET!,
436
+ * });
437
+ *
438
+ * try {
439
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
440
+ * console.log(invoice.status);
441
+ * } catch (err) {
442
+ * if (err instanceof TxnodProjectSuspendedError) {
443
+ * console.error(err.error_code, err.request_id);
444
+ * return;
445
+ * }
446
+ * throw err;
447
+ * }
448
+ * ```
449
+ */
450
+ export declare class TxnodProjectSuspendedError extends TxnodError {
451
+ readonly kind: "project_suspended";
452
+ constructor(details: ProblemDetails);
453
+ }
454
+ /**
455
+ * Thrown when the server responds with `error_code: 'permission_denied'` —
456
+ * the authenticated key does not hold the capability required by the route.
457
+ *
458
+ * @example
459
+ * ```ts
460
+ * import { TxnodClient, TxnodPermissionDeniedError } from '@txnod/sdk';
461
+ *
462
+ * const client = new TxnodClient({
463
+ * projectId: process.env.TXNOD_PROJECT_ID!,
464
+ * apiSecret: process.env.TXNOD_API_SECRET!,
465
+ * });
466
+ *
467
+ * try {
468
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
469
+ * console.log(invoice.status);
470
+ * } catch (err) {
471
+ * if (err instanceof TxnodPermissionDeniedError) {
472
+ * console.error(err.error_code, err.request_id);
473
+ * return;
474
+ * }
475
+ * throw err;
476
+ * }
477
+ * ```
478
+ */
479
+ export declare class TxnodPermissionDeniedError extends TxnodError {
480
+ readonly kind: "permission_denied";
481
+ constructor(details: ProblemDetails);
482
+ }
483
+ /**
484
+ * Thrown when the server responds with `error_code: 'key_revoked'` — the
485
+ * API key has been rotated or revoked and is no longer valid.
486
+ *
487
+ * @example
488
+ * ```ts
489
+ * import { TxnodClient, TxnodKeyRevokedError } from '@txnod/sdk';
490
+ *
491
+ * const client = new TxnodClient({
492
+ * projectId: process.env.TXNOD_PROJECT_ID!,
493
+ * apiSecret: process.env.TXNOD_API_SECRET!,
494
+ * });
495
+ *
496
+ * try {
497
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
498
+ * console.log(invoice.status);
499
+ * } catch (err) {
500
+ * if (err instanceof TxnodKeyRevokedError) {
501
+ * console.error(err.error_code, err.request_id);
502
+ * return;
503
+ * }
504
+ * throw err;
505
+ * }
506
+ * ```
507
+ */
508
+ export declare class TxnodKeyRevokedError extends TxnodError {
509
+ readonly kind: "key_revoked";
510
+ constructor(details: ProblemDetails);
511
+ }
512
+ /**
513
+ * Thrown when the server responds with `error_code: 'invoice_not_found'` —
514
+ * no invoice exists with the given id for this project.
515
+ *
516
+ * @example
517
+ * ```ts
518
+ * import { TxnodClient, TxnodInvoiceNotFoundError } from '@txnod/sdk';
519
+ *
520
+ * const client = new TxnodClient({
521
+ * projectId: process.env.TXNOD_PROJECT_ID!,
522
+ * apiSecret: process.env.TXNOD_API_SECRET!,
523
+ * });
524
+ *
525
+ * try {
526
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
527
+ * return Response.json(invoice);
528
+ * } catch (err) {
529
+ * if (err instanceof TxnodInvoiceNotFoundError) {
530
+ * return new Response('Not found', { status: 404 });
531
+ * }
532
+ * throw err;
533
+ * }
534
+ * ```
535
+ */
536
+ export declare class TxnodInvoiceNotFoundError extends TxnodError {
537
+ readonly kind: "invoice_not_found";
538
+ constructor(details: ProblemDetails);
539
+ }
540
+ /**
541
+ * Thrown when the server responds with `error_code: 'project_not_found'` —
542
+ * no project exists with the given id (or the key does not have access).
543
+ *
544
+ * @example
545
+ * ```ts
546
+ * import { TxnodClient, TxnodProjectNotFoundError } from '@txnod/sdk';
547
+ *
548
+ * const client = new TxnodClient({
549
+ * projectId: process.env.TXNOD_PROJECT_ID!,
550
+ * apiSecret: process.env.TXNOD_API_SECRET!,
551
+ * });
552
+ *
553
+ * try {
554
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
555
+ * console.log(invoice.status);
556
+ * } catch (err) {
557
+ * if (err instanceof TxnodProjectNotFoundError) {
558
+ * console.error(err.error_code, err.request_id);
559
+ * return;
560
+ * }
561
+ * throw err;
562
+ * }
563
+ * ```
564
+ */
565
+ export declare class TxnodProjectNotFoundError extends TxnodError {
566
+ readonly kind: "project_not_found";
567
+ constructor(details: ProblemDetails);
568
+ }
569
+ /**
570
+ * Thrown when the server responds with `error_code: 'wallet_not_found'` —
571
+ * no wallet record exists for the requested chain + project.
572
+ *
573
+ * @example
574
+ * ```ts
575
+ * import { TxnodClient, TxnodWalletNotFoundError } from '@txnod/sdk';
576
+ *
577
+ * const client = new TxnodClient({
578
+ * projectId: process.env.TXNOD_PROJECT_ID!,
579
+ * apiSecret: process.env.TXNOD_API_SECRET!,
580
+ * });
581
+ *
582
+ * try {
583
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
584
+ * console.log(invoice.status);
585
+ * } catch (err) {
586
+ * if (err instanceof TxnodWalletNotFoundError) {
587
+ * console.error(err.error_code, err.request_id);
588
+ * return;
589
+ * }
590
+ * throw err;
591
+ * }
592
+ * ```
593
+ */
594
+ export declare class TxnodWalletNotFoundError extends TxnodError {
595
+ readonly kind: "wallet_not_found";
596
+ constructor(details: ProblemDetails);
597
+ }
598
+ /**
599
+ * Thrown when the server responds with `error_code: 'external_id_conflict'` —
600
+ * an invoice with the requested `external_id` already exists for this
601
+ * project. Treat as idempotent success and fetch the existing invoice.
602
+ *
603
+ * @example
604
+ * ```ts
605
+ * import { TxnodClient, TxnodExternalIdConflictError } from '@txnod/sdk';
606
+ *
607
+ * const client = new TxnodClient({
608
+ * projectId: process.env.TXNOD_PROJECT_ID!,
609
+ * apiSecret: process.env.TXNOD_API_SECRET!,
610
+ * });
611
+ *
612
+ * try {
613
+ * const invoice = await client.createInvoice({
614
+ * amount_usd: 10,
615
+ * coin: 'btc',
616
+ * external_id: 'order-1',
617
+ * });
618
+ * console.log(invoice.id);
619
+ * } catch (err) {
620
+ * if (err instanceof TxnodExternalIdConflictError) {
621
+ * const page = await client.searchInvoices({ external_id: 'order-1', limit: 1 });
622
+ * const existing = page.items[0];
623
+ * if (existing !== undefined) console.log(existing.status);
624
+ * return;
625
+ * }
626
+ * throw err;
627
+ * }
628
+ * ```
629
+ */
630
+ export declare class TxnodExternalIdConflictError extends TxnodError {
631
+ readonly kind: "external_id_conflict";
632
+ constructor(details: ProblemDetails);
633
+ }
634
+ /**
635
+ * Thrown when the server responds with `error_code: 'xpub_not_verified'` —
636
+ * the xpub for the chain has not completed its verification challenge yet.
637
+ *
638
+ * @example
639
+ * ```ts
640
+ * import { TxnodClient, TxnodXpubNotVerifiedError } from '@txnod/sdk';
641
+ *
642
+ * const client = new TxnodClient({
643
+ * projectId: process.env.TXNOD_PROJECT_ID!,
644
+ * apiSecret: process.env.TXNOD_API_SECRET!,
645
+ * });
646
+ *
647
+ * try {
648
+ * const invoice = await client.createInvoice({
649
+ * amount_usd: 10,
650
+ * coin: 'btc',
651
+ * external_id: 'order-1',
652
+ * });
653
+ * console.log(invoice.id);
654
+ * } catch (err) {
655
+ * if (err instanceof TxnodXpubNotVerifiedError) {
656
+ * console.error(err.error_code, err.request_id);
657
+ * return;
658
+ * }
659
+ * throw err;
660
+ * }
661
+ * ```
662
+ */
663
+ export declare class TxnodXpubNotVerifiedError extends TxnodError {
664
+ readonly kind: "xpub_not_verified";
665
+ constructor(details: ProblemDetails);
666
+ }
667
+ /**
668
+ * Thrown when the server responds with `error_code: 'coin_not_enabled'` —
669
+ * the requested coin is not enabled for this project. Point the user at a
670
+ * coin from `client.getRates()`.
671
+ *
672
+ * @example
673
+ * ```ts
674
+ * import { TxnodClient, TxnodCoinNotEnabledError } from '@txnod/sdk';
675
+ *
676
+ * const client = new TxnodClient({
677
+ * projectId: process.env.TXNOD_PROJECT_ID!,
678
+ * apiSecret: process.env.TXNOD_API_SECRET!,
679
+ * });
680
+ *
681
+ * try {
682
+ * const invoice = await client.createInvoice({
683
+ * amount_usd: 10,
684
+ * coin: 'btc',
685
+ * external_id: 'order-1',
686
+ * });
687
+ * console.log(invoice.id);
688
+ * } catch (err) {
689
+ * if (err instanceof TxnodCoinNotEnabledError) {
690
+ * const rates = await client.getRates({});
691
+ * console.log('enabled coins:', Object.keys(rates.rates));
692
+ * return;
693
+ * }
694
+ * throw err;
695
+ * }
696
+ * ```
697
+ */
698
+ export declare class TxnodCoinNotEnabledError extends TxnodError {
699
+ readonly kind: "coin_not_enabled";
700
+ constructor(details: ProblemDetails);
701
+ }
702
+ /**
703
+ * Thrown when the server responds with `error_code: 'amount_out_of_range'` —
704
+ * the requested amount is outside the project's accepted range.
705
+ *
706
+ * @example
707
+ * ```ts
708
+ * import { TxnodClient, TxnodAmountOutOfRangeError } from '@txnod/sdk';
709
+ *
710
+ * const client = new TxnodClient({
711
+ * projectId: process.env.TXNOD_PROJECT_ID!,
712
+ * apiSecret: process.env.TXNOD_API_SECRET!,
713
+ * });
714
+ *
715
+ * try {
716
+ * const invoice = await client.createInvoice({
717
+ * amount_usd: 10,
718
+ * coin: 'btc',
719
+ * external_id: 'order-1',
720
+ * });
721
+ * console.log(invoice.id);
722
+ * } catch (err) {
723
+ * if (err instanceof TxnodAmountOutOfRangeError) {
724
+ * console.error(err.error_code, err.request_id);
725
+ * return;
726
+ * }
727
+ * throw err;
728
+ * }
729
+ * ```
730
+ */
731
+ export declare class TxnodAmountOutOfRangeError extends TxnodError {
732
+ readonly kind: "amount_out_of_range";
733
+ constructor(details: ProblemDetails);
734
+ }
735
+ /**
736
+ * Thrown when the server responds with `error_code: 'rate_limit_exceeded'` —
737
+ * the per-key rate limit has been exceeded. The `retry_after_seconds` field
738
+ * carries the value of the HTTP `Retry-After` header (0 when absent).
739
+ *
740
+ * @example
741
+ * ```ts
742
+ * import { TxnodClient, TxnodRateLimitError } from '@txnod/sdk';
743
+ *
744
+ * const client = new TxnodClient({
745
+ * projectId: process.env.TXNOD_PROJECT_ID!,
746
+ * apiSecret: process.env.TXNOD_API_SECRET!,
747
+ * });
748
+ *
749
+ * try {
750
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
751
+ * console.log(invoice.status);
752
+ * } catch (err) {
753
+ * if (err instanceof TxnodRateLimitError) {
754
+ * await new Promise((r) => setTimeout(r, err.retry_after_seconds * 1000));
755
+ * const retry = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
756
+ * console.log(retry.status);
757
+ * return;
758
+ * }
759
+ * throw err;
760
+ * }
761
+ * ```
762
+ */
763
+ export declare class TxnodRateLimitError extends TxnodError {
764
+ readonly kind: "rate_limit_exceeded";
765
+ readonly retry_after_seconds: number;
766
+ constructor(details: ProblemDetails, retryAfterSeconds: number);
767
+ }
768
+ /**
769
+ * Thrown when the server responds with `error_code: 'pool_exhausted'` — the
770
+ * per-chain derivation-address pool has hit its hard cap
771
+ * (`poolSizePerChain[chain]`) and no slot is currently `available`. The
772
+ * `retry_after_seconds` field carries the value of the HTTP `Retry-After`
773
+ * header (0 when absent) — the server derives it from the soonest
774
+ * `locked_until` across locked rows, falling back to the project's
775
+ * `cooldownSeconds`. Wait the indicated interval before retrying, or raise
776
+ * the per-chain pool cap if this fires under normal load.
777
+ *
778
+ * @example
779
+ * ```ts
780
+ * import { TxnodClient, TxnodPoolExhaustedError } from '@txnod/sdk';
781
+ *
782
+ * const client = new TxnodClient({
783
+ * projectId: process.env.TXNOD_PROJECT_ID!,
784
+ * apiSecret: process.env.TXNOD_API_SECRET!,
785
+ * });
786
+ *
787
+ * try {
788
+ * const invoice = await client.createInvoice({
789
+ * amount_usd: 10,
790
+ * coin: 'btc',
791
+ * external_id: 'order-1',
792
+ * });
793
+ * console.log(invoice.id);
794
+ * } catch (err) {
795
+ * if (err instanceof TxnodPoolExhaustedError) {
796
+ * await new Promise((r) => setTimeout(r, err.retry_after_seconds * 1000));
797
+ * const retry = await client.createInvoice({
798
+ * amount_usd: 10,
799
+ * coin: 'btc',
800
+ * external_id: 'order-1',
801
+ * });
802
+ * console.log(retry.id);
803
+ * return;
804
+ * }
805
+ * throw err;
806
+ * }
807
+ * ```
808
+ */
809
+ export declare class TxnodPoolExhaustedError extends TxnodError {
810
+ readonly kind: "pool_exhausted";
811
+ readonly retry_after_seconds: number;
812
+ constructor(details: ProblemDetails, retryAfterSeconds: number);
813
+ }
814
+ /**
815
+ * Thrown when the server responds with `error_code: 'webhook_capacity_exhausted'`
816
+ * — the chain's webhook fleet has no spare slots, so the server can't bind a
817
+ * new pool address to a webhook. `retry_after_seconds` is `0` because partner
818
+ * retry alone will not free capacity. Treat as a transient outage; queue the
819
+ * invoice and retry later.
820
+ *
821
+ * @example
822
+ * ```ts
823
+ * import { TxnodClient, TxnodWebhookCapacityExhaustedError } from '@txnod/sdk';
824
+ *
825
+ * const client = new TxnodClient({
826
+ * projectId: process.env.TXNOD_PROJECT_ID!,
827
+ * apiSecret: process.env.TXNOD_API_SECRET!,
828
+ * });
829
+ *
830
+ * try {
831
+ * await client.createInvoice({
832
+ * external_id: 'order-1',
833
+ * amount_usd: 100,
834
+ * coin: 'eth',
835
+ * });
836
+ * } catch (err) {
837
+ * if (err instanceof TxnodWebhookCapacityExhaustedError) {
838
+ * console.error('webhook fleet at capacity for chain:', err.kind);
839
+ * // Transient outage — queue invoice and retry later.
840
+ * return;
841
+ * }
842
+ * throw err;
843
+ * }
844
+ * ```
845
+ */
846
+ export declare class TxnodWebhookCapacityExhaustedError extends TxnodError {
847
+ readonly kind: "webhook_capacity_exhausted";
848
+ readonly retry_after_seconds: number;
849
+ constructor(details: ProblemDetails, retryAfterSeconds: number);
850
+ }
851
+ /**
852
+ * Thrown when the server responds with `error_code: 'internal_error'` — the
853
+ * server failed for a reason it could not categorize. Log `err.request_id`
854
+ * for support and treat as a retryable 5xx.
855
+ *
856
+ * @example
857
+ * ```ts
858
+ * import { TxnodClient, TxnodServerError } from '@txnod/sdk';
859
+ *
860
+ * const client = new TxnodClient({
861
+ * projectId: process.env.TXNOD_PROJECT_ID!,
862
+ * apiSecret: process.env.TXNOD_API_SECRET!,
863
+ * });
864
+ *
865
+ * try {
866
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
867
+ * console.log(invoice.status);
868
+ * } catch (err) {
869
+ * if (err instanceof TxnodServerError) {
870
+ * console.error('TxNod server error — report request_id to support:', err.request_id);
871
+ * return;
872
+ * }
873
+ * throw err;
874
+ * }
875
+ * ```
876
+ */
877
+ export declare class TxnodServerError extends TxnodError {
878
+ readonly kind: "internal_error";
879
+ constructor(details: ProblemDetails);
880
+ }
881
+ /**
882
+ * Thrown when the server responds with `error_code: 'invoice_not_cancellable'`
883
+ * — the invoice is in a state that does not permit cancellation.
884
+ *
885
+ * @example
886
+ * ```ts
887
+ * import { TxnodClient, TxnodInvoiceNotCancellableError } from '@txnod/sdk';
888
+ *
889
+ * const client = new TxnodClient({
890
+ * projectId: process.env.TXNOD_PROJECT_ID!,
891
+ * apiSecret: process.env.TXNOD_API_SECRET!,
892
+ * });
893
+ *
894
+ * try {
895
+ * const invoice = await client.cancelInvoice('01HK8MAR2QEXAMPLE000000000');
896
+ * console.log(invoice.status);
897
+ * } catch (err) {
898
+ * if (err instanceof TxnodInvoiceNotCancellableError) {
899
+ * console.error(err.error_code, err.request_id);
900
+ * return;
901
+ * }
902
+ * throw err;
903
+ * }
904
+ * ```
905
+ */
906
+ export declare class TxnodInvoiceNotCancellableError extends TxnodError {
907
+ readonly kind: "invoice_not_cancellable";
908
+ constructor(details: ProblemDetails);
909
+ }
910
+ /**
911
+ * Thrown when the server responds with `error_code: 'invalid_state_transition'`
912
+ * — the requested operation would produce an illegal invoice state
913
+ * transition.
914
+ *
915
+ * @example
916
+ * ```ts
917
+ * import { TxnodClient, TxnodInvalidStateTransitionError } from '@txnod/sdk';
918
+ *
919
+ * const client = new TxnodClient({
920
+ * projectId: process.env.TXNOD_PROJECT_ID!,
921
+ * apiSecret: process.env.TXNOD_API_SECRET!,
922
+ * });
923
+ *
924
+ * try {
925
+ * const invoice = await client.cancelInvoice('01HK8MAR2QEXAMPLE000000000');
926
+ * console.log(invoice.status);
927
+ * } catch (err) {
928
+ * if (err instanceof TxnodInvalidStateTransitionError) {
929
+ * console.error(err.error_code, err.request_id);
930
+ * return;
931
+ * }
932
+ * throw err;
933
+ * }
934
+ * ```
935
+ */
936
+ export declare class TxnodInvalidStateTransitionError extends TxnodError {
937
+ readonly kind: "invalid_state_transition";
938
+ constructor(details: ProblemDetails);
939
+ }
940
+ /**
941
+ * Thrown when the server responds with `error_code: 'orphan_not_found'` —
942
+ * no orphan payment exists with the given tx hash.
943
+ *
944
+ * @example
945
+ * ```ts
946
+ * import { TxnodClient, TxnodOrphanNotFoundError } from '@txnod/sdk';
947
+ *
948
+ * const client = new TxnodClient({
949
+ * projectId: process.env.TXNOD_PROJECT_ID!,
950
+ * apiSecret: process.env.TXNOD_API_SECRET!,
951
+ * });
952
+ *
953
+ * try {
954
+ * await client.attributeOrphanPayment('0xabc', { external_id: 'order-1' });
955
+ * } catch (err) {
956
+ * if (err instanceof TxnodOrphanNotFoundError) {
957
+ * console.error(err.error_code, err.request_id);
958
+ * return;
959
+ * }
960
+ * throw err;
961
+ * }
962
+ * ```
963
+ */
964
+ export declare class TxnodOrphanNotFoundError extends TxnodError {
965
+ readonly kind: "orphan_not_found";
966
+ constructor(details: ProblemDetails);
967
+ }
968
+ /**
969
+ * Thrown when the server responds with `error_code: 'orphan_already_attributed'`
970
+ * — the orphan payment has already been attributed to an invoice.
971
+ *
972
+ * @example
973
+ * ```ts
974
+ * import { TxnodClient, TxnodOrphanAlreadyAttributedError } from '@txnod/sdk';
975
+ *
976
+ * const client = new TxnodClient({
977
+ * projectId: process.env.TXNOD_PROJECT_ID!,
978
+ * apiSecret: process.env.TXNOD_API_SECRET!,
979
+ * });
980
+ *
981
+ * try {
982
+ * await client.attributeOrphanPayment('0xabc', { external_id: 'order-1' });
983
+ * } catch (err) {
984
+ * if (err instanceof TxnodOrphanAlreadyAttributedError) {
985
+ * console.error(err.error_code, err.request_id);
986
+ * return;
987
+ * }
988
+ * throw err;
989
+ * }
990
+ * ```
991
+ */
992
+ export declare class TxnodOrphanAlreadyAttributedError extends TxnodError {
993
+ readonly kind: "orphan_already_attributed";
994
+ constructor(details: ProblemDetails);
995
+ }
996
+ /**
997
+ * Thrown when the server responds with `error_code: 'event_not_found'` — no
998
+ * webhook event exists with the given id for this project.
999
+ *
1000
+ * @example
1001
+ * ```ts
1002
+ * import { TxnodClient, TxnodEventNotFoundError } from '@txnod/sdk';
1003
+ *
1004
+ * const client = new TxnodClient({
1005
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1006
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1007
+ * });
1008
+ *
1009
+ * try {
1010
+ * await client.resendWebhookEvent('01HK8MAR2QEXAMPLE000000000');
1011
+ * } catch (err) {
1012
+ * if (err instanceof TxnodEventNotFoundError) {
1013
+ * console.error(err.error_code, err.request_id);
1014
+ * return;
1015
+ * }
1016
+ * throw err;
1017
+ * }
1018
+ * ```
1019
+ */
1020
+ export declare class TxnodEventNotFoundError extends TxnodError {
1021
+ readonly kind: "event_not_found";
1022
+ constructor(details: ProblemDetails);
1023
+ }
1024
+ /**
1025
+ * Thrown when the server responds with `error_code: 'wallet_not_bound'` —
1026
+ * the target project has no verified wallet bound for the requested chain.
1027
+ * The chain is implied by the invoice's `coin` and the project's `kind`
1028
+ * (production / testnet) is fixed at project create time. Bind a wallet of
1029
+ * matching kind via the dashboard or the binding API before retrying invoice
1030
+ * creation.
1031
+ *
1032
+ * Status: 422 (was 409 in pre-`testnet`-kind builds).
1033
+ *
1034
+ * @example
1035
+ * ```ts
1036
+ * import { TxnodClient, TxnodWalletNotBoundError } from '@txnod/sdk';
1037
+ *
1038
+ * const client = new TxnodClient({
1039
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1040
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1041
+ * });
1042
+ *
1043
+ * try {
1044
+ * const invoice = await client.createInvoice({
1045
+ * amount_usd: 10,
1046
+ * coin: 'btc',
1047
+ * external_id: 'order-1',
1048
+ * });
1049
+ * console.log(invoice.id);
1050
+ * } catch (err) {
1051
+ * if (err instanceof TxnodWalletNotBoundError) {
1052
+ * console.error('bind a wallet before retrying', err.request_id);
1053
+ * return;
1054
+ * }
1055
+ * throw err;
1056
+ * }
1057
+ * ```
1058
+ */
1059
+ export declare class TxnodWalletNotBoundError extends TxnodError {
1060
+ readonly kind: "wallet_not_bound";
1061
+ constructor(details: ProblemDetails);
1062
+ }
1063
+ /**
1064
+ * Thrown when the server responds with `error_code: 'wallet_kind_mismatch'`
1065
+ * (HTTP 422) — the operator attempted to bind an `operator_wallet` of one
1066
+ * `kind` (e.g. `'testnet'`) to a project of a different `kind` (e.g.
1067
+ * `'production'`). Project kind is fixed at create time and cross-kind
1068
+ * binding is forbidden — production projects accept only production wallets,
1069
+ * testnet projects accept only testnet wallets, sandbox projects auto-derive
1070
+ * their own simulated wallets and never reach the operator-binding surface.
1071
+ *
1072
+ * Recover by either creating a wallet of the matching kind, or creating a
1073
+ * fresh project of the wallet's kind.
1074
+ *
1075
+ * @example
1076
+ * ```ts
1077
+ * import { TxnodWalletKindMismatchError } from '@txnod/sdk';
1078
+ *
1079
+ * try {
1080
+ * // ...attempt a cross-kind wallet binding via a server action / internal API...
1081
+ * } catch (err) {
1082
+ * if (err instanceof TxnodWalletKindMismatchError) {
1083
+ * console.error('cannot bind across kinds', err.request_id);
1084
+ * return;
1085
+ * }
1086
+ * throw err;
1087
+ * }
1088
+ * ```
1089
+ */
1090
+ export declare class TxnodWalletKindMismatchError extends TxnodError {
1091
+ readonly kind: "wallet_kind_mismatch";
1092
+ constructor(details: ProblemDetails);
1093
+ }
1094
+ /**
1095
+ * Thrown when the server responds with `error_code: 'wallet_not_owned'` — the
1096
+ * authenticated operator does not own the wallet targeted by the request.
1097
+ * Dashboard-only: the partner HMAC surface never exposes other-operator wallets,
1098
+ * so this error is limited to internal Server Actions.
1099
+ *
1100
+ * @example
1101
+ * ```ts
1102
+ * import { TxnodClient, TxnodWalletNotOwnedError } from '@txnod/sdk';
1103
+ *
1104
+ * const client = new TxnodClient({
1105
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1106
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1107
+ * });
1108
+ *
1109
+ * try {
1110
+ * const invoice = await client.getInvoice('01HK8MAR2QEXAMPLE000000000');
1111
+ * console.log(invoice.status);
1112
+ * } catch (err) {
1113
+ * if (err instanceof TxnodWalletNotOwnedError) {
1114
+ * console.error(err.error_code, err.request_id);
1115
+ * return;
1116
+ * }
1117
+ * throw err;
1118
+ * }
1119
+ * ```
1120
+ */
1121
+ export declare class TxnodWalletNotOwnedError extends TxnodError {
1122
+ readonly kind: "wallet_not_owned";
1123
+ constructor(details: ProblemDetails);
1124
+ }
1125
+ /**
1126
+ * Thrown when the server responds with `error_code: 'wallet_has_active_bindings'`
1127
+ * — the authenticated operator attempted to archive an `operator_wallet` while
1128
+ * at least one `project_chain_wallet_bindings` row still references it. The
1129
+ * RFC-7807 response carries an `extensions.affected_projects` list of
1130
+ * `(project_id, project_name, chain)` tuples; future SDK methods will expose
1131
+ * them via a dedicated field on this class.
1132
+ *
1133
+ * @example
1134
+ * ```ts
1135
+ * import { TxnodWalletHasActiveBindingsError } from '@txnod/sdk';
1136
+ *
1137
+ * try {
1138
+ * // ...attempt to archive an operator wallet that still has active bindings...
1139
+ * } catch (err) {
1140
+ * if (err instanceof TxnodWalletHasActiveBindingsError) {
1141
+ * console.error('rebind affected projects first', err.request_id);
1142
+ * return;
1143
+ * }
1144
+ * throw err;
1145
+ * }
1146
+ * ```
1147
+ */
1148
+ export declare class TxnodWalletHasActiveBindingsError extends TxnodError {
1149
+ readonly kind: "wallet_has_active_bindings";
1150
+ constructor(details: ProblemDetails);
1151
+ }
1152
+ /**
1153
+ * Thrown when the server responds with `error_code: 'subscription_expired'`
1154
+ * (HTTP 402) — the authenticated operator's subscription is not `active`
1155
+ * and write operations are blocked. Reads remain available. The operator
1156
+ * must renew via `/billing` before writes will succeed again.
1157
+ *
1158
+ * @example
1159
+ * ```ts
1160
+ * import { TxnodClient, TxnodSubscriptionExpiredError } from '@txnod/sdk';
1161
+ *
1162
+ * const client = new TxnodClient({
1163
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1164
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1165
+ * });
1166
+ *
1167
+ * try {
1168
+ * await client.createInvoice({ external_id: 'o-1', amount_usd: 50, coin: 'btc' });
1169
+ * } catch (err) {
1170
+ * if (err instanceof TxnodSubscriptionExpiredError) {
1171
+ * console.error('renew subscription at /billing', err.request_id);
1172
+ * return;
1173
+ * }
1174
+ * throw err;
1175
+ * }
1176
+ * ```
1177
+ */
1178
+ export declare class TxnodSubscriptionExpiredError extends TxnodError {
1179
+ readonly kind: "subscription_expired";
1180
+ constructor(details: ProblemDetails);
1181
+ }
1182
+ /**
1183
+ * Thrown when the server responds with `error_code: 'tron_no_activated_addresses_available'`
1184
+ * (HTTP 422) — the operator's TRON pool has zero activated addresses and the
1185
+ * invoice cannot be issued. The `wallet_id` field carries the operator wallet
1186
+ * id; deep-link the operator into `/wallets/{wallet_id}` where they can
1187
+ * activate addresses via a third-party multisend service or an in-dashboard
1188
+ * Ledger tool.
1189
+ *
1190
+ * @example
1191
+ * ```ts
1192
+ * import { TxnodClient, TxnodTronNoActivatedAddressesError } from '@txnod/sdk';
1193
+ *
1194
+ * const client = new TxnodClient({
1195
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1196
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1197
+ * });
1198
+ *
1199
+ * try {
1200
+ * const invoice = await client.createInvoice({
1201
+ * amount_usd: 10,
1202
+ * coin: 'usdt_trc20',
1203
+ * external_id: 'order-1',
1204
+ * });
1205
+ * console.log(invoice.id);
1206
+ * } catch (err) {
1207
+ * if (err instanceof TxnodTronNoActivatedAddressesError) {
1208
+ * console.error('activate addresses for wallet', err.walletId);
1209
+ * return;
1210
+ * }
1211
+ * throw err;
1212
+ * }
1213
+ * ```
1214
+ */
1215
+ export declare class TxnodTronNoActivatedAddressesError extends TxnodError {
1216
+ readonly kind: "tron_no_activated_addresses_available";
1217
+ readonly walletId: string;
1218
+ constructor(details: ProblemDetails);
1219
+ }
1220
+ /**
1221
+ * Thrown when the server responds with `error_code: 'ton_operator_wallet_not_deployed'`
1222
+ * (HTTP 422) — the operator's TON wallet has not yet been deployed on-chain,
1223
+ * so a deposit cannot be issued. Trigger the wallet's first outbound message
1224
+ * (or send a no-op transaction) to deploy the contract, then retry.
1225
+ *
1226
+ * @example
1227
+ * ```ts
1228
+ * import { TxnodClient, TxnodTonOperatorWalletNotDeployedError } from '@txnod/sdk';
1229
+ *
1230
+ * const client = new TxnodClient({
1231
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1232
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1233
+ * });
1234
+ *
1235
+ * try {
1236
+ * const invoice = await client.createInvoice({
1237
+ * amount_usd: 10,
1238
+ * coin: 'ton',
1239
+ * external_id: 'order-1',
1240
+ * });
1241
+ * console.log(invoice.id);
1242
+ * } catch (err) {
1243
+ * if (err instanceof TxnodTonOperatorWalletNotDeployedError) {
1244
+ * console.error('deploy operator wallet before issuing TON invoices', err.request_id);
1245
+ * return;
1246
+ * }
1247
+ * throw err;
1248
+ * }
1249
+ * ```
1250
+ */
1251
+ export declare class TxnodTonOperatorWalletNotDeployedError extends TxnodError {
1252
+ readonly kind: "ton_operator_wallet_not_deployed";
1253
+ constructor(details: ProblemDetails);
1254
+ }
1255
+ /**
1256
+ * Thrown when the server responds with `error_code: 'ton_invalid_wallet_version'`
1257
+ * (HTTP 422) — the TON wallet version supplied is not one of the supported
1258
+ * versions (`v3R2`, `v4R2`, `v5R1`).
1259
+ *
1260
+ * @example
1261
+ * ```ts
1262
+ * import { TxnodClient, TxnodTonInvalidWalletVersionError } from '@txnod/sdk';
1263
+ *
1264
+ * const client = new TxnodClient({
1265
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1266
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1267
+ * });
1268
+ *
1269
+ * try {
1270
+ * const invoice = await client.createInvoice({
1271
+ * amount_usd: 10,
1272
+ * coin: 'ton',
1273
+ * external_id: 'order-1',
1274
+ * });
1275
+ * console.log(invoice.id);
1276
+ * } catch (err) {
1277
+ * if (err instanceof TxnodTonInvalidWalletVersionError) {
1278
+ * console.error('register a v3R2/v4R2/v5R1 wallet', err.request_id);
1279
+ * return;
1280
+ * }
1281
+ * throw err;
1282
+ * }
1283
+ * ```
1284
+ */
1285
+ export declare class TxnodTonInvalidWalletVersionError extends TxnodError {
1286
+ readonly kind: "ton_invalid_wallet_version";
1287
+ constructor(details: ProblemDetails);
1288
+ }
1289
+ /**
1290
+ * Thrown when the server responds with `error_code: 'ton_jetton_resolve_failed'`
1291
+ * (HTTP 503) — the TON jetton-wallet address could not be resolved because
1292
+ * the upstream provider is temporarily unavailable. The error is retryable.
1293
+ *
1294
+ * @example
1295
+ * ```ts
1296
+ * import { TxnodClient, TxnodTonJettonResolveFailedError } from '@txnod/sdk';
1297
+ *
1298
+ * const client = new TxnodClient({
1299
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1300
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1301
+ * });
1302
+ *
1303
+ * try {
1304
+ * const invoice = await client.createInvoice({
1305
+ * amount_usd: 10,
1306
+ * coin: 'usdt_ton',
1307
+ * external_id: 'order-1',
1308
+ * });
1309
+ * console.log(invoice.id);
1310
+ * } catch (err) {
1311
+ * if (err instanceof TxnodTonJettonResolveFailedError) {
1312
+ * console.error('jetton resolver unavailable; retrying soon', err.request_id);
1313
+ * return;
1314
+ * }
1315
+ * throw err;
1316
+ * }
1317
+ * ```
1318
+ */
1319
+ export declare class TxnodTonJettonResolveFailedError extends TxnodError {
1320
+ readonly kind: "ton_jetton_resolve_failed";
1321
+ constructor(details: ProblemDetails);
1322
+ }
1323
+ /**
1324
+ * Thrown when the server responds with `error_code: 'ton_comment_parse_failed'`
1325
+ * (HTTP 422) — a TON deposit comment could not be parsed as a payment token.
1326
+ * Surfaces through the orphan / unattributed-deposit flow rather than the
1327
+ * partner integration API, but is included here for SDK error mapping
1328
+ * completeness.
1329
+ *
1330
+ * @example
1331
+ * ```ts
1332
+ * import { TxnodClient, TxnodTonCommentParseFailedError } from '@txnod/sdk';
1333
+ *
1334
+ * const client = new TxnodClient({
1335
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1336
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1337
+ * });
1338
+ *
1339
+ * try {
1340
+ * await client.attributeOrphanPayment('0xabc', { external_id: 'order-1' });
1341
+ * } catch (err) {
1342
+ * if (err instanceof TxnodTonCommentParseFailedError) {
1343
+ * console.error('TON deposit comment was unparseable', err.request_id);
1344
+ * return;
1345
+ * }
1346
+ * throw err;
1347
+ * }
1348
+ * ```
1349
+ */
1350
+ export declare class TxnodTonCommentParseFailedError extends TxnodError {
1351
+ readonly kind: "ton_comment_parse_failed";
1352
+ constructor(details: ProblemDetails);
1353
+ }
1354
+ /**
1355
+ * Thrown when the dashboard responds with `error_code: 'tonconnect_payload_expired'`.
1356
+ * The TON Connect handshake nonce expired (5-minute TTL); restart the wizard.
1357
+ *
1358
+ * @example
1359
+ * ```ts
1360
+ * import { TxnodTonConnectPayloadExpiredError } from '@txnod/sdk';
1361
+ *
1362
+ * try {
1363
+ * // SDK call that bubbles a /tonconnect/verify problem+json
1364
+ * } catch (err) {
1365
+ * if (err instanceof TxnodTonConnectPayloadExpiredError) {
1366
+ * console.error('TON Connect nonce expired', err.request_id);
1367
+ * }
1368
+ * }
1369
+ * ```
1370
+ */
1371
+ export declare class TxnodTonConnectPayloadExpiredError extends TxnodError {
1372
+ readonly kind: "tonconnect_payload_expired";
1373
+ constructor(details: ProblemDetails);
1374
+ }
1375
+ /**
1376
+ * Thrown when the dashboard responds with `error_code: 'tonconnect_payload_unknown'`.
1377
+ * The proof's payload field does not match any nonce on file for this operator.
1378
+ *
1379
+ * @example
1380
+ * ```ts
1381
+ * import { TxnodTonConnectPayloadUnknownError } from '@txnod/sdk';
1382
+ *
1383
+ * try {
1384
+ * // SDK call that bubbles a /tonconnect/verify problem+json
1385
+ * } catch (err) {
1386
+ * if (err instanceof TxnodTonConnectPayloadUnknownError) {
1387
+ * console.error('TON Connect nonce unknown', err.request_id);
1388
+ * }
1389
+ * }
1390
+ * ```
1391
+ */
1392
+ export declare class TxnodTonConnectPayloadUnknownError extends TxnodError {
1393
+ readonly kind: "tonconnect_payload_unknown";
1394
+ constructor(details: ProblemDetails);
1395
+ }
1396
+ /**
1397
+ * Thrown when the dashboard responds with `error_code: 'tonconnect_domain_mismatch'`.
1398
+ * The wallet attested to a different domain than the server's TXNOD_TONCONNECT_DOMAIN.
1399
+ *
1400
+ * @example
1401
+ * ```ts
1402
+ * import { TxnodTonConnectDomainMismatchError } from '@txnod/sdk';
1403
+ *
1404
+ * try {
1405
+ * // SDK call that bubbles a /tonconnect/verify problem+json
1406
+ * } catch (err) {
1407
+ * if (err instanceof TxnodTonConnectDomainMismatchError) {
1408
+ * console.error('TON Connect domain mismatch', err.request_id);
1409
+ * }
1410
+ * }
1411
+ * ```
1412
+ */
1413
+ export declare class TxnodTonConnectDomainMismatchError extends TxnodError {
1414
+ readonly kind: "tonconnect_domain_mismatch";
1415
+ constructor(details: ProblemDetails);
1416
+ }
1417
+ /**
1418
+ * Thrown when the dashboard responds with `error_code: 'tonconnect_timestamp_skew'`.
1419
+ * The proof timestamp is outside the 5-minute / +60s acceptance window.
1420
+ *
1421
+ * @example
1422
+ * ```ts
1423
+ * import { TxnodTonConnectTimestampSkewError } from '@txnod/sdk';
1424
+ *
1425
+ * try {
1426
+ * // SDK call that bubbles a /tonconnect/verify problem+json
1427
+ * } catch (err) {
1428
+ * if (err instanceof TxnodTonConnectTimestampSkewError) {
1429
+ * console.error('TON Connect timestamp skew', err.request_id);
1430
+ * }
1431
+ * }
1432
+ * ```
1433
+ */
1434
+ export declare class TxnodTonConnectTimestampSkewError extends TxnodError {
1435
+ readonly kind: "tonconnect_timestamp_skew";
1436
+ constructor(details: ProblemDetails);
1437
+ }
1438
+ /**
1439
+ * Thrown when the dashboard responds with `error_code: 'tonconnect_unknown_wallet_version'`.
1440
+ * The wallet's `walletStateInit` does not match any known TON wallet version.
1441
+ *
1442
+ * @example
1443
+ * ```ts
1444
+ * import { TxnodTonConnectUnknownWalletVersionError } from '@txnod/sdk';
1445
+ *
1446
+ * try {
1447
+ * // SDK call that bubbles a /tonconnect/verify problem+json
1448
+ * } catch (err) {
1449
+ * if (err instanceof TxnodTonConnectUnknownWalletVersionError) {
1450
+ * console.error('TON Connect unknown wallet version', err.request_id);
1451
+ * }
1452
+ * }
1453
+ * ```
1454
+ */
1455
+ export declare class TxnodTonConnectUnknownWalletVersionError extends TxnodError {
1456
+ readonly kind: "tonconnect_unknown_wallet_version";
1457
+ constructor(details: ProblemDetails);
1458
+ }
1459
+ /**
1460
+ * Thrown when the dashboard responds with `error_code: 'tonconnect_signature_invalid'`.
1461
+ * The Ed25519 verification of the ton_proof signature failed.
1462
+ *
1463
+ * @example
1464
+ * ```ts
1465
+ * import { TxnodTonConnectSignatureInvalidError } from '@txnod/sdk';
1466
+ *
1467
+ * try {
1468
+ * // SDK call that bubbles a /tonconnect/verify problem+json
1469
+ * } catch (err) {
1470
+ * if (err instanceof TxnodTonConnectSignatureInvalidError) {
1471
+ * console.error('TON Connect proof rejected', err.request_id);
1472
+ * }
1473
+ * }
1474
+ * ```
1475
+ */
1476
+ export declare class TxnodTonConnectSignatureInvalidError extends TxnodError {
1477
+ readonly kind: "tonconnect_signature_invalid";
1478
+ constructor(details: ProblemDetails);
1479
+ }
1480
+ /**
1481
+ * Thrown when the dashboard responds with `error_code: 'tonconnect_network_mismatch'`.
1482
+ * The wallet reported a chain id (`-239`/`-3`) that disagrees with the wizard's network.
1483
+ *
1484
+ * @example
1485
+ * ```ts
1486
+ * import { TxnodTonConnectNetworkMismatchError } from '@txnod/sdk';
1487
+ *
1488
+ * try {
1489
+ * // SDK call that bubbles a /tonconnect/verify problem+json
1490
+ * } catch (err) {
1491
+ * if (err instanceof TxnodTonConnectNetworkMismatchError) {
1492
+ * console.error('TON Connect network mismatch', err.request_id);
1493
+ * }
1494
+ * }
1495
+ * ```
1496
+ */
1497
+ export declare class TxnodTonConnectNetworkMismatchError extends TxnodError {
1498
+ readonly kind: "tonconnect_network_mismatch";
1499
+ constructor(details: ProblemDetails);
1500
+ }
1501
+ /**
1502
+ * Thrown when the server responds with `error_code: 'sandbox_project_required'`.
1503
+ * The endpoint accepts only sandbox projects and the targeted project's `kind`
1504
+ * is `production`. Story 37.3 will surface a richer SDK surface.
1505
+ *
1506
+ * @example
1507
+ * ```ts
1508
+ * import { TxnodSandboxProjectRequiredError } from '@txnod/sdk';
1509
+ *
1510
+ * try {
1511
+ * // SDK call that targets a sandbox-only endpoint
1512
+ * } catch (err) {
1513
+ * if (err instanceof TxnodSandboxProjectRequiredError) {
1514
+ * console.error('Sandbox-only endpoint', err.request_id);
1515
+ * }
1516
+ * }
1517
+ * ```
1518
+ */
1519
+ export declare class TxnodSandboxProjectRequiredError extends TxnodError {
1520
+ readonly kind: "sandbox_project_required";
1521
+ constructor(details: ProblemDetails);
1522
+ }
1523
+ /**
1524
+ * Thrown when the server responds with `error_code: 'production_project_required'`.
1525
+ * The endpoint accepts only production projects and the targeted project's
1526
+ * `kind` is `sandbox` or `testnet`.
1527
+ *
1528
+ * @example
1529
+ * ```ts
1530
+ * import { TxnodProductionProjectRequiredError } from '@txnod/sdk';
1531
+ *
1532
+ * try {
1533
+ * // SDK call that targets a production-only endpoint
1534
+ * } catch (err) {
1535
+ * if (err instanceof TxnodProductionProjectRequiredError) {
1536
+ * console.error('Production-only endpoint', err.request_id);
1537
+ * }
1538
+ * }
1539
+ * ```
1540
+ */
1541
+ export declare class TxnodProductionProjectRequiredError extends TxnodError {
1542
+ readonly kind: "production_project_required";
1543
+ constructor(details: ProblemDetails);
1544
+ }
1545
+ /**
1546
+ * Thrown when the server responds with `error_code: 'sandbox_per_operator_cap_reached'`.
1547
+ * The operator already has the maximum number of active sandbox projects.
1548
+ *
1549
+ * @example
1550
+ * ```ts
1551
+ * import { TxnodSandboxPerOperatorCapReachedError } from '@txnod/sdk';
1552
+ *
1553
+ * try {
1554
+ * // SDK call that creates a new sandbox project
1555
+ * } catch (err) {
1556
+ * if (err instanceof TxnodSandboxPerOperatorCapReachedError) {
1557
+ * console.error('sandbox cap reached', err.request_id);
1558
+ * }
1559
+ * }
1560
+ * ```
1561
+ */
1562
+ export declare class TxnodSandboxPerOperatorCapReachedError extends TxnodError {
1563
+ readonly kind: "sandbox_per_operator_cap_reached";
1564
+ constructor(details: ProblemDetails);
1565
+ }
1566
+ /**
1567
+ * Thrown when the server responds with `error_code: 'sandbox_key_against_production_project'`.
1568
+ * A sandbox API key (prefix `sk_sandbox_`) was used against a production project.
1569
+ *
1570
+ * @example
1571
+ * ```ts
1572
+ * import { TxnodSandboxKeyAgainstProductionProjectError } from '@txnod/sdk';
1573
+ *
1574
+ * try {
1575
+ * // SDK call with mixed-mode credentials
1576
+ * } catch (err) {
1577
+ * if (err instanceof TxnodSandboxKeyAgainstProductionProjectError) {
1578
+ * console.error('cross-mode rejected', err.request_id);
1579
+ * }
1580
+ * }
1581
+ * ```
1582
+ */
1583
+ export declare class TxnodSandboxKeyAgainstProductionProjectError extends TxnodError {
1584
+ readonly kind: "sandbox_key_against_production_project";
1585
+ constructor(details: ProblemDetails);
1586
+ }
1587
+ /**
1588
+ * Thrown when the server responds with `error_code: 'production_key_against_sandbox_project'`.
1589
+ * A production API key was used against a sandbox project.
1590
+ *
1591
+ * @example
1592
+ * ```ts
1593
+ * import { TxnodProductionKeyAgainstSandboxProjectError } from '@txnod/sdk';
1594
+ *
1595
+ * try {
1596
+ * // SDK call with mixed-mode credentials
1597
+ * } catch (err) {
1598
+ * if (err instanceof TxnodProductionKeyAgainstSandboxProjectError) {
1599
+ * console.error('cross-mode rejected', err.request_id);
1600
+ * }
1601
+ * }
1602
+ * ```
1603
+ */
1604
+ export declare class TxnodProductionKeyAgainstSandboxProjectError extends TxnodError {
1605
+ readonly kind: "production_key_against_sandbox_project";
1606
+ constructor(details: ProblemDetails);
1607
+ }
1608
+ /**
1609
+ * Thrown when the server responds with `error_code: 'sandbox_provisioning_failed'`.
1610
+ * The sandbox project could not be provisioned (transient or internal error).
1611
+ *
1612
+ * @example
1613
+ * ```ts
1614
+ * import { TxnodSandboxProvisioningFailedError } from '@txnod/sdk';
1615
+ *
1616
+ * try {
1617
+ * // SDK call that creates a new sandbox project
1618
+ * } catch (err) {
1619
+ * if (err instanceof TxnodSandboxProvisioningFailedError) {
1620
+ * console.error('sandbox provisioning failed', err.request_id);
1621
+ * }
1622
+ * }
1623
+ * ```
1624
+ */
1625
+ export declare class TxnodSandboxProvisioningFailedError extends TxnodError {
1626
+ readonly kind: "sandbox_provisioning_failed";
1627
+ constructor(details: ProblemDetails);
1628
+ }
1629
+ /**
1630
+ * Thrown when the server responds with `error_code: 'sandbox_invoice_transition_invalid'`.
1631
+ * A simulate-* call requested a state-machine transition forbidden by the
1632
+ * invoice's current status. Story 37.3 will surface a richer SDK surface.
1633
+ *
1634
+ * @example
1635
+ * ```ts
1636
+ * import { TxnodSandboxInvoiceTransitionInvalidError } from '@txnod/sdk';
1637
+ *
1638
+ * try {
1639
+ * // SDK call into a sandbox simulate-* endpoint
1640
+ * } catch (err) {
1641
+ * if (err instanceof TxnodSandboxInvoiceTransitionInvalidError) {
1642
+ * console.error('forbidden transition', err.request_id);
1643
+ * }
1644
+ * }
1645
+ * ```
1646
+ */
1647
+ export declare class TxnodSandboxInvoiceTransitionInvalidError extends TxnodError {
1648
+ readonly kind: "sandbox_invoice_transition_invalid";
1649
+ constructor(details: ProblemDetails);
1650
+ }
1651
+ /**
1652
+ * Thrown when the server responds with `error_code: 'sandbox_invoice_not_found'`.
1653
+ *
1654
+ * @example
1655
+ * ```ts
1656
+ * import { TxnodSandboxInvoiceNotFoundError } from '@txnod/sdk';
1657
+ *
1658
+ * try {
1659
+ * // SDK call into a sandbox simulate-* endpoint
1660
+ * } catch (err) {
1661
+ * if (err instanceof TxnodSandboxInvoiceNotFoundError) {
1662
+ * console.error('sandbox invoice missing', err.request_id);
1663
+ * }
1664
+ * }
1665
+ * ```
1666
+ */
1667
+ export declare class TxnodSandboxInvoiceNotFoundError extends TxnodError {
1668
+ readonly kind: "sandbox_invoice_not_found";
1669
+ constructor(details: ProblemDetails);
1670
+ }
1671
+ /**
1672
+ * Thrown when the server responds with `error_code: 'sandbox_invoice_terminal'`.
1673
+ *
1674
+ * @example
1675
+ * ```ts
1676
+ * import { TxnodSandboxInvoiceTerminalError } from '@txnod/sdk';
1677
+ *
1678
+ * try {
1679
+ * // SDK call into a sandbox simulate-* endpoint
1680
+ * } catch (err) {
1681
+ * if (err instanceof TxnodSandboxInvoiceTerminalError) {
1682
+ * console.error('invoice already terminal', err.request_id);
1683
+ * }
1684
+ * }
1685
+ * ```
1686
+ */
1687
+ export declare class TxnodSandboxInvoiceTerminalError extends TxnodError {
1688
+ readonly kind: "sandbox_invoice_terminal";
1689
+ constructor(details: ProblemDetails);
1690
+ }
1691
+ /**
1692
+ * Thrown when the server responds with `error_code: 'sandbox_rate_limit_exceeded'`.
1693
+ *
1694
+ * @example
1695
+ * ```ts
1696
+ * import { TxnodSandboxRateLimitExceededError } from '@txnod/sdk';
1697
+ *
1698
+ * try {
1699
+ * // SDK call into a sandbox simulate-* endpoint
1700
+ * } catch (err) {
1701
+ * if (err instanceof TxnodSandboxRateLimitExceededError) {
1702
+ * console.error('sandbox rate limited', err.request_id);
1703
+ * }
1704
+ * }
1705
+ * ```
1706
+ */
1707
+ export declare class TxnodSandboxRateLimitExceededError extends TxnodError {
1708
+ readonly kind: "sandbox_rate_limit_exceeded";
1709
+ constructor(details: ProblemDetails);
1710
+ }
1711
+ /**
1712
+ * Thrown when the server responds with `error_code: 'sandbox_reset_failed'`.
1713
+ *
1714
+ * @example
1715
+ * ```ts
1716
+ * import { TxnodSandboxResetFailedError } from '@txnod/sdk';
1717
+ *
1718
+ * try {
1719
+ * // SDK call to /api/v1/sandbox/{projectId}/reset
1720
+ * } catch (err) {
1721
+ * if (err instanceof TxnodSandboxResetFailedError) {
1722
+ * console.error('sandbox reset failed', err.request_id);
1723
+ * }
1724
+ * }
1725
+ * ```
1726
+ */
1727
+ export declare class TxnodSandboxResetFailedError extends TxnodError {
1728
+ readonly kind: "sandbox_reset_failed";
1729
+ constructor(details: ProblemDetails);
1730
+ }
1731
+ /**
1732
+ * Thrown when the server responds with `error_code: 'sandbox_delete_failed'`.
1733
+ *
1734
+ * @example
1735
+ * ```ts
1736
+ * import { TxnodSandboxDeleteFailedError } from '@txnod/sdk';
1737
+ *
1738
+ * try {
1739
+ * // SDK call to DELETE /api/v1/sandbox/{projectId}
1740
+ * } catch (err) {
1741
+ * if (err instanceof TxnodSandboxDeleteFailedError) {
1742
+ * console.error('sandbox delete failed', err.request_id);
1743
+ * }
1744
+ * }
1745
+ * ```
1746
+ */
1747
+ export declare class TxnodSandboxDeleteFailedError extends TxnodError {
1748
+ readonly kind: "sandbox_delete_failed";
1749
+ constructor(details: ProblemDetails);
1750
+ }
1751
+ /**
1752
+ * Thrown when the server responds with `error_code: 'sandbox_active_invoice_cap_reached'`.
1753
+ *
1754
+ * @example
1755
+ * ```ts
1756
+ * import { TxnodSandboxActiveInvoiceCapReachedError } from '@txnod/sdk';
1757
+ *
1758
+ * try {
1759
+ * // SDK call into POST /api/v1/invoices for a sandbox project
1760
+ * } catch (err) {
1761
+ * if (err instanceof TxnodSandboxActiveInvoiceCapReachedError) {
1762
+ * console.error('sandbox active-invoice cap reached', err.request_id);
1763
+ * }
1764
+ * }
1765
+ * ```
1766
+ */
1767
+ export declare class TxnodSandboxActiveInvoiceCapReachedError extends TxnodError {
1768
+ readonly kind: "sandbox_active_invoice_cap_reached";
1769
+ constructor(details: ProblemDetails);
1770
+ }
1771
+ /**
1772
+ * Thrown synchronously by the `TxnodClient` constructor when the configured
1773
+ * `apiSecret` carries the `sk_sandbox_` prefix AND `getSdkEnv()` resolves to
1774
+ * `'production'` AND the `iAcknowledgeRoutingRealCustomerFundsToSandboxAddresses`
1775
+ * override is not set or `false`.
1776
+ *
1777
+ * The error names which signal triggered the production detection so the
1778
+ * operator can fix the configuration source. Boot fails — no client instance
1779
+ * is returned.
1780
+ *
1781
+ * @example
1782
+ * ```ts
1783
+ * import { TxnodClient, TxnodSandboxKeyInProductionError } from '@txnod/sdk';
1784
+ *
1785
+ * try {
1786
+ * const client = new TxnodClient({
1787
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1788
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1789
+ * });
1790
+ * void client;
1791
+ * } catch (err) {
1792
+ * if (err instanceof TxnodSandboxKeyInProductionError) {
1793
+ * console.error(
1794
+ * 'sandbox secret in production environment',
1795
+ * err.signal,
1796
+ * err.secretPrefix,
1797
+ * );
1798
+ * process.exit(1);
1799
+ * }
1800
+ * throw err;
1801
+ * }
1802
+ * ```
1803
+ */
1804
+ export declare class TxnodSandboxKeyInProductionError extends TxnodError {
1805
+ readonly kind: "sandbox_key_in_production";
1806
+ readonly secretPrefix: 'sk_sandbox_';
1807
+ readonly detectedEnvironment: 'production';
1808
+ readonly signal: 'environment_option' | 'TXNOD_ENVIRONMENT' | 'NODE_ENV';
1809
+ constructor(signal: 'environment_option' | 'TXNOD_ENVIRONMENT' | 'NODE_ENV');
1810
+ }
1811
+ /**
1812
+ * Thrown synchronously by the `TxnodClient` constructor when the configured
1813
+ * `apiSecret` carries the `sk_sandbox_` prefix AND `getSdkEnv()` returns
1814
+ * `'unknown'` (no signal indicates whether the runtime is production).
1815
+ *
1816
+ * The fix: set the `environment` constructor option, the
1817
+ * `TXNOD_ENVIRONMENT` env var, or `NODE_ENV` to a recognised value.
1818
+ *
1819
+ * @example
1820
+ * ```ts
1821
+ * import { TxnodClient, TxnodEnvironmentUnknownError } from '@txnod/sdk';
1822
+ *
1823
+ * try {
1824
+ * const client = new TxnodClient({
1825
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1826
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1827
+ * environment: 'non-production',
1828
+ * });
1829
+ * void client;
1830
+ * } catch (err) {
1831
+ * if (err instanceof TxnodEnvironmentUnknownError) {
1832
+ * console.error('environment unknown for sandbox secret', err.message);
1833
+ * process.exit(1);
1834
+ * }
1835
+ * throw err;
1836
+ * }
1837
+ * ```
1838
+ */
1839
+ export declare class TxnodEnvironmentUnknownError extends TxnodError {
1840
+ readonly kind: "environment_unknown";
1841
+ constructor();
1842
+ }
1843
+ /**
1844
+ * Thrown synchronously by the `TxnodClient` constructor (and at
1845
+ * `refreshXpubConfig()` time) when one of the configured xpubs has a
1846
+ * testnet-shape prefix (`tpub`/`vpub`/`upub`) AND `getSdkEnv()` returns
1847
+ * `'production'`.
1848
+ *
1849
+ * Carve-outs documented on `assertNoTestnetXpubsInProduction`:
1850
+ * - Cardano (CIP-5 hrp does not distinguish testnet at account-pubkey level —
1851
+ * safety lives at the address-level NetworkId byte; guard is a no-op).
1852
+ * - TON (no xpub concept; guard is a no-op).
1853
+ * - EVM mainnet/testnet `xpub` ambiguity — testnet differentiation lives in
1854
+ * the address checksum, not the xpub itself; only `tpub`/`vpub`/`upub`
1855
+ * prefixes are reliably classified as testnet.
1856
+ *
1857
+ * @example
1858
+ * ```ts
1859
+ * import { TxnodClient, TxnodSandboxXpubInProductionError } from '@txnod/sdk';
1860
+ *
1861
+ * try {
1862
+ * const client = new TxnodClient({
1863
+ * projectId: process.env.TXNOD_PROJECT_ID!,
1864
+ * apiSecret: process.env.TXNOD_API_SECRET!,
1865
+ * });
1866
+ * void client;
1867
+ * } catch (err) {
1868
+ * if (err instanceof TxnodSandboxXpubInProductionError) {
1869
+ * console.error(
1870
+ * 'testnet xpub in production',
1871
+ * err.chain,
1872
+ * err.xpubPrefix,
1873
+ * );
1874
+ * process.exit(1);
1875
+ * }
1876
+ * throw err;
1877
+ * }
1878
+ * ```
1879
+ */
1880
+ export declare class TxnodSandboxXpubInProductionError extends TxnodError {
1881
+ readonly kind: "sandbox_xpub_in_production";
1882
+ readonly chain: Chain;
1883
+ readonly xpubPrefix: string;
1884
+ readonly detectedEnvironment: 'production';
1885
+ constructor(chain: Chain, xpubPrefix: string);
1886
+ }
1887
+ //# sourceMappingURL=errors.d.ts.map