@odatano/core 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/@cds-models/CardanoODataService/index.d.ts +66 -42
  2. package/@cds-models/CardanoODataService/index.d.ts.map +1 -1
  3. package/@cds-models/CardanoODataService/index.js.map +1 -1
  4. package/@cds-models/CardanoODataService/index.ts +11 -7
  5. package/@cds-models/odatano/cardano/index.d.ts +70 -46
  6. package/@cds-models/odatano/cardano/index.d.ts.map +1 -1
  7. package/@cds-models/odatano/cardano/index.js +2 -2
  8. package/@cds-models/odatano/cardano/index.js.map +1 -1
  9. package/@cds-models/odatano/cardano/index.ts +13 -13
  10. package/db/schema.cds +18 -18
  11. package/db/types.cds +3 -3
  12. package/package.json +17 -2
  13. package/src/index.d.ts +29 -0
  14. package/src/index.js +1 -0
  15. package/src/plugin.d.ts +2 -0
  16. package/src/plugin.js +6 -0
  17. package/srv/blockchain/backends/blockfrost-backend.d.ts +155 -0
  18. package/srv/blockchain/backends/blockfrost-backend.js +19 -8
  19. package/srv/blockchain/backends/cardano-backend.d.ts +182 -0
  20. package/srv/blockchain/backends/koios-backend.d.ts +171 -0
  21. package/srv/blockchain/backends/koios-backend.js +69 -27
  22. package/srv/blockchain/backends/ogmios-backend.d.ts +188 -0
  23. package/srv/blockchain/backends/ogmios-backend.js +175 -108
  24. package/srv/blockchain/cardano-client.d.ts +279 -0
  25. package/srv/blockchain/cardano-client.js +134 -33
  26. package/srv/blockchain/cardano-indexer.d.ts +330 -0
  27. package/srv/blockchain/cardano-indexer.js +51 -8
  28. package/srv/blockchain/cardano-tx-builder.d.ts +113 -0
  29. package/srv/blockchain/cardano-tx-builder.js +61 -54
  30. package/srv/blockchain/circuit-breaker.d.ts +37 -0
  31. package/srv/blockchain/circuit-breaker.js +11 -2
  32. package/srv/blockchain/request-coalescer.d.ts +23 -0
  33. package/srv/blockchain/signing/external-signer.d.ts +146 -0
  34. package/srv/blockchain/signing/external-signer.js +23 -0
  35. package/srv/blockchain/signing/hsm-signer.d.ts +74 -0
  36. package/srv/blockchain/signing/hsm-signer.js +20 -5
  37. package/srv/blockchain/signing/signature-verifier.d.ts +56 -0
  38. package/srv/blockchain/signing/signature-verifier.js +11 -2
  39. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +236 -0
  40. package/srv/blockchain/transaction-building/buildooor-tx.js +626 -187
  41. package/srv/blockchain/transaction-building/cardano-tx.d.ts +47 -0
  42. package/srv/cardano-service.cds +23 -3
  43. package/srv/cardano-service.d.ts +2 -0
  44. package/srv/cardano-service.js +25 -5
  45. package/srv/cardano-sign-service.d.ts +2 -0
  46. package/srv/cardano-sign-service.js +219 -131
  47. package/srv/cardano-tx-service.d.ts +12 -0
  48. package/srv/cardano-tx-service.js +152 -110
  49. package/srv/cbor/index.d.ts +2 -0
  50. package/srv/cbor/parse.d.ts +64 -0
  51. package/srv/server.d.ts +90 -0
  52. package/srv/server.js +27 -9
  53. package/srv/utils/backend-request-handler.d.ts +20 -0
  54. package/srv/utils/const.d.ts +183 -0
  55. package/srv/utils/const.js +13 -6
  56. package/srv/utils/error-codes.d.ts +79 -0
  57. package/srv/utils/errors.d.ts +259 -0
  58. package/srv/utils/errors.js +22 -7
  59. package/srv/utils/mappers.d.ts +260 -0
  60. package/srv/utils/mappers.js +34 -10
  61. package/srv/utils/plutus-placeholders.d.ts +35 -0
  62. package/srv/utils/plutus-placeholders.js +5 -15
  63. package/srv/utils/signing-helper.d.ts +23 -0
  64. package/srv/utils/signing-helper.js +5 -2
  65. package/srv/utils/tx-build-helper.d.ts +76 -0
  66. package/srv/utils/tx-build-helper.js +10 -37
  67. package/srv/utils/types.d.ts +653 -0
  68. package/srv/utils/validators.d.ts +145 -0
  69. package/srv/utils/validators.js +28 -1
  70. package/@cds-models/CardanoWatcherAdminService/index.js +0 -109
  71. package/@cds-models/CardanoWatcherAdminService/index.js.map +0 -1
  72. package/@cds-models/CardanoWatcherAdminService/index.ts +0 -263
  73. package/@cds-models/cds/outbox/index.js.map +0 -1
  74. package/@cds-models/cds/xt/MTXServices/index.js +0 -8
  75. package/@cds-models/cds/xt/MTXServices/index.js.map +0 -1
  76. package/@cds-models/cds/xt/MTXServices/index.ts +0 -4
  77. package/@cds-models/odatano/reeve/index.js +0 -77
  78. package/@cds-models/odatano/reeve/index.js.map +0 -1
  79. package/@cds-models/odatano/reeve/index.ts +0 -57
  80. package/@cds-models/odatano/transactions/index.js +0 -55
  81. package/@cds-models/odatano/transactions/index.js.map +0 -1
  82. package/@cds-models/odatano/transactions/index.ts +0 -18
  83. package/@cds-models/odatano/watch/index.js +0 -114
  84. package/@cds-models/odatano/watch/index.js.map +0 -1
  85. package/@cds-models/odatano/watch/index.ts +0 -110
  86. package/config/preview/cardano-node/alonzo-genesis.json +0 -196
  87. package/config/preview/cardano-node/byron-genesis.json +0 -117
  88. package/config/preview/cardano-node/config.json +0 -117
  89. package/config/preview/cardano-node/conway-genesis.json +0 -297
  90. package/config/preview/cardano-node/peer-snapshot.json +0 -890
  91. package/config/preview/cardano-node/shelley-genesis.json +0 -68
  92. package/config/preview/cardano-node/topology.json +0 -24
  93. package/output/sora/iter0_base.json +0 -32
  94. package/output/sora/iter0_base.mp4 +0 -0
  95. package/output/sora/logo_ref_1280x720.png +0 -0
  96. package/output/sora/odatano_full_logo_sky_ref_1280x720.png +0 -0
  97. package/output/sora/odatano_full_logo_transparent.png +0 -0
  98. package/output/sora/odatano_full_logo_transparent_dark.png +0 -0
  99. package/output/sora/odatano_full_logo_v4_8s.json +0 -32
  100. package/output/sora/odatano_full_logo_v4_8s.mp4 +0 -0
  101. package/output/sora/odatano_full_logo_v5_create.json +0 -15
  102. package/output/sora/odatano_full_logo_v5_fixes.json +0 -15
  103. package/output/sora/odatano_full_logo_v5_fixes.mp4 +0 -0
  104. package/output/sora/odatano_logo_v1.json +0 -32
  105. package/output/sora/odatano_logo_v1.mp4 +0 -0
  106. package/output/sora/odatano_o_only_clean.png +0 -0
  107. package/output/sora/odatano_o_sky_ref_1280x720.png +0 -0
  108. package/output/sora/odatano_o_sky_v2_8s.json +0 -32
  109. package/output/sora/odatano_o_sky_v2_8s.mp4 +0 -0
  110. package/output/sora/odatano_o_sky_v3_create.json +0 -15
  111. package/output/sora/odatano_o_sky_v3_splash_text.json +0 -15
  112. package/output/sora/odatano_o_sky_v3_splash_text.mp4 +0 -0
  113. package/output/sora/odatano_v6_composite_exact_logo.mp4 +0 -0
  114. package/output/sora/odatano_v6_composite_exact_logo_clean.mp4 +0 -0
  115. package/output/sora/odatano_v6_composite_exact_logo_final.mp4 +0 -0
  116. package/output/sora/odatano_v6_endframe.jpg +0 -0
  117. package/output/sora/odatano_v6_endframe_clean.jpg +0 -0
  118. package/output/sora/odatano_v6_endframe_final.jpg +0 -0
  119. package/output/sora/odatano_v7_1_earlylogo_fadeoldtext.mp4 +0 -0
  120. package/output/sora/odatano_v7_1_end.jpg +0 -0
  121. package/output/sora/odatano_v7_1_transition.jpg +0 -0
  122. package/output/sora/odatano_v7_2_original2d_keep_sky.mp4 +0 -0
  123. package/output/sora/odatano_v7_endframe_nobg.jpg +0 -0
  124. package/output/sora/odatano_v7_endframe_nobg_cleanend.jpg +0 -0
  125. package/output/sora/odatano_v7_spin_splash_logo_nobg.mp4 +0 -0
  126. package/output/sora/odatano_v7_spin_splash_logo_nobg_cleanend.mp4 +0 -0
  127. package/prod.mtaext +0 -17
  128. package/prod.mtaext.example +0 -27
  129. package/review.md +0 -42
  130. package/src/index.d.ts.map +0 -1
  131. package/src/index.js.map +0 -1
  132. package/src/plugin.d.ts.map +0 -1
  133. package/src/plugin.js.map +0 -1
  134. package/srv/blockchain/backends/blockfrost-backend.d.ts.map +0 -1
  135. package/srv/blockchain/backends/blockfrost-backend.js.map +0 -1
  136. package/srv/blockchain/backends/cardano-backend.d.ts.map +0 -1
  137. package/srv/blockchain/backends/cardano-backend.js.map +0 -1
  138. package/srv/blockchain/backends/koios-backend.d.ts.map +0 -1
  139. package/srv/blockchain/backends/koios-backend.js.map +0 -1
  140. package/srv/blockchain/backends/ogmios-backend.d.ts.map +0 -1
  141. package/srv/blockchain/backends/ogmios-backend.js.map +0 -1
  142. package/srv/blockchain/cardano-client.d.ts.map +0 -1
  143. package/srv/blockchain/cardano-client.js.map +0 -1
  144. package/srv/blockchain/cardano-indexer.d.ts.map +0 -1
  145. package/srv/blockchain/cardano-indexer.js.map +0 -1
  146. package/srv/blockchain/cardano-tx-builder.d.ts.map +0 -1
  147. package/srv/blockchain/cardano-tx-builder.js.map +0 -1
  148. package/srv/blockchain/circuit-breaker.d.ts.map +0 -1
  149. package/srv/blockchain/circuit-breaker.js.map +0 -1
  150. package/srv/blockchain/request-coalescer.d.ts.map +0 -1
  151. package/srv/blockchain/request-coalescer.js.map +0 -1
  152. package/srv/blockchain/signing/external-signer.d.ts.map +0 -1
  153. package/srv/blockchain/signing/external-signer.js.map +0 -1
  154. package/srv/blockchain/signing/hsm-signer.d.ts.map +0 -1
  155. package/srv/blockchain/signing/hsm-signer.js.map +0 -1
  156. package/srv/blockchain/signing/signature-verifier.d.ts.map +0 -1
  157. package/srv/blockchain/signing/signature-verifier.js.map +0 -1
  158. package/srv/blockchain/transaction-building/buildooor-tx.d.ts.map +0 -1
  159. package/srv/blockchain/transaction-building/buildooor-tx.js.map +0 -1
  160. package/srv/blockchain/transaction-building/cardano-tx.d.ts.map +0 -1
  161. package/srv/blockchain/transaction-building/cardano-tx.js.map +0 -1
  162. package/srv/cardano-service.d.ts.map +0 -1
  163. package/srv/cardano-service.js.map +0 -1
  164. package/srv/cardano-sign-service.d.ts.map +0 -1
  165. package/srv/cardano-sign-service.js.map +0 -1
  166. package/srv/cardano-tx-service.d.ts.map +0 -1
  167. package/srv/cardano-tx-service.js.map +0 -1
  168. package/srv/cbor/index.d.ts.map +0 -1
  169. package/srv/cbor/index.js.map +0 -1
  170. package/srv/cbor/parse.d.ts.map +0 -1
  171. package/srv/cbor/parse.js.map +0 -1
  172. package/srv/server.d.ts.map +0 -1
  173. package/srv/server.js.map +0 -1
  174. package/srv/utils/backend-request-handler.d.ts.map +0 -1
  175. package/srv/utils/backend-request-handler.js.map +0 -1
  176. package/srv/utils/const.d.ts.map +0 -1
  177. package/srv/utils/const.js.map +0 -1
  178. package/srv/utils/error-codes.d.ts.map +0 -1
  179. package/srv/utils/error-codes.js.map +0 -1
  180. package/srv/utils/errors.d.ts.map +0 -1
  181. package/srv/utils/errors.js.map +0 -1
  182. package/srv/utils/mappers.d.ts.map +0 -1
  183. package/srv/utils/mappers.js.map +0 -1
  184. package/srv/utils/plutus-placeholders.d.ts.map +0 -1
  185. package/srv/utils/plutus-placeholders.js.map +0 -1
  186. package/srv/utils/signing-helper.d.ts.map +0 -1
  187. package/srv/utils/signing-helper.js.map +0 -1
  188. package/srv/utils/tx-build-helper.d.ts.map +0 -1
  189. package/srv/utils/tx-build-helper.js.map +0 -1
  190. package/srv/utils/types.d.ts.map +0 -1
  191. package/srv/utils/types.js.map +0 -1
  192. package/srv/utils/validators.d.ts.map +0 -1
  193. package/srv/utils/validators.js.map +0 -1
package/srv/server.js CHANGED
@@ -121,7 +121,17 @@ async function initializeFromConfig(config, protocolParams, hsmConfig) {
121
121
  return;
122
122
  }
123
123
  hsmConfigInstance = hsmConfig;
124
- appContext = await initializeAppContext(config, protocolParams, hsmConfig);
124
+ try {
125
+ appContext = await initializeAppContext(config, protocolParams, hsmConfig);
126
+ bootstrapError = null;
127
+ }
128
+ catch (err) {
129
+ // Capture the cause so getAppContext() surfaces a structured 503 with diagnostics
130
+ // even in PLUGIN mode (src/plugin.ts only logs the error) — previously bootstrapError
131
+ // stayed null there and the failure showed up as a causeless "not initialized".
132
+ bootstrapError = err instanceof Error ? err : new Error(String(err));
133
+ throw err; // still propagate so the plugin/programmatic caller sees it
134
+ }
125
135
  }
126
136
  /**
127
137
  * Reset the application context (for testing only)
@@ -206,16 +216,18 @@ function loadConfigFromEnv() {
206
216
  const txBuilders = ['buildooor'];
207
217
  const primaryTimeout = cdsConfig.primaryTimeoutMs ?? process_1.env.PRIMARY_TIMEOUT_MS;
208
218
  const fallbackTimeout = cdsConfig.fallbackTimeoutMs ?? process_1.env.FALLBACK_TIMEOUT_MS;
209
- if (primaryTimeout && isNaN(Number(primaryTimeout))) {
219
+ // `!= null` not truthiness: a CDS-config numeric 0 is falsy, so `timeout && …`
220
+ // skipped the <=0 check and 0 then silently became the default via `Number(0)||default`.
221
+ if (primaryTimeout != null && isNaN(Number(primaryTimeout))) {
210
222
  throw new errors_1.ConfigError(`Invalid PRIMARY_TIMEOUT_MS "${primaryTimeout}". Must be a number.`);
211
223
  }
212
- if (primaryTimeout && Number(primaryTimeout) <= 0) {
224
+ if (primaryTimeout != null && Number(primaryTimeout) <= 0) {
213
225
  throw new errors_1.ConfigError(`Invalid PRIMARY_TIMEOUT_MS "${primaryTimeout}". Must be a positive number.`);
214
226
  }
215
- if (fallbackTimeout && isNaN(Number(fallbackTimeout))) {
227
+ if (fallbackTimeout != null && isNaN(Number(fallbackTimeout))) {
216
228
  throw new errors_1.ConfigError(`Invalid FALLBACK_TIMEOUT_MS "${fallbackTimeout}". Must be a number.`);
217
229
  }
218
- if (fallbackTimeout && Number(fallbackTimeout) <= 0) {
230
+ if (fallbackTimeout != null && Number(fallbackTimeout) <= 0) {
219
231
  throw new errors_1.ConfigError(`Invalid FALLBACK_TIMEOUT_MS "${fallbackTimeout}". Must be a positive number.`);
220
232
  }
221
233
  const blockfrostApiKey = cdsConfig.blockfrostApiKey || process_1.env.BLOCKFROST_API_KEY || '';
@@ -302,10 +314,15 @@ cds_1.default.on('served', async () => {
302
314
  logger.info('Skipping auto-initialization (SKIP_AUTO_INIT=true)');
303
315
  return;
304
316
  }
305
- const config = loadConfigFromEnv();
306
- const hsmConfig = loadHsmConfigFromEnv();
307
- hsmConfigInstance = hsmConfig;
317
+ // NOTE: config loading is INSIDE the try — loadConfigFromEnv/loadHsmConfigFromEnv
318
+ // throw ConfigError synchronously (missing HSM_PIN, bad slot, no requiresRole…).
319
+ // Outside the try that would crash the host app's bootstrap in plugin mode,
320
+ // violating the plugin contract ("never throw on failure").
321
+ let config;
308
322
  try {
323
+ config = loadConfigFromEnv();
324
+ const hsmConfig = loadHsmConfigFromEnv();
325
+ hsmConfigInstance = hsmConfig;
309
326
  appContext = await initializeAppContext(config, undefined, hsmConfig);
310
327
  bootstrapError = null;
311
328
  logger.info('CAP server bootstrap complete');
@@ -317,8 +334,9 @@ cds_1.default.on('served', async () => {
317
334
  bootstrapError = err instanceof Error ? err : new Error(String(err));
318
335
  // Write to stderr directly so the cause stays visible even when test runners
319
336
  // suppress console.error (jest.setup.ts in this repo silences it).
337
+ const where = config ? `backends={${config.backends.join(',')}} network=${config.network}` : 'config load';
320
338
  const msg = err instanceof Error ? `${err.name}: ${err.message}\n${err.stack ?? ''}` : String(err);
321
- process.stderr.write(`[ODATANO] Failed to initialize blockchain components — backends={${config.backends.join(',')}} network=${config.network}\n${msg}\n`);
339
+ process.stderr.write(`[ODATANO] Failed to initialize blockchain components — ${where}\n${msg}\n`);
322
340
  logger.error('Failed to initialize blockchain components:', err);
323
341
  }
324
342
  });
@@ -0,0 +1,20 @@
1
+ import cds, { Request } from '@sap/cds';
2
+ /**
3
+ * BackendRequestHandler - Provides standardized handling for backend requests
4
+ */
5
+ /**
6
+ * BackendRequestHandler - Wraps a backend method call with standardized error handling
7
+ * @param fn - The async function to execute
8
+ * @param backendName - Name of the backend (for error context)
9
+ * @param resourceName - Name of the resource being accessed (e.g., "Transaction", "Address")
10
+ * @returns {Promise<T>} The result of the backend call or a normalized error
11
+ */
12
+ export declare function handleBackendRequest<T>(fn: () => Promise<T>, backendName: string): Promise<T>;
13
+ /**
14
+ * General request handler for CardanoService
15
+ * @param req - The incoming request
16
+ * @param handler - The async function containing business logic
17
+ * @returns {Promise<unknown>} The result of the handler or a mapped error response
18
+ */
19
+ export declare function handleRequest(req: Request, handler: (db: cds.Transaction) => Promise<unknown>): Promise<unknown>;
20
+ //# sourceMappingURL=backend-request-handler.d.ts.map
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Cardano protocol constants
3
+ */
4
+ export declare const CARDANO_DEFAULTS: {
5
+ /** Maximum ADA supply in lovelace (45 billion ADA) */
6
+ MAX_LOVELACE_SUPPLY: string;
7
+ /** Milliseconds per slot */
8
+ MS_PER_SLOT: number;
9
+ };
10
+ /**
11
+ * Network-specific epoch geometry, anchored at the Shelley transition:
12
+ * `epochStartSlot(epoch) = shelleyStartSlot + (epoch - shelleyStartEpoch) * slotsPerEpoch`.
13
+ * A single global SLOTS_PER_EPOCH is wrong twice over — preview uses 86 400 (1 day),
14
+ * and mainnet/preprod epochs are offset by their Byron era.
15
+ */
16
+ export declare const EPOCH_CONFIG_BY_NETWORK: {
17
+ readonly mainnet: {
18
+ readonly shelleyStartEpoch: 208;
19
+ readonly shelleyStartSlot: 4492800;
20
+ readonly slotsPerEpoch: 432000;
21
+ };
22
+ readonly preprod: {
23
+ readonly shelleyStartEpoch: 4;
24
+ readonly shelleyStartSlot: 86400;
25
+ readonly slotsPerEpoch: 432000;
26
+ };
27
+ readonly preview: {
28
+ readonly shelleyStartEpoch: 0;
29
+ readonly shelleyStartSlot: 0;
30
+ readonly slotsPerEpoch: 86400;
31
+ };
32
+ };
33
+ /**
34
+ * Default execution units for Plutus scripts
35
+ * Used when dynamic evaluation is not available
36
+ */
37
+ export declare const DEFAULT_EXECUTION_UNITS: {
38
+ /** Memory units for script execution */
39
+ mem: number;
40
+ /** CPU steps for script execution */
41
+ cpu: number;
42
+ };
43
+ /**
44
+ * High execution units for initial transaction build (before evaluation)
45
+ * Set higher than DEFAULT to ensure fee estimation is sufficient before actual evaluation
46
+ */
47
+ export declare const HIGH_EXECUTION_UNITS: {
48
+ /** Memory units - high for evaluation pass */
49
+ mem: number;
50
+ /** CPU steps - high for evaluation pass */
51
+ cpu: number;
52
+ };
53
+ /**
54
+ * Execution unit buffer — relative multiplier applied to evaluator output.
55
+ * Combined with ABS_* floors below so small validators also get a meaningful cushion.
56
+ */
57
+ export declare const EXECUTION_UNIT_BUFFER = 1.1;
58
+ /**
59
+ * Absolute ExUnits floor added on top of the relative multiplier.
60
+ *
61
+ * Rationale: validators that iterate reference inputs and decode inline CBOR
62
+ * datums (e.g. oracle-consuming mint policies) show a larger ScriptContext →
63
+ * ledger drift than the documented ~10k–30k CPU / ~50–100 mem band — real-world
64
+ * cases overshot a 50k/1k floor by ~27k CPU / ~56 mem, burning the submit fee.
65
+ * The floor is sized to cover reference-input + CBOR-decoding drift on top of
66
+ * the 10% relative multiplier; `max_tx_ex_units` still caps build-time totals,
67
+ * so oversizing here cannot push a tx past network limits — it only trades a
68
+ * few extra lovelace of fee for avoiding an opaque PlutusFailure on submit.
69
+ */
70
+ export declare const ABS_CPU_BUFFER = 200000;
71
+ export declare const ABS_MEM_BUFFER = 5000;
72
+ /**
73
+ * Transaction building constants
74
+ */
75
+ /** Collateral amount in lovelace (5 ADA) */
76
+ export declare const COLLATERAL_LOVELACE = 5000000n;
77
+ /** Fee buffer in lovelace (1 ADA) */
78
+ export declare const FEE_BUFFER_LOVELACE = 1000000n;
79
+ export declare const HRP: {
80
+ mainnet: {
81
+ addr: RegExp;
82
+ stake: RegExp;
83
+ };
84
+ preview: {
85
+ addr: RegExp;
86
+ stake: RegExp;
87
+ };
88
+ preprod: {
89
+ addr: RegExp;
90
+ stake: RegExp;
91
+ };
92
+ };
93
+ /**
94
+ * Input validation limits to prevent DoS attacks
95
+ */
96
+ /** Maximum JSON string length in bytes (1MB) */
97
+ export declare const MAX_JSON_SIZE = 1048576;
98
+ /** Maximum nesting depth for JSON objects/arrays */
99
+ export declare const MAX_DEPTH = 10;
100
+ /** Maximum number of keys in a JSON object */
101
+ export declare const MAX_KEYS = 100;
102
+ /** Maximum number of elements in a JSON array */
103
+ export declare const MAX_ARRAY_LENGTH = 1000;
104
+ /** Maximum length of a single string value */
105
+ export declare const MAX_STRING_LENGTH = 65536;
106
+ /** Maximum ech32 string length to prevent DoS */
107
+ export declare const BECH32_MAX_LENGTH = 2000;
108
+ /**
109
+ * Maximum hex length of transaction CBOR accepted by ParseTransactionCbor.
110
+ * Mainnet `maxTxSize` is currently 16 KiB; 64 KiB raw (= 128 KiB hex) leaves
111
+ * generous headroom for future protocol bumps and reference-script outputs
112
+ * while keeping the parser from being a memory-exhaustion vector.
113
+ */
114
+ export declare const MAX_TX_CBOR_HEX_LENGTH: number;
115
+ /** Maximum reasonable epoch number */
116
+ export declare const MAX_EPOCH = 100000;
117
+ /** Standard pool ID payload length */
118
+ export declare const POOL_ID_BYTES = 28;
119
+ /** Standard DRep ID payload length (1 byte type prefix + 28 byte key hash) */
120
+ export declare const DREP_ID_BYTES = 29;
121
+ /** Length of a hex-encoded Cardano policy ID (28 bytes = 56 hex chars) */
122
+ export declare const POLICY_ID_HEX_LENGTH = 56;
123
+ /** Minimum length of a full asset unit (policyId + at least 1 char assetName) */
124
+ export declare const MIN_FULL_ASSET_UNIT_LENGTH: number;
125
+ /** Length of a hex-encoded Ed25519 key hash (28 bytes = 56 hex chars) */
126
+ export declare const ED25519_KEY_HASH_HEX_LENGTH = 56;
127
+ /** Regex for validating Ed25519 key hash hex strings */
128
+ export declare const ED25519_KEY_HASH_REGEX: RegExp;
129
+ /** Minimum lovelace for a change output carrying native assets (2 ADA) */
130
+ export declare const MIN_CHANGE_LOVELACE = 2000000;
131
+ /**
132
+ * Shelley-era genesis parameters per network, used to construct Buildooor's
133
+ * GenesisInfos so `TxBuilder.posixToSlot()` can convert validity-window
134
+ * Posix ms into ledger slots. `slotLengthMs` is 1000 ms on all current networks.
135
+ */
136
+ export declare const GENESIS_INFOS_BY_NETWORK: {
137
+ readonly mainnet: {
138
+ readonly systemStartPosixMs: 1596491091000;
139
+ readonly slotLengthMs: 1000;
140
+ readonly startSlotNo: 4492800;
141
+ };
142
+ readonly preprod: {
143
+ readonly systemStartPosixMs: 1655683200000;
144
+ readonly slotLengthMs: 1000;
145
+ readonly startSlotNo: 0;
146
+ };
147
+ readonly preview: {
148
+ readonly systemStartPosixMs: 1666656000000;
149
+ readonly slotLengthMs: 1000;
150
+ readonly startSlotNo: 0;
151
+ };
152
+ };
153
+ /** Default validity-window start offset: `now - 2 min` to absorb clock skew. */
154
+ export declare const DEFAULT_VALIDITY_START_OFFSET_MS = 120000;
155
+ /** Default validity-window end offset: `now + 1 h` — generous enough for human-latency sign+submit flows. */
156
+ export declare const DEFAULT_VALIDITY_END_OFFSET_MS: number;
157
+ /** Max accepted digits in a Posix-ms string (13 digits covers Unix ms timestamps through ~Nov 2286). */
158
+ export declare const MAX_POSIX_MS_DIGITS = 13;
159
+ /**
160
+ * Generic 64-character hex string (used for block hashes and other 32-byte hex identifiers)
161
+ */
162
+ export declare const HEX_64_REGEX: RegExp;
163
+ /**
164
+ * Generic 56-character hex string — 28-byte hashes (Blake2b-224 / payment credential / script hash / pool key hash).
165
+ */
166
+ export declare const HEX_56_REGEX: RegExp;
167
+ /**
168
+ * Transaction hash Regex - 64-character hexadecimal string
169
+ */
170
+ export declare const TX_HASH_REGEX: RegExp;
171
+ /**
172
+ * Asset unit Regex - policy ID (56 hex chars) + asset name (0-128 hex chars)
173
+ */
174
+ export declare const ASSET_UNIT_REGEX: RegExp;
175
+ /**
176
+ * Pool ID Regex - bech32 with HRP "pool" and 28 bytes payload
177
+ */
178
+ export declare const POOL_ID_REGEX: RegExp;
179
+ /**
180
+ * DRep ID Regex - bech32 with HRP "drep" and 50-60 chars payload
181
+ */
182
+ export declare const DREP_ID_REGEX: RegExp;
183
+ //# sourceMappingURL=const.d.ts.map
@@ -1,17 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DREP_ID_REGEX = exports.POOL_ID_REGEX = exports.ASSET_UNIT_REGEX = exports.TX_HASH_REGEX = exports.HEX_56_REGEX = exports.HEX_64_REGEX = exports.MAX_POSIX_MS_DIGITS = exports.DEFAULT_VALIDITY_END_OFFSET_MS = exports.DEFAULT_VALIDITY_START_OFFSET_MS = exports.GENESIS_INFOS_BY_NETWORK = exports.MIN_CHANGE_LOVELACE = exports.ED25519_KEY_HASH_REGEX = exports.ED25519_KEY_HASH_HEX_LENGTH = exports.MIN_FULL_ASSET_UNIT_LENGTH = exports.POLICY_ID_HEX_LENGTH = exports.DREP_ID_BYTES = exports.POOL_ID_BYTES = exports.MAX_EPOCH = exports.MAX_TX_CBOR_HEX_LENGTH = exports.BECH32_MAX_LENGTH = exports.MAX_STRING_LENGTH = exports.MAX_ARRAY_LENGTH = exports.MAX_KEYS = exports.MAX_DEPTH = exports.MAX_JSON_SIZE = exports.HRP = exports.FEE_BUFFER_LOVELACE = exports.COLLATERAL_LOVELACE = exports.WITNESS_BUFFER_BYTES = exports.ABS_MEM_BUFFER = exports.ABS_CPU_BUFFER = exports.EXECUTION_UNIT_BUFFER = exports.HIGH_EXECUTION_UNITS = exports.DEFAULT_EXECUTION_UNITS = exports.CARDANO_DEFAULTS = void 0;
3
+ exports.DREP_ID_REGEX = exports.POOL_ID_REGEX = exports.ASSET_UNIT_REGEX = exports.TX_HASH_REGEX = exports.HEX_56_REGEX = exports.HEX_64_REGEX = exports.MAX_POSIX_MS_DIGITS = exports.DEFAULT_VALIDITY_END_OFFSET_MS = exports.DEFAULT_VALIDITY_START_OFFSET_MS = exports.GENESIS_INFOS_BY_NETWORK = exports.MIN_CHANGE_LOVELACE = exports.ED25519_KEY_HASH_REGEX = exports.ED25519_KEY_HASH_HEX_LENGTH = exports.MIN_FULL_ASSET_UNIT_LENGTH = exports.POLICY_ID_HEX_LENGTH = exports.DREP_ID_BYTES = exports.POOL_ID_BYTES = exports.MAX_EPOCH = exports.MAX_TX_CBOR_HEX_LENGTH = exports.BECH32_MAX_LENGTH = exports.MAX_STRING_LENGTH = exports.MAX_ARRAY_LENGTH = exports.MAX_KEYS = exports.MAX_DEPTH = exports.MAX_JSON_SIZE = exports.HRP = exports.FEE_BUFFER_LOVELACE = exports.COLLATERAL_LOVELACE = exports.ABS_MEM_BUFFER = exports.ABS_CPU_BUFFER = exports.EXECUTION_UNIT_BUFFER = exports.HIGH_EXECUTION_UNITS = exports.DEFAULT_EXECUTION_UNITS = exports.EPOCH_CONFIG_BY_NETWORK = exports.CARDANO_DEFAULTS = void 0;
4
4
  /**
5
5
  * Cardano protocol constants
6
6
  */
7
7
  exports.CARDANO_DEFAULTS = {
8
8
  /** Maximum ADA supply in lovelace (45 billion ADA) */
9
9
  MAX_LOVELACE_SUPPLY: '45000000000000000',
10
- /** Slots per epoch (mainnet/testnets) */
11
- SLOTS_PER_EPOCH: 432_000,
12
10
  /** Milliseconds per slot */
13
11
  MS_PER_SLOT: 1000,
14
12
  };
13
+ /**
14
+ * Network-specific epoch geometry, anchored at the Shelley transition:
15
+ * `epochStartSlot(epoch) = shelleyStartSlot + (epoch - shelleyStartEpoch) * slotsPerEpoch`.
16
+ * A single global SLOTS_PER_EPOCH is wrong twice over — preview uses 86 400 (1 day),
17
+ * and mainnet/preprod epochs are offset by their Byron era.
18
+ */
19
+ exports.EPOCH_CONFIG_BY_NETWORK = {
20
+ mainnet: { shelleyStartEpoch: 208, shelleyStartSlot: 4_492_800, slotsPerEpoch: 432_000 },
21
+ preprod: { shelleyStartEpoch: 4, shelleyStartSlot: 86_400, slotsPerEpoch: 432_000 },
22
+ preview: { shelleyStartEpoch: 0, shelleyStartSlot: 0, slotsPerEpoch: 86_400 },
23
+ };
15
24
  /**
16
25
  * Default execution units for Plutus scripts
17
26
  * Used when dynamic evaluation is not available
@@ -54,8 +63,6 @@ exports.ABS_MEM_BUFFER = 5_000;
54
63
  /**
55
64
  * Transaction building constants
56
65
  */
57
- /** Buffer for witness set CBOR overhead when signing adds ~44 bytes */
58
- exports.WITNESS_BUFFER_BYTES = 50;
59
66
  /** Collateral amount in lovelace (5 ADA) */
60
67
  exports.COLLATERAL_LOVELACE = 5000000n;
61
68
  /** Fee buffer in lovelace (1 ADA) */
@@ -134,7 +141,7 @@ exports.TX_HASH_REGEX = /^[a-f0-9]{64}$/;
134
141
  /**
135
142
  * Asset unit Regex - policy ID (56 hex chars) + asset name (0-128 hex chars)
136
143
  */
137
- exports.ASSET_UNIT_REGEX = /^[a-f0-9]{56}([a-f0-9]{2})*$/; // policy ID (56) + asset name (0-64 bytes -> 0-128 hex chars, even length)
144
+ exports.ASSET_UNIT_REGEX = /^[a-f0-9]{56}([a-f0-9]{2}){0,32}$/; // policy ID (56) + asset name (0-32 bytes per ledger rules -> 0-64 hex chars, even length; total ≤ 120 = String(120) key column)
138
145
  /**
139
146
  * Pool ID Regex - bech32 with HRP "pool" and 28 bytes payload
140
147
  */
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Error codes used throughout the ODATANO backend
3
+ */
4
+ export declare const ERROR_CODES: {
5
+ /**
6
+ * 400 – Invalid input
7
+ * Indicates that the input provided by the client is invalid (malformed address, invalid transaction hash, etc.)
8
+ */
9
+ readonly INVALID_INPUT: "ODATANO_INVALID_INPUT";
10
+ /**
11
+ * 404 – Data not found
12
+ * Indicates that the requested resource could not be found (Empty result set Address with no UTxOs, Transaction hash not found, etc.)
13
+ */
14
+ readonly NOT_FOUND: "ODATANO_NOT_FOUND";
15
+ /**
16
+ * 400 – Insufficient funds/assets
17
+ * Indicates that the address does not have enough funds or assets to complete the transaction
18
+ */
19
+ readonly INSUFFICIENT_FUNDS: "ODATANO_INSUFFICIENT_FUNDS";
20
+ /**
21
+ * 400 – Transaction validation failed
22
+ * Indicates that the transaction failed validation (wrong signature, tampered CBOR, etc.)
23
+ */
24
+ readonly TX_VALIDATION_FAILED: "ODATANO_TX_VALIDATION_FAILED";
25
+ /**
26
+ * 400 – Transaction CBOR parse failed
27
+ * Indicates that the provided transaction CBOR could not be decoded
28
+ * (malformed bytes, truncated, not a Cardano Conway tx). Distinct from
29
+ * TX_VALIDATION_FAILED which applies to decoded-but-invalid transactions.
30
+ */
31
+ readonly TX_PARSE_FAILED: "ODATANO_TX_PARSE_FAILED";
32
+ /**
33
+ * 400 – Plutus script validation failed
34
+ * Indicates that the ledger cleanly rejected the transaction due to script
35
+ * evaluation — e.g. PlutusFailure, CekError, overspent budget, script hash
36
+ * mismatch. Distinct from provider outages (503) and generic tx validation.
37
+ */
38
+ readonly SCRIPT_VALIDATION_FAILURE: "ODATANO_SCRIPT_VALIDATION_FAILURE";
39
+ /**
40
+ * 409 – Transaction already submitted
41
+ * Indicates that the transaction has already been submitted (duplicate/replay)
42
+ */
43
+ readonly TX_ALREADY_SUBMITTED: "ODATANO_TX_ALREADY_SUBMITTED";
44
+ /**
45
+ * 429 – Rate limiting
46
+ * indicates temporary unavailability
47
+ */
48
+ readonly PROVIDER_RATE_LIMITED: "ODATANO_PROVIDER_RATE_LIMITED";
49
+ /**
50
+ * 503 – Upstream / connectivity
51
+ * Indicates that the Cardano data provider is currently unavailable
52
+ */
53
+ readonly PROVIDER_UNAVAILABLE: "ODATANO_PROVIDER_UNAVAILABLE";
54
+ /**
55
+ * 500 – Internal fallback
56
+ * Indicates an unexpected internal error
57
+ */
58
+ readonly INTERNAL_ERROR: "ODATANO_INTERNAL_ERROR";
59
+ /**
60
+ * 503 – HSM unavailable
61
+ * Indicates the HSM device or session is not available
62
+ */
63
+ readonly HSM_UNAVAILABLE: "ODATANO_HSM_UNAVAILABLE";
64
+ /**
65
+ * 500 – HSM signing failed
66
+ * Indicates the HSM signing operation failed
67
+ */
68
+ readonly HSM_SIGNING_FAILED: "ODATANO_HSM_SIGNING_FAILED";
69
+ /**
70
+ * 400 – HSM not configured
71
+ * Indicates HSM signing was requested but HSM is not configured
72
+ */
73
+ readonly HSM_NOT_CONFIGURED: "ODATANO_HSM_NOT_CONFIGURED";
74
+ };
75
+ /**
76
+ * EnumType representing all possible error codes
77
+ */
78
+ export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
79
+ //# sourceMappingURL=error-codes.d.ts.map
@@ -0,0 +1,259 @@
1
+ import { type ErrorCode } from './error-codes';
2
+ import { Request } from '@sap/cds';
3
+ /**
4
+ * Backend Errors Implementation
5
+ * Defines typed errors for backend communication issues
6
+ */
7
+ /**
8
+ * BackendError Base class for all backend-related errors
9
+ */
10
+ export declare class BackendError extends Error {
11
+ readonly statusCode: number;
12
+ readonly code: ErrorCode;
13
+ readonly backendName?: string | undefined;
14
+ readonly originalError?: unknown | undefined;
15
+ readonly target?: string | undefined;
16
+ /** Constructor
17
+ * @param message error message string
18
+ * @param statusCode error status code
19
+ * @param code error code
20
+ * @param backendName name of the backend where the error originated
21
+ * @param originalError original error object
22
+ * @param target target resource (if applicable)
23
+ */
24
+ constructor(message: string, statusCode?: number, code?: ErrorCode, backendName?: string | undefined, originalError?: unknown | undefined, target?: string | undefined);
25
+ }
26
+ /**
27
+ * NotFoundError - Resource not found in backend (404)
28
+ * This is NOT a provider error - it's a valid response indicating the resource doesn't exist
29
+ * Examples: transaction hash not found, address has no UTxOs
30
+ */
31
+ export declare class NotFoundError extends BackendError {
32
+ /** Constructor
33
+ * @param resource name of the resource that was not found
34
+ * @param backendName name of the backend where the error originated
35
+ * @param originalError original error object
36
+ */
37
+ constructor(resource: string, backendName?: string, originalError?: unknown);
38
+ }
39
+ /**
40
+ * TransactionValidationError - Transaction failed validation (400)
41
+ * Indicates that the transaction failed validation checks
42
+ * Examples: wrong signature, tampered CBOR, invalid witnesses
43
+ */
44
+ export declare class TransactionValidationError extends BackendError {
45
+ /** Constructor
46
+ * @param message detailed validation failure message
47
+ * @param originalError original error object
48
+ * @param code optional override (e.g. `TX_PARSE_FAILED` for CBOR decode failures);
49
+ * defaults to `TX_VALIDATION_FAILED`.
50
+ */
51
+ constructor(message: string, originalError?: unknown, code?: ErrorCode);
52
+ }
53
+ /**
54
+ * ScriptValidationError - Plutus script validation failed on the ledger (400)
55
+ * Distinguishes a clean ledger rejection (PlutusFailure, CekError, overspent
56
+ * budget, script hash mismatch) from provider outages (503). The transaction
57
+ * was well-formed enough to reach phase-2 validation — retrying against a
58
+ * different provider will not help; the tx shape itself is the problem.
59
+ */
60
+ export declare class ScriptValidationError extends BackendError {
61
+ /** Constructor
62
+ * @param message detailed script failure message (typically from ledger)
63
+ * @param originalError original error object
64
+ */
65
+ constructor(message: string, originalError?: unknown);
66
+ }
67
+ /**
68
+ * TransactionAlreadySubmittedError - Transaction already exists (409)
69
+ * Indicates that the transaction has already been submitted (duplicate/replay)
70
+ * Examples: same txHash already in mempool or on chain
71
+ */
72
+ export declare class TransactionAlreadySubmittedError extends BackendError {
73
+ readonly txHash: string;
74
+ /** Constructor
75
+ * @param txHash the transaction hash that was already submitted
76
+ * @param originalError original error object
77
+ */
78
+ constructor(txHash: string, originalError?: unknown);
79
+ }
80
+ /**
81
+ * InsufficientFundsError - Not enough funds or assets available (400)
82
+ * Indicates that the address does not have enough of a specific asset to complete the transaction
83
+ * Examples: trying to send more ADA than available, not enough native tokens
84
+ */
85
+ export declare class InsufficientFundsError extends BackendError {
86
+ readonly assetUnit: string;
87
+ readonly required: bigint;
88
+ readonly available: bigint;
89
+ /** Constructor
90
+ * @param assetUnit the asset unit that is insufficient (e.g., "lovelace" or "policyId.assetName")
91
+ * @param required the required amount
92
+ * @param available the available amount
93
+ * @param originalError original error object
94
+ */
95
+ constructor(assetUnit: string, required: bigint, available: bigint, originalError?: unknown);
96
+ }
97
+ /**
98
+ * MixedAssetsError - UTxO contains mixed assets when pure ADA is required (400)
99
+ * Indicates that a UTxO contains native assets in addition to ADA, but the operation requires ADA-only UTxOs
100
+ */
101
+ export declare class MixedAssetsError extends BackendError {
102
+ readonly utxoRef: string;
103
+ readonly assets: string[];
104
+ /** Constructor
105
+ * @param utxoRef UTxO reference (txHash#outputIndex)
106
+ * @param assets list of non-ADA assets found in the UTxO
107
+ * @param originalError original error object
108
+ */
109
+ constructor(utxoRef: string, assets: string[], originalError?: unknown);
110
+ }
111
+ /**
112
+ * ProviderUnavailableError - Provider unavailable or timeout (503)
113
+ * Indicates a temporary issue - retrying may help
114
+ * Examples: network timeout, 5xx errors, service down
115
+ */
116
+ export declare class ProviderUnavailableError extends BackendError {
117
+ /** Constructor
118
+ * @param message error message string
119
+ * @param backendName name of the backend where the error originated
120
+ * @param timeoutMs optional timeout duration in milliseconds
121
+ * @param originalError original error object
122
+ */
123
+ constructor(message: string, backendName?: string, timeoutMs?: number, originalError?: unknown);
124
+ }
125
+ /**
126
+ * RateLimitError - Provider rate limit exceeded (429)
127
+ * Indicates too many requests - client should back off and retry later
128
+ * Examples: Blockfrost 10 req/sec limit, Koios tier limits
129
+ */
130
+ export declare class RateLimitError extends BackendError {
131
+ /** Constructor
132
+ * @param message error message string
133
+ * @param backendName name of the backend where the error originated
134
+ * @param retryAfter optional retry-after duration in seconds
135
+ * @param originalError original error object
136
+ */
137
+ constructor(message: string, backendName?: string, retryAfter?: number, originalError?: unknown);
138
+ }
139
+ /**
140
+ * AllBackendsFailedError - All backends failed
141
+ * Aggregates multiple backend errors and returns the most relevant status
142
+ */
143
+ export declare class AllBackendsFailedError extends BackendError {
144
+ readonly errors: BackendError[];
145
+ /** Constructor
146
+ * @param errors array of backend errors
147
+ * @param originalError original error object
148
+ */
149
+ constructor(errors: BackendError[], originalError?: unknown);
150
+ }
151
+ /**
152
+ * HttpErrorLike - Simplified interface for HTTP errors from various libraries
153
+ */
154
+ export interface HttpErrorLike {
155
+ message?: string;
156
+ code?: string;
157
+ status?: number;
158
+ response?: {
159
+ status?: number;
160
+ headers?: Record<string, unknown>;
161
+ data?: {
162
+ error?: string;
163
+ message?: string;
164
+ [k: string]: unknown;
165
+ };
166
+ };
167
+ [k: string]: unknown;
168
+ }
169
+ /**
170
+ * Utility functions to extract status and message from HttpErrorLike
171
+ * @param err error object
172
+ * @returns {number} status code
173
+ */
174
+ export declare function getErrorStatus(err: HttpErrorLike | unknown): number;
175
+ /**
176
+ * Utility functions to extract status and message from HttpErrorLike
177
+ * @param err error object
178
+ * @returns {string} error message
179
+ */
180
+ export declare function getErrorMessage(err: HttpErrorLike | unknown): string;
181
+ /**
182
+ * Normalizes any backend error into a typed BackendError
183
+ *
184
+ * Priority (checked in order):
185
+ * 1. TX Submission — Already submitted/duplicate → 409
186
+ * 2. TX Submission — Plutus script validation failure → 400 (ScriptValidationError)
187
+ * 3. TX Submission — Validation/Signature errors → 400
188
+ * 4. Message indicates "not found" → 404 (even if provider returns 5xx)
189
+ * 5. Rate limiting (status 429 or message patterns) → 429
190
+ * 6. Explicit 404 status → 404
191
+ * 7. 5xx errors → 503 (Provider unavailable, retry-able)
192
+ * 8. Other 4xx → 503
193
+ * 9. Unknown/network errors → 503 (default fallback)
194
+ */
195
+ export declare function normalizeBackendError(err: unknown, backendName?: string): BackendError;
196
+ /**
197
+ * HsmError - Error related to HSM operations (signing, session, key access)
198
+ * Indicates that the Hardware Security Module is unavailable or signing failed
199
+ */
200
+ export declare class HsmError extends BackendError {
201
+ constructor(message: string, statusCode?: number, code?: ErrorCode, originalError?: unknown);
202
+ }
203
+ /**
204
+ * ConfigError - Error in configuration settings
205
+ * Captures configuration-related issues
206
+ */
207
+ export declare class ConfigError extends Error {
208
+ constructor(message: string);
209
+ }
210
+ /**
211
+ * BackendInitError - Error initializing a specific backend
212
+ * Captures backend name and original error
213
+ */
214
+ export declare class BackendInitError extends BackendError {
215
+ constructor(backendName: string, originalError: unknown);
216
+ }
217
+ /**
218
+ * AllBackendsInitFailedError - All backends failed to initialize
219
+ * Aggregates multiple backend initialization errors
220
+ */
221
+ export declare class AllBackendsInitFailedError extends Error {
222
+ readonly errors: BackendInitError[];
223
+ constructor(errors: BackendInitError[]);
224
+ }
225
+ /**
226
+ * Function to reject requests with standardized error messages
227
+ * @param req - The incoming request
228
+ * @param ctx - Context string for the error
229
+ * @param message - Detailed error message
230
+ * @param target - Optional target resource
231
+ * @throws {BackendError} BackendError with 400 status code
232
+ */
233
+ export declare function rejectInvalid(req: Request, ctx: string, message: string, target?: string): never;
234
+ /**
235
+ * Function to reject requests for missing required fields
236
+ * @param req - The incoming request
237
+ * @param ctx - Context string for the error
238
+ * @param field - Name of the missing field
239
+ * @throws {BackendError} BackendError with 400 status code
240
+ */
241
+ export declare function rejectMissing(req: Request, ctx: string, field: string): never;
242
+ /**
243
+ * Validation error from validators.ts
244
+ */
245
+ interface ValidationError {
246
+ type: 'missing' | 'invalid';
247
+ field: string;
248
+ message: string;
249
+ }
250
+ /**
251
+ * Throw BackendError for the first validation error in the list
252
+ * @param req - The incoming request
253
+ * @param ctx - Context string for the error
254
+ * @param errors - Array of validation errors from validateTransactionInputs
255
+ * @throws {BackendError} if errors array is not empty
256
+ */
257
+ export declare function throwIfValidationErrors(req: Request, ctx: string, errors: ValidationError[]): void;
258
+ export {};
259
+ //# sourceMappingURL=errors.d.ts.map