@odatano/core 2.0.0-rc.2 → 2.0.0-rc.20

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 (132) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +251 -0
  2. package/@cds-models/CardanoAgentService/index.js +36 -0
  3. package/@cds-models/CardanoIndexerService/index.d.ts +139 -2
  4. package/@cds-models/CardanoIndexerService/index.js +18 -0
  5. package/@cds-models/CardanoODataService/index.d.ts +224 -0
  6. package/@cds-models/CardanoODataService/index.js +27 -0
  7. package/@cds-models/CardanoSignService/index.d.ts +5 -2
  8. package/@cds-models/CardanoTransactionService/index.d.ts +9 -9
  9. package/@cds-models/odatano/cardano/index.d.ts +316 -0
  10. package/@cds-models/odatano/cardano/index.js +33 -0
  11. package/README.md +195 -136
  12. package/db/schema.cds +2121 -1633
  13. package/package.json +179 -173
  14. package/src/index.d.ts +10 -10
  15. package/src/index.js +24 -14
  16. package/src/plugin.js +39 -52
  17. package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
  18. package/srv/blockchain/backends/blockfrost-backend.js +45 -158
  19. package/srv/blockchain/backends/cardano-backend.d.ts +78 -158
  20. package/srv/blockchain/backends/cardano-backend.js +14 -5
  21. package/srv/blockchain/backends/koios-backend.d.ts +126 -60
  22. package/srv/blockchain/backends/koios-backend.js +292 -202
  23. package/srv/blockchain/backends/ogmios-backend.d.ts +59 -96
  24. package/srv/blockchain/backends/ogmios-backend.js +241 -153
  25. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
  26. package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
  27. package/srv/blockchain/cardano-client.d.ts +50 -205
  28. package/srv/blockchain/cardano-client.js +80 -224
  29. package/srv/blockchain/cardano-indexer.d.ts +146 -244
  30. package/srv/blockchain/cardano-indexer.js +442 -285
  31. package/srv/blockchain/cardano-tx-builder.d.ts +19 -84
  32. package/srv/blockchain/cardano-tx-builder.js +21 -107
  33. package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
  34. package/srv/blockchain/crawler/certificate-backfill.js +150 -0
  35. package/srv/blockchain/crawler/crawler.d.ts +121 -53
  36. package/srv/blockchain/crawler/crawler.js +402 -82
  37. package/srv/blockchain/crawler/hooks.d.ts +3 -14
  38. package/srv/blockchain/crawler/index.d.ts +5 -0
  39. package/srv/blockchain/crawler/index.js +35 -7
  40. package/srv/blockchain/crawler/sync-state.d.ts +44 -28
  41. package/srv/blockchain/crawler/sync-state.js +115 -43
  42. package/srv/blockchain/crawler/utxo-set-import.d.ts +69 -0
  43. package/srv/blockchain/crawler/utxo-set-import.js +269 -0
  44. package/srv/blockchain/ledger-state.d.ts +80 -0
  45. package/srv/blockchain/ledger-state.js +383 -0
  46. package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
  47. package/srv/blockchain/signing/cose-verifier.js +6 -12
  48. package/srv/blockchain/signing/external-signer.d.ts +16 -113
  49. package/srv/blockchain/signing/external-signer.js +19 -122
  50. package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
  51. package/srv/blockchain/signing/hsm-signer.js +23 -63
  52. package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
  53. package/srv/blockchain/signing/signature-verifier.js +13 -54
  54. package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
  55. package/srv/blockchain/signing/submission-finalizer.js +16 -48
  56. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +71 -160
  57. package/srv/blockchain/transaction-building/buildooor-tx.js +185 -260
  58. package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
  59. package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
  60. package/srv/blockchain/wallet-worker/build-request.js +39 -23
  61. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
  62. package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
  63. package/srv/blockchain/wallet-worker/index.js +2 -8
  64. package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
  65. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  66. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
  67. package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
  68. package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
  69. package/srv/blockchain/wallet-worker/signers.js +3 -8
  70. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
  71. package/srv/blockchain/wallet-worker/wallet-worker.js +34 -90
  72. package/srv/cardano-agent-service.cds +146 -0
  73. package/srv/cardano-agent-service.d.ts +2 -0
  74. package/srv/cardano-agent-service.js +12 -0
  75. package/srv/cardano-indexer-service.cds +164 -73
  76. package/srv/cardano-indexer-service.js +156 -11
  77. package/srv/cardano-service.cds +45 -0
  78. package/srv/cardano-service.js +38 -96
  79. package/srv/cardano-sign-service.cds +200 -180
  80. package/srv/cardano-sign-service.js +55 -173
  81. package/srv/cardano-tx-service.cds +32 -26
  82. package/srv/cardano-tx-service.js +133 -195
  83. package/srv/cardano-worker-service.js +7 -15
  84. package/srv/server.d.ts +28 -86
  85. package/srv/server.js +95 -128
  86. package/srv/utils/agent-grants-config.d.ts +37 -0
  87. package/srv/utils/agent-grants-config.js +138 -0
  88. package/srv/utils/agent-grants.d.ts +262 -0
  89. package/srv/utils/agent-grants.js +914 -0
  90. package/srv/utils/agent-token-auth.d.ts +16 -0
  91. package/srv/utils/agent-token-auth.js +78 -0
  92. package/srv/utils/backend-request-handler.d.ts +2 -16
  93. package/srv/utils/backend-request-handler.js +3 -18
  94. package/srv/utils/collections.d.ts +4 -8
  95. package/srv/utils/collections.js +4 -8
  96. package/srv/utils/const.d.ts +19 -68
  97. package/srv/utils/const.js +20 -69
  98. package/srv/utils/crypto.d.ts +3 -12
  99. package/srv/utils/crypto.js +5 -18
  100. package/srv/utils/db-indexes.d.ts +25 -0
  101. package/srv/utils/db-indexes.js +89 -0
  102. package/srv/utils/db-sanitize.d.ts +27 -0
  103. package/srv/utils/db-sanitize.js +85 -0
  104. package/srv/utils/error-codes.d.ts +18 -73
  105. package/srv/utils/error-codes.js +17 -70
  106. package/srv/utils/errors.d.ts +34 -178
  107. package/srv/utils/errors.js +55 -217
  108. package/srv/utils/liveness.d.ts +16 -0
  109. package/srv/utils/liveness.js +41 -0
  110. package/srv/utils/mappers.d.ts +82 -210
  111. package/srv/utils/mappers.js +272 -293
  112. package/srv/utils/network-context.js +2 -11
  113. package/srv/utils/pg-order-nulls.d.ts +14 -0
  114. package/srv/utils/pg-order-nulls.js +57 -0
  115. package/srv/utils/plutus-placeholders.d.ts +6 -18
  116. package/srv/utils/plutus-placeholders.js +6 -20
  117. package/srv/utils/rate-limiter.d.ts +46 -0
  118. package/srv/utils/rate-limiter.js +116 -0
  119. package/srv/utils/service-events.d.ts +2 -22
  120. package/srv/utils/service-events.js +3 -23
  121. package/srv/utils/signing-helper.d.ts +3 -18
  122. package/srv/utils/signing-helper.js +10 -32
  123. package/srv/utils/tx-build-helper.d.ts +18 -92
  124. package/srv/utils/tx-build-helper.js +32 -123
  125. package/srv/utils/tx-request-parsers.d.ts +14 -20
  126. package/srv/utils/tx-request-parsers.js +33 -20
  127. package/srv/utils/tx-utils.d.ts +4 -23
  128. package/srv/utils/tx-utils.js +12 -41
  129. package/srv/utils/types.d.ts +112 -169
  130. package/srv/utils/types.js +2 -6
  131. package/srv/utils/validators.d.ts +19 -89
  132. package/srv/utils/validators.js +31 -138
@@ -11,28 +11,14 @@ const backend_request_handler_1 = require("./utils/backend-request-handler");
11
11
  const cbor_1 = require("./cbor");
12
12
  const { SELECT } = cds_1.default.ql;
13
13
  const logger = cds_1.default.log(`CardanoService`);
14
- /**
15
- * Upper bound of the temporal window opened by {@link widenTemporalWindow}.
16
- * Generous on purpose: it only has to outlast the slowest index-on-miss (chained
17
- * backend timeouts of several calls) within ONE request.
18
- */
14
+ /** Upper bound of the temporal window; must outlast the slowest index-on-miss of one request. */
19
15
  const TEMPORAL_WINDOW_SLACK_MS = 60 * 60 * 1000;
20
16
  /**
21
- * Let this request see temporal slices that IT writes during index-on-miss.
22
- *
23
- * CAP filters temporal entities (Pools, Assets, Dreps, Addresses, Accounts, …)
24
- * with `validFrom < $valid.to AND validTo > $valid.from`. The DB session reads
25
- * both bounds from the request's `_` bag (`VALID-FROM` / `VALID-TO`) when the
26
- * transaction begins (HANA) or on first use (sqlite) and otherwise defaults to
27
- * `now` / `now + 1ms` — a window that is closed long before the backend fetch
28
- * returns, so a slice stamped after the fetch would be invisible to the
29
- * `req.query` re-read that honours `$expand` / `$select` (KNOWN_ISSUES #13).
30
- *
31
- * Only the UPPER bound is moved. No slice is ever future-dated (every mapper
32
- * stamps `validFrom = now`), so the only additional rows this admits are the
33
- * ones this very request writes; expired rows stay hidden (`validTo >
34
- * $valid.from` is untouched). Explicit `sap-valid-*` query options are left
35
- * alone. Must run before the handler's first DB statement.
17
+ * Let this request see the temporal slices it writes during index-on-miss: CAP's temporal
18
+ * filter (`validFrom < $valid.to`) defaults to a `now`..`now+1ms` window fixed at transaction
19
+ * start, so a slice stamped after the backend fetch would be invisible to the `req.query`
20
+ * re-read. Only the upper bound moves; explicit `sap-valid-*` options are left alone.
21
+ * Must run before the handler's first DB statement.
36
22
  */
37
23
  function widenTemporalWindow(req) {
38
24
  const q = req.http?.req?.query;
@@ -41,9 +27,7 @@ function widenTemporalWindow(req) {
41
27
  const now = Date.now();
42
28
  const from = new Date(now).toISOString();
43
29
  const to = new Date(now + TEMPORAL_WINDOW_SLACK_MS).toISOString();
44
- // The DB session context is built from the context the transaction was opened
45
- // with — `req` for our `cds.tx(req)`, the root context if a generic handler got
46
- // there first — so stamp both bags.
30
+ // The DB session reads the bag of whichever context opened the transaction; stamp both.
47
31
  const r = req;
48
32
  for (const bag of new Set([r._, r.context?._])) {
49
33
  if (!bag)
@@ -53,43 +37,32 @@ function widenTemporalWindow(req) {
53
37
  }
54
38
  }
55
39
  /**
56
- * Factory: READ handler with index-on-miss behavior.
57
- * If a key is provided, checks cache first; indexes if missing — then runs the
58
- * client's own query so `$expand` / `$select` are honoured on the keyed branch
59
- * too (KNOWN_ISSUES #13: returning the bare row silently dropped them).
60
- * If no key, passes through to generic req.query.
40
+ * Factory: READ handler with index-on-miss. With a key, indexes on a cache miss and then
41
+ * runs the client's own query so `$expand` / `$select` apply; without a key, passes through.
61
42
  */
62
43
  function indexOnMissRead(entity, reqKeyField, validate, indexFn, options) {
63
44
  const dbKey = options?.entityKeyField || reqKeyField;
64
45
  const errMsg = options?.errorMessage || `Invalid ${reqKeyField} format`;
65
46
  return async (req) => {
66
47
  const key = req.data?.[reqKeyField];
67
- // explicit null/undefined check — `key &&` skipped validation for falsy keys
68
- // like epoch=0 or an empty string (the latter then hit the backend unvalidated)
48
+ // Explicit null check: falsy keys such as epoch=0 or '' must still be validated.
69
49
  if (key !== undefined && key !== null && validate && !validate(key))
70
50
  (0, errors_1.rejectInvalid)(req, dbKey, errMsg, reqKeyField);
71
51
  return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
72
52
  if (key !== undefined && key !== null) {
73
- widenTemporalWindow(req); // before the first DB statement — see doc comment
74
- // CAP temporal aspect auto-filters expired records (validTo < now → not returned)
53
+ widenTemporalWindow(req); // before the first DB statement
54
+ // The temporal aspect hides expired rows, so a miss here triggers a re-index.
75
55
  const existing = await db.run(SELECT.one.from(entity).where({ [dbKey]: key }));
76
- // Populate the row (+ compositions) on a miss, then let CAP run the client's
77
- // query — one extra SELECT per keyed read, but $expand/$select (and the
78
- // temporal filter of the projection) apply exactly as on the un-keyed path.
79
- const indexed = existing ? undefined : await indexFn(db, key);
80
- const result = await db.run(req.query);
81
- // Safety net: if the freshly written slice is still outside the session's
82
- // temporal window (widening had no effect, e.g. the transaction was already
83
- // open), degrade to the pre-#13 behaviour — bare row instead of a wrong 404.
84
- return result ?? indexed ?? existing;
56
+ if (!existing)
57
+ await indexFn(db, key);
58
+ // The client's query is the only authority on the result: never fall back to
59
+ // `existing`, or an excluding $filter / second key would yield a sibling row instead of 404.
85
60
  }
86
61
  return db.run(req.query);
87
62
  });
88
63
  };
89
64
  }
90
- /**
91
- * Factory: Action handler with required key validation and index-on-miss.
92
- */
65
+ /** Factory: action handler with required-key validation and index-on-miss. */
93
66
  function indexOnMissAction(actionName, entity, reqKeyField, validate, indexFn, options) {
94
67
  const dbKey = options?.entityKeyField || reqKeyField;
95
68
  const errMsg = options?.errorMessage || `Invalid ${reqKeyField} format`;
@@ -100,7 +73,7 @@ function indexOnMissAction(actionName, entity, reqKeyField, validate, indexFn, o
100
73
  if (!validate(key))
101
74
  (0, errors_1.rejectInvalid)(req, actionName, errMsg, reqKeyField);
102
75
  return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
103
- // CAP temporal aspect auto-filters expired records (validTo < now → not returned)
76
+ // The temporal aspect hides expired rows, so a miss here triggers a re-index.
104
77
  const existing = await db.run(SELECT.one.from(entity).where({ [dbKey]: key }));
105
78
  if (!existing)
106
79
  return await indexFn(db, key);
@@ -111,23 +84,14 @@ function indexOnMissAction(actionName, entity, reqKeyField, validate, indexFn, o
111
84
  // ---------------------------------------------------------------------------
112
85
  // Service Registration
113
86
  // ---------------------------------------------------------------------------
114
- /**
115
- * Cardano Service Implementation
116
- * Handles various Cardano blockchain data queries with index-on-miss behavior.
117
- */
87
+ /** CardanoODataService handlers: blockchain read queries with index-on-miss. */
118
88
  module.exports = (srv) => {
119
89
  logger.debug('Module loaded - registering handlers');
120
- // NOTE: for entities whose name is already plural-shaped (NetworkInformation,
121
- // TransactionMetadata, AssetHistory) cds-typer exports the SINGULAR class under the
122
- // plain name and the plural (entity-set) class with a trailing underscore. Handler
123
- // registration must use the plural class — under cds 10 registering `srv.on('READ',
124
- // <singular proxy>)` no longer matches incoming OData READs, so the generic CRUD
125
- // handler silently served those entities (empty results / 404 instead of
126
- // index-on-miss). All other names below already resolve to plural classes.
90
+ // For plural-shaped names (NetworkInformation, TransactionMetadata, AssetHistory) cds-typer
91
+ // exports the singular class under the plain name and the entity-set class with a trailing
92
+ // underscore. Handlers must register the entity-set class; a singular one never matches under cds 10.
127
93
  const { NetworkInformation_: NetworkInformation, Blocks, Epochs, Addresses, AddressAssets, AddressUTxOs, Transactions, TransactionMetadata_: TransactionMetadata, Pools, Accounts, Dreps, Assets, AssetHistory_: AssetHistory, LedgerProtocolParameters, AddressTransactions } = require('#cds-models/CardanoODataService');
128
- // Fail fast if a future edit reintroduces a SINGULAR class here (the cds-10 trap
129
- // above): a singular registration silently degrades to the generic CRUD handler.
130
- // Every cds-typer proxy carries an explicit is_singular marker we can assert on.
94
+ // Fail fast on a singular class: it would silently degrade to the generic CRUD handler.
131
95
  for (const [name, entity] of Object.entries({
132
96
  NetworkInformation, Blocks, Epochs, Addresses, AddressAssets, AddressUTxOs,
133
97
  Transactions, TransactionMetadata, Pools, Accounts, Dreps, Assets, AssetHistory,
@@ -139,7 +103,6 @@ module.exports = (srv) => {
139
103
  `plural entity-set class instead (e.g. '${name}_ as ${name}').`);
140
104
  }
141
105
  }
142
- // Helper: shorthand for indexer access
143
106
  const indexer = () => (0, server_1.getCardanoIndexer)();
144
107
  // ---------------------------------------------------------------------------
145
108
  // Network Information (singleton - no key field)
@@ -193,18 +156,13 @@ module.exports = (srv) => {
193
156
  srv.on('READ', Assets, indexOnMissRead(Assets, 'unit', validators_1.isAssetUnit, (db, u) => indexer().indexAsset(db, u), { errorMessage: 'Invalid asset unit format' }));
194
157
  srv.on('GetAssetInfo', indexOnMissAction('GetAssetInfo', Assets, 'unit', validators_1.isAssetUnit, (db, u) => indexer().indexAsset(db, u), { errorMessage: 'Invalid asset unit format' }));
195
158
  // ---------------------------------------------------------------------------
196
- // Asset History — read-through (always-fresh)
159
+ // Asset History
197
160
  // ---------------------------------------------------------------------------
198
- // Generic READ on AssetHistory is served from DB (no auto-index); consumers
199
- // must call GetAssetHistory(unit) first to seed entries for a given asset,
200
- // then page via $top/$skip on the AssetHistory entity.
161
+ // Generic READ is served from the DB only; GetAssetHistory(unit) seeds the rows.
201
162
  srv.on('READ', AssetHistory, async (req) => {
202
163
  return (0, backend_request_handler_1.handleRequest)(req, async (db) => db.run(req.query));
203
164
  });
204
- /**
205
- * Action: GetAssetHistory - Always-fresh fetch of recent mint/burn events.
206
- * Multi-backend: Koios preferred (block timestamps), Blockfrost fallback.
207
- */
165
+ // GetAssetHistory — always-fresh fetch of recent mint/burn events.
208
166
  srv.on('GetAssetHistory', async (req) => {
209
167
  const { unit, limit } = req.data;
210
168
  if (!unit)
@@ -212,7 +170,7 @@ module.exports = (srv) => {
212
170
  if (!(0, validators_1.isAssetUnit)(unit)) {
213
171
  return (0, errors_1.rejectInvalid)(req, 'GetAssetHistory', 'Invalid asset unit format', 'unit');
214
172
  }
215
- // clamp like GetLatestTransactionsByAddress — unbounded limits page the upstream backend indefinitely
173
+ // Clamp: an unbounded limit would page the upstream backend indefinitely.
216
174
  const effectiveLimit = Math.min(Math.max(typeof limit === 'number' ? limit : 100, 1), 100);
217
175
  return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
218
176
  return await indexer().indexAssetHistory(db, unit, effectiveLimit);
@@ -223,9 +181,7 @@ module.exports = (srv) => {
223
181
  // ---------------------------------------------------------------------------
224
182
  srv.on('READ', Addresses, indexOnMissRead(Addresses, 'address', validators_1.isValidBech32Address, (db, a) => indexer().indexAddress(db, a), { errorMessage: 'Invalid bech32 address format' }));
225
183
  srv.on('GetAddressByBech32', indexOnMissAction('GetAddressByBech32', Addresses, 'address', validators_1.isValidBech32Address, (db, a) => indexer().indexAddress(db, a), { errorMessage: 'Invalid bech32 address format' }));
226
- /**
227
- * Action: GetAssetsByAddress - indexes parent address if needed, then queries child assets.
228
- */
184
+ // GetAssetsByAddress — indexes the parent address if needed, then queries child assets.
229
185
  srv.on('GetAssetsByAddress', async (req) => {
230
186
  const { address } = req.data;
231
187
  if (!address)
@@ -237,7 +193,7 @@ module.exports = (srv) => {
237
193
  if (!existing)
238
194
  await indexer().indexAddress(db, address);
239
195
  const assets = await db.run(SELECT.from(AddressAssets).where({ address_address: address }));
240
- // Deduplicate temporal versions — keep latest validFrom per unit
196
+ // Keep the latest temporal slice per unit
241
197
  const seen = new Map();
242
198
  for (const asset of assets) {
243
199
  if (!seen.has(asset.unit) || asset.validFrom > seen.get(asset.unit).validFrom) {
@@ -247,9 +203,7 @@ module.exports = (srv) => {
247
203
  return Array.from(seen.values());
248
204
  });
249
205
  });
250
- /**
251
- * Action: GetUTxOsByAddress - indexes parent address if needed, then queries child UTxOs.
252
- */
206
+ // GetUTxOsByAddress — indexes the parent address if needed, then queries child UTxOs.
253
207
  srv.on('GetUTxOsByAddress', async (req) => {
254
208
  const { address } = req.data;
255
209
  if (!address)
@@ -259,14 +213,9 @@ module.exports = (srv) => {
259
213
  return (0, backend_request_handler_1.handleRequest)(req, async (db) => {
260
214
  const existing = await db.run(SELECT.from(AddressUTxOs).where({ address_address: address }));
261
215
  if (!existing || existing.length === 0) {
262
- // No valid cached data — re-index fresh (UPSERT is idempotent, no DELETE needed).
263
- // Prefer getAddress-based full indexing (richer: also captures address detail and
264
- // returns NotFound for unknown addresses on Blockfrost/Koios). But GetUTxOsByAddress
265
- // only needs the UTxO set, which Ogmios serves via getAddressUtxos even though it
266
- // doesn't support getAddress — so when NO configured backend can serve getAddress
267
- // (AllBackendsFailedError with zero collected errors == every backend skipped it),
268
- // fall back to a UTxO-only index instead of failing. getAddress is indexAddress's
269
- // first call, so nothing is persisted before this throws — the fallback is clean.
216
+ // Prefer the full address index; when no configured backend supports getAddress
217
+ // (AllBackendsFailedError with zero collected errors, e.g. Ogmios only), fall back to a
218
+ // UTxO-only index. getAddress is indexAddress's first call, so nothing is persisted before.
270
219
  try {
271
220
  await indexer().indexAddress(db, address);
272
221
  }
@@ -281,7 +230,7 @@ module.exports = (srv) => {
281
230
  const fresh = await db.run(SELECT.from(AddressUTxOs).where({ address_address: address }));
282
231
  return fresh;
283
232
  }
284
- // Deduplicate temporal versions — keep latest validFrom per hash+index
233
+ // Keep the latest temporal slice per hash#index
285
234
  const seen = new Map();
286
235
  for (const utxo of existing) {
287
236
  const key = `${utxo.hash}#${utxo.index}`;
@@ -292,12 +241,8 @@ module.exports = (srv) => {
292
241
  return Array.from(seen.values());
293
242
  });
294
243
  });
295
- /**
296
- * Action: GetUTxOsByCredential - Koios-only credential-keyed UTxO query.
297
- * Always-fresh (no cache check) — credential queries serve dApp state-read use
298
- * cases (Indigo CDPs, Liqwid positions) that need current blockchain state.
299
- * Throws ProviderUnavailableError if Koios backend is not configured.
300
- */
244
+ // GetUTxOsByCredential — Koios-only, always-fresh credential-keyed UTxO query
245
+ // (dApp state reads need current data). ProviderUnavailableError without Koios.
301
246
  srv.on('GetUTxOsByCredential', async (req) => {
302
247
  const { credential } = req.data;
303
248
  if (!credential)
@@ -318,10 +263,7 @@ module.exports = (srv) => {
318
263
  // Transaction Metadata
319
264
  // ---------------------------------------------------------------------------
320
265
  srv.on('READ', TransactionMetadata, indexOnMissRead(TransactionMetadata, 'tx_hash', validators_1.isTxHash, (db, h) => indexer().indexTransactionMetadata(db, h), { errorMessage: 'Invalid transaction hash format' }));
321
- /**
322
- * Action: GetMetadataByTxHash - returns multiple metadata rows (uses SELECT.from, not SELECT.one).
323
- * Takes camelCase `txHash` like every other action (renamed from `tx_hash` in 1.9.4).
324
- */
266
+ // GetMetadataByTxHash — returns all metadata rows of a transaction.
325
267
  srv.on('GetMetadataByTxHash', async (req) => {
326
268
  const { txHash } = req.data;
327
269
  if (!txHash)
@@ -351,7 +293,7 @@ module.exports = (srv) => {
351
293
  return (0, backend_request_handler_1.handleRequest)(req, (db) => indexer().indexProtocolParameters(db));
352
294
  });
353
295
  // ---------------------------------------------------------------------------
354
- // Transaction CBOR parsing (pure utility — no backend / DB touch)
296
+ // Transaction CBOR parsing (pure; no backend or DB access)
355
297
  // ---------------------------------------------------------------------------
356
298
  srv.on('ParseTransactionCbor', async (req) => {
357
299
  const { cbor } = req.data;