@odatano/core 2.0.0-rc.43 → 2.0.0-rc.45

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 (171) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +0 -46
  2. package/@cds-models/CardanoBackendService/index.d.ts +0 -10
  3. package/@cds-models/CardanoIndexerService/index.d.ts +36 -20
  4. package/@cds-models/CardanoIndexerService/index.js +4 -0
  5. package/@cds-models/CardanoODataService/index.d.ts +19 -47
  6. package/@cds-models/CardanoSignService/index.d.ts +3 -18
  7. package/@cds-models/CardanoTransactionService/index.d.ts +9 -31
  8. package/@cds-models/CardanoWorkerService/index.d.ts +3 -19
  9. package/@cds-models/index.d.ts +17 -0
  10. package/@cds-models/index.js +2 -0
  11. package/@cds-models/odatano/cardano/index.d.ts +1 -34
  12. package/README.md +6 -6
  13. package/db/schema.cds +29 -44
  14. package/db/types.cds +22 -5
  15. package/package.json +3 -1
  16. package/scripts/migrate-slot-leader.mjs +3 -11
  17. package/scripts/migrate-txseq.mjs +3 -12
  18. package/src/index.d.ts +0 -4
  19. package/src/index.js +3 -5
  20. package/src/plugin.js +4 -8
  21. package/srv/blockchain/asset-decimals.d.ts +7 -0
  22. package/srv/blockchain/asset-decimals.js +91 -0
  23. package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -10
  24. package/srv/blockchain/backends/blockfrost-backend.js +15 -21
  25. package/srv/blockchain/backends/cardano-backend.d.ts +12 -71
  26. package/srv/blockchain/backends/koios-backend.d.ts +14 -147
  27. package/srv/blockchain/backends/koios-backend.js +40 -164
  28. package/srv/blockchain/backends/odatano-backend.d.ts +1 -11
  29. package/srv/blockchain/backends/odatano-backend.js +11 -12
  30. package/srv/blockchain/backends/ogmios-backend.d.ts +13 -160
  31. package/srv/blockchain/backends/ogmios-backend.js +48 -175
  32. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +2 -18
  33. package/srv/blockchain/backends/ogmios-frame-guard.js +8 -20
  34. package/srv/blockchain/cardano-client.d.ts +12 -80
  35. package/srv/blockchain/cardano-client.js +36 -88
  36. package/srv/blockchain/cardano-indexer.d.ts +12 -192
  37. package/srv/blockchain/cardano-indexer.js +132 -222
  38. package/srv/blockchain/cardano-tx-builder.d.ts +1 -28
  39. package/srv/blockchain/cardano-tx-builder.js +17 -34
  40. package/srv/blockchain/circuit-breaker.d.ts +1 -13
  41. package/srv/blockchain/circuit-breaker.js +5 -15
  42. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +15 -0
  43. package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
  44. package/srv/blockchain/crawler/certificate-backfill.d.ts +0 -17
  45. package/srv/blockchain/crawler/certificate-backfill.js +8 -22
  46. package/srv/blockchain/crawler/crawler.d.ts +16 -93
  47. package/srv/blockchain/crawler/crawler.js +85 -160
  48. package/srv/blockchain/crawler/credential-backfill.d.ts +0 -9
  49. package/srv/blockchain/crawler/credential-backfill.js +6 -6
  50. package/srv/blockchain/crawler/hooks.d.ts +1 -5
  51. package/srv/blockchain/crawler/index.d.ts +0 -12
  52. package/srv/blockchain/crawler/index.js +6 -20
  53. package/srv/blockchain/crawler/sync-state.d.ts +6 -44
  54. package/srv/blockchain/crawler/sync-state.js +18 -53
  55. package/srv/blockchain/crawler/transaction-backfill.d.ts +0 -11
  56. package/srv/blockchain/crawler/transaction-backfill.js +11 -30
  57. package/srv/blockchain/crawler/utxo-set-import.d.ts +1 -30
  58. package/srv/blockchain/crawler/utxo-set-import.js +27 -53
  59. package/srv/blockchain/ledger-state.d.ts +10 -54
  60. package/srv/blockchain/ledger-state.js +11 -27
  61. package/srv/blockchain/pending-spends.d.ts +0 -12
  62. package/srv/blockchain/pending-spends.js +4 -12
  63. package/srv/blockchain/request-coalescer.d.ts +2 -16
  64. package/srv/blockchain/request-coalescer.js +2 -16
  65. package/srv/blockchain/signing/cose-verifier.d.ts +0 -9
  66. package/srv/blockchain/signing/cose-verifier.js +4 -10
  67. package/srv/blockchain/signing/external-signer.d.ts +1 -4
  68. package/srv/blockchain/signing/external-signer.js +2 -8
  69. package/srv/blockchain/signing/hsm-signer.d.ts +6 -18
  70. package/srv/blockchain/signing/hsm-signer.js +16 -28
  71. package/srv/blockchain/signing/signature-verifier.d.ts +1 -8
  72. package/srv/blockchain/signing/signature-verifier.js +9 -19
  73. package/srv/blockchain/signing/submission-finalizer.d.ts +10 -16
  74. package/srv/blockchain/signing/submission-finalizer.js +48 -19
  75. package/srv/blockchain/stored-chain.d.ts +1 -14
  76. package/srv/blockchain/stored-chain.js +3 -8
  77. package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +0 -4
  78. package/srv/blockchain/transaction-building/buildooor-fee-patch.js +4 -9
  79. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +7 -150
  80. package/srv/blockchain/transaction-building/buildooor-tx.js +91 -196
  81. package/srv/blockchain/transaction-building/caller-datums.d.ts +0 -14
  82. package/srv/blockchain/transaction-building/caller-datums.js +3 -9
  83. package/srv/blockchain/transaction-building/cardano-tx.d.ts +1 -4
  84. package/srv/blockchain/wallet-worker/build-request.d.ts +0 -5
  85. package/srv/blockchain/wallet-worker/build-request.js +6 -9
  86. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -23
  87. package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -20
  88. package/srv/blockchain/wallet-worker/index.d.ts +1 -1
  89. package/srv/blockchain/wallet-worker/index.js +3 -5
  90. package/srv/blockchain/wallet-worker/job-store.d.ts +15 -65
  91. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  92. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -10
  93. package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -12
  94. package/srv/blockchain/wallet-worker/signers.d.ts +3 -11
  95. package/srv/blockchain/wallet-worker/signers.js +3 -6
  96. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +3 -21
  97. package/srv/blockchain/wallet-worker/wallet-worker.js +47 -54
  98. package/srv/cardano-agent-service.cds +123 -146
  99. package/srv/cardano-agent-service.js +2 -5
  100. package/srv/cardano-backend-service.cds +10 -17
  101. package/srv/cardano-backend-service.js +7 -12
  102. package/srv/cardano-indexer-service.cds +35 -37
  103. package/srv/cardano-indexer-service.d.ts +5 -1
  104. package/srv/cardano-indexer-service.js +64 -33
  105. package/srv/cardano-service.cds +56 -40
  106. package/srv/cardano-service.js +42 -69
  107. package/srv/cardano-sign-service.cds +14 -23
  108. package/srv/cardano-sign-service.js +18 -24
  109. package/srv/cardano-tx-service.cds +27 -29
  110. package/srv/cardano-tx-service.js +60 -122
  111. package/srv/cardano-worker-service.cds +109 -125
  112. package/srv/cardano-worker-service.js +21 -31
  113. package/srv/cbor/cip68.d.ts +13 -0
  114. package/srv/cbor/cip68.js +56 -0
  115. package/srv/cbor/index.d.ts +1 -0
  116. package/srv/cbor/index.js +6 -1
  117. package/srv/cbor/parse.d.ts +3 -18
  118. package/srv/cbor/parse.js +2 -7
  119. package/srv/cbor/plutus-data-json.d.ts +0 -4
  120. package/srv/server.d.ts +5 -36
  121. package/srv/server.js +30 -51
  122. package/srv/utils/agent-grants-config.d.ts +0 -18
  123. package/srv/utils/agent-grants-config.js +6 -13
  124. package/srv/utils/agent-grants.d.ts +14 -68
  125. package/srv/utils/agent-grants.js +42 -60
  126. package/srv/utils/agent-token-auth.d.ts +0 -5
  127. package/srv/utils/agent-token-auth.js +2 -5
  128. package/srv/utils/backend-request-handler.d.ts +1 -1
  129. package/srv/utils/collections.d.ts +1 -4
  130. package/srv/utils/collections.js +1 -4
  131. package/srv/utils/const.d.ts +0 -18
  132. package/srv/utils/const.js +7 -18
  133. package/srv/utils/crypto.js +3 -5
  134. package/srv/utils/db-indexes.d.ts +2 -0
  135. package/srv/utils/db-indexes.js +22 -9
  136. package/srv/utils/db-sanitize.d.ts +1 -8
  137. package/srv/utils/db-sanitize.js +3 -8
  138. package/srv/utils/epoch-slots.d.ts +1 -8
  139. package/srv/utils/epoch-slots.js +3 -8
  140. package/srv/utils/error-codes.d.ts +0 -4
  141. package/srv/utils/error-codes.js +2 -4
  142. package/srv/utils/errors.d.ts +2 -22
  143. package/srv/utils/errors.js +13 -27
  144. package/srv/utils/liveness.d.ts +0 -4
  145. package/srv/utils/liveness.js +2 -4
  146. package/srv/utils/mappers.d.ts +0 -37
  147. package/srv/utils/mappers.js +22 -39
  148. package/srv/utils/network-context.js +2 -4
  149. package/srv/utils/paging.d.ts +31 -0
  150. package/srv/utils/paging.js +43 -0
  151. package/srv/utils/pg-inline-json.js +3 -7
  152. package/srv/utils/pg-order-nulls.js +2 -5
  153. package/srv/utils/plutus-placeholders.d.ts +0 -13
  154. package/srv/utils/plutus-placeholders.js +6 -13
  155. package/srv/utils/rate-limiter.d.ts +0 -8
  156. package/srv/utils/rate-limiter.js +2 -4
  157. package/srv/utils/reference-script.d.ts +0 -18
  158. package/srv/utils/reference-script.js +8 -19
  159. package/srv/utils/service-events.d.ts +0 -4
  160. package/srv/utils/service-events.js +2 -4
  161. package/srv/utils/signing-helper.d.ts +1 -8
  162. package/srv/utils/signing-helper.js +3 -8
  163. package/srv/utils/tx-build-helper.d.ts +2 -32
  164. package/srv/utils/tx-build-helper.js +26 -40
  165. package/srv/utils/tx-request-parsers.d.ts +1 -25
  166. package/srv/utils/tx-request-parsers.js +10 -25
  167. package/srv/utils/tx-utils.d.ts +0 -8
  168. package/srv/utils/tx-utils.js +10 -13
  169. package/srv/utils/types.d.ts +2 -37
  170. package/srv/utils/validators.d.ts +0 -4
  171. package/srv/utils/validators.js +2 -4
package/db/schema.cds CHANGED
@@ -203,7 +203,7 @@ entity Pools : temporal {
203
203
  }
204
204
 
205
205
  @title : 'Pool Epoch Snapshot Entity'
206
- @description: 'Stake-pool state as observed once per epoch by the chain crawler. Non-temporal: each row is a dated observation, not a cached slice, so the crawled range is a true time series. Written only when the crawler runs with epochSnapshots enabled, an enumerating backend (Koios) is configured, and the crawl is at the chain tip — the provider reports the pool set as it is now, so an epoch passed during a backfill is skipped rather than filled with current figures.'
206
+ @description: 'Stake-pool state as observed once per epoch by the chain crawler. Non-temporal: each row is a dated observation, not a cached slice, so the crawled range is a true time series. Written only when the crawler runs with epochSnapshots enabled, an enumerating backend (Koios) is configured, and the crawl is at the chain tip. The provider reports the pool set as it is now, so an epoch passed during a backfill is skipped rather than filled with current figures.'
207
207
  entity PoolEpochSnapshots {
208
208
 
209
209
  @title : 'Pool Id (Key)'
@@ -211,7 +211,7 @@ entity PoolEpochSnapshots {
211
211
  key poolId : Bech32;
212
212
 
213
213
  @title : 'Epoch (Key)'
214
- @description: 'Epoch the observation belongs to — the epoch running at snapshotSlot'
214
+ @description: 'Epoch the observation belongs to, i.e. the epoch running at snapshotSlot'
215
215
  key epoch : Integer;
216
216
 
217
217
  @title : 'Snapshot Slot'
@@ -284,7 +284,7 @@ entity DrepEpochSnapshots {
284
284
  key drepId : Bech32;
285
285
 
286
286
  @title : 'Epoch (Key)'
287
- @description: 'Epoch the observation belongs to — the epoch running at snapshotSlot'
287
+ @description: 'Epoch the observation belongs to, i.e. the epoch running at snapshotSlot'
288
288
  key epoch : Integer;
289
289
 
290
290
  @title : 'Snapshot Slot'
@@ -453,6 +453,10 @@ entity Assets : temporal {
453
453
  @description: 'CIP-26 off-chain registry: decimal precision'
454
454
  registryDecimals : Integer;
455
455
 
456
+ @title : 'Decimals'
457
+ @description: 'Decimal places of the token: the decimals field of the CIP-68 reference datum for a unit with label 333 or 444, else the CIP-26 registry value; null when neither is known'
458
+ decimals : Integer;
459
+
456
460
  @title : 'Registry Description'
457
461
  @description: 'CIP-26 off-chain registry: human-readable description'
458
462
  registryDescription : LargeString;
@@ -467,7 +471,7 @@ entity Assets : temporal {
467
471
  }
468
472
 
469
473
  @title : 'Asset History Entry'
470
- @description: 'Mint or burn event for a native asset. Immutable on-chain — entries are never updated, only inserted. Free-standing (not a Composition) so history can be queried before/without the parent Assets row.'
474
+ @description: 'Mint or burn event for a native asset. Immutable on-chain: entries are never updated, only inserted. Free-standing (not a Composition) so history can be queried before/without the parent Assets row.'
471
475
  @readonly
472
476
  entity AssetHistory {
473
477
 
@@ -484,7 +488,7 @@ entity AssetHistory {
484
488
  action : String(10);
485
489
 
486
490
  @title : 'Quantity'
487
- @description: 'Absolute mint/burn amount (BigInt-safe decimal string; always positive — sign info is in `action`)'
491
+ @description: 'Absolute mint/burn amount (BigInt-safe decimal string; always positive; sign info is in `action`)'
488
492
  quantity : String(40);
489
493
 
490
494
  @title : 'Block Time'
@@ -878,8 +882,7 @@ entity TransactionInputAssets {
878
882
  }
879
883
 
880
884
  // -----------------------------------------------------
881
- // Crawler-fed ledger state (crawler.utxoSet) — non-temporal, separate from the lazy
882
- // provider-fed Addresses / AddressUTxOs so their TTL semantics stay untouched.
885
+ // Crawler-fed ledger state. Separate from the lazy Addresses tables, so their TTL logic stays untouched.
883
886
  // -----------------------------------------------------
884
887
 
885
888
  @title : 'Ledger UTxOs'
@@ -1074,7 +1077,7 @@ entity TransactionCertificates {
1074
1077
  key certIndex : Integer;
1075
1078
 
1076
1079
  @title : 'Certificate Kind (key)'
1077
- @description: 'stake_registration | stake_deregistration | pool_delegation | vote_delegation | pool_registration | pool_retirement | drep_registration | drep_update | drep_retirement | committee_hot_auth | committee_resign | genesis_delegation | treasury_mir | reserve_mir | pot_transfer | param_proposal — or the raw source type for anything else'
1080
+ @description: 'stake_registration | stake_deregistration | pool_delegation | vote_delegation | pool_registration | pool_retirement | drep_registration | drep_update | drep_retirement | committee_hot_auth | committee_resign | genesis_delegation | treasury_mir | reserve_mir | pot_transfer | param_proposal, or the raw source type for anything else'
1078
1081
  key kind : String(40);
1079
1082
 
1080
1083
  @title : 'Stake Address'
@@ -1917,7 +1920,7 @@ entity SignatureVerifications {
1917
1920
  }
1918
1921
 
1919
1922
  // -----------------------------------------------------
1920
- // Chain Crawler / Pre-Sync (v2.0)
1923
+ // Chain Crawler / Pre-Sync
1921
1924
  // -----------------------------------------------------
1922
1925
 
1923
1926
  @title : 'Cardano Sync State'
@@ -1925,7 +1928,7 @@ entity SignatureVerifications {
1925
1928
  entity CardanoSyncState {
1926
1929
 
1927
1930
  @title : 'Cursor Id (Key)'
1928
- @description: 'Singleton key — always the literal string SINGLETON'
1931
+ @description: 'Singleton key, always the literal string SINGLETON'
1929
1932
  key ID : String(10) default 'SINGLETON';
1930
1933
 
1931
1934
  @title : 'Network'
@@ -1945,7 +1948,7 @@ entity CardanoSyncState {
1945
1948
  lastSlot : Integer64 default 0;
1946
1949
 
1947
1950
  @title : 'Last Block Hash'
1948
- @description: 'Hash of the last indexed block — used for the reorg parent-hash check'
1951
+ @description: 'Hash of the last indexed block, used for the reorg parent-hash check'
1949
1952
  lastBlockHash : Blake2b256;
1950
1953
 
1951
1954
  @title : 'Last Height'
@@ -1968,9 +1971,7 @@ entity CardanoSyncState {
1968
1971
  @description: 'Current crawler state (stopped | syncing | synced | error)'
1969
1972
  syncStatus : CrawlSyncStatus default 'stopped';
1970
1973
 
1971
- // NOTE: live progress is computed by CardanoIndexerService.getStatus from
1972
- // lastHeight/tipHeight — deliberately NOT persisted here (a stored copy went
1973
- // stale immediately and misled OData readers).
1974
+ // Live progress is computed by getStatus and not stored here, since a stored copy goes stale at once.
1974
1975
 
1975
1976
  @title : 'Last Error'
1976
1977
  @description: 'Message of the most recent crawler error (null when healthy)'
@@ -2109,11 +2110,8 @@ entity CardanoWorkerWallets {
2109
2110
 
2110
2111
  @title : 'Cardano Wallet Jobs'
2111
2112
  @description: 'Asynchronous transaction jobs executed by the wallet worker (build → sign → submit → confirm)'
2112
- // Idempotency is enforced by the DATABASE, not by a read-before-insert check:
2113
- // concurrent retries of the same key (two app instances, or two HANA sessions)
2114
- // can both find no existing job and both insert. The unique constraint makes one
2115
- // of them lose, and insertJob returns the winner's job to it. See `dedupKey`.
2116
- // Generates a table UNIQUE constraint on SQLite and a UNIQUE INVERTED INDEX on HANA.
2113
+ // The database enforces idempotency, since two concurrent retries can both find no job.
2114
+ // The unique constraint makes one insert lose, and insertJob returns the winner's job.
2117
2115
  @assert.unique.dedup: [
2118
2116
  walletId,
2119
2117
  kind,
@@ -2138,11 +2136,11 @@ entity CardanoWalletJobs {
2138
2136
  status : WalletJobStatus default 'pending';
2139
2137
 
2140
2138
  @title : 'Idempotency Key'
2141
- @description: 'Optional caller-supplied dedup key — a non-failed job with the same (walletId, kind, idempotencyKey) is returned instead of creating a new one'
2139
+ @description: 'Optional caller-supplied dedup key: a non-failed job with the same (walletId, kind, idempotencyKey) is returned instead of creating a new one'
2142
2140
  idempotencyKey : String(100);
2143
2141
 
2144
2142
  @title : 'Dedup Key (internal)'
2145
- @description: 'Backing value of the unique (walletId, kind, dedupKey) constraint: the caller idempotency key while the job holds it, otherwise the job ID (unique by construction). Keyless jobs and terminated jobs therefore never collide — no reliance on NULL semantics, which differ across databases.'
2143
+ @description: 'Backing value of the unique (walletId, kind, dedupKey) constraint: the caller idempotency key while the job holds it, otherwise the job ID (unique by construction). Keyless jobs and terminated jobs therefore never collide, with no reliance on NULL semantics, which differ across databases.'
2146
2144
  dedupKey : String(100);
2147
2145
 
2148
2146
  @title : 'Request'
@@ -2150,7 +2148,7 @@ entity CardanoWalletJobs {
2150
2148
  request : LargeString;
2151
2149
 
2152
2150
  @title : 'Priority'
2153
- @description: 'Dispatch order within a wallet queue — lower runs sooner (default 100)'
2151
+ @description: 'Dispatch order within a wallet queue: lower runs sooner (default 100)'
2154
2152
  priority : Integer default 100;
2155
2153
 
2156
2154
  @title : 'Not Before'
@@ -2166,7 +2164,7 @@ entity CardanoWalletJobs {
2166
2164
  maxAttempts : Integer default 3;
2167
2165
 
2168
2166
  @title : 'Transaction Hash'
2169
- @description: 'Hash of the signed transaction — persisted before the submit call (status submitting), so a crash mid-submit stays reconcilable'
2167
+ @description: 'Hash of the signed transaction, persisted before the submit call (status submitting), so a crash mid-submit stays reconcilable'
2170
2168
  txHash : Blake2b256;
2171
2169
 
2172
2170
  @title : 'Unsigned Transaction CBOR'
@@ -2174,7 +2172,7 @@ entity CardanoWalletJobs {
2174
2172
  unsignedTxCbor : LargeString;
2175
2173
 
2176
2174
  @title : 'Signed Transaction CBOR'
2177
- @description: 'The signed transaction, stored before submission — reused verbatim for crash reconciliation and rollback re-submission (never rebuilt)'
2175
+ @description: 'The signed transaction, stored before submission, reused verbatim for crash reconciliation and rollback re-submission (never rebuilt)'
2178
2176
  signedTxCbor : LargeString;
2179
2177
 
2180
2178
  @title : 'Fee'
@@ -2182,7 +2180,7 @@ entity CardanoWalletJobs {
2182
2180
  fee : Lovelace;
2183
2181
 
2184
2182
  @title : 'Submitted At'
2185
- @description: 'Timestamp of the submission attempt (written with the signed tx, before it is sent) — the base for the confirmation timeout'
2183
+ @description: 'Timestamp of the submission attempt (written with the signed tx, before it is sent), the base for the confirmation timeout'
2186
2184
  submittedAt : Timestamp;
2187
2185
 
2188
2186
  @title : 'Confirmed At'
@@ -2190,11 +2188,11 @@ entity CardanoWalletJobs {
2190
2188
  confirmedAt : Timestamp;
2191
2189
 
2192
2190
  @title : 'Confirmed Slot'
2193
- @description: 'Absolute slot of the block containing the transaction — used for reorg checks'
2191
+ @description: 'Absolute slot of the block containing the transaction, used for reorg checks'
2194
2192
  confirmedSlot : Integer64;
2195
2193
 
2196
2194
  @title : 'Confirmed Height'
2197
- @description: 'Block height of the block containing the transaction — used for depth calculation'
2195
+ @description: 'Block height of the block containing the transaction, used for depth calculation'
2198
2196
  confirmedHeight : Integer64;
2199
2197
 
2200
2198
  @title : 'Error Code'
@@ -2218,16 +2216,8 @@ entity CardanoWalletJobs {
2218
2216
  finishedAt : Timestamp;
2219
2217
  }
2220
2218
 
2221
- /**
2222
- * Agent grants (v2.0): scoped bearer capabilities an Admin hands to an agent
2223
- * instead of a full user. The token is a capability, not an identity — it is
2224
- * stored as SHA-256 only, and a request carrying it runs as the principal
2225
- * `agent:<ID>` with the role `agent-grant`, never as the operator. Enforcement
2226
- * (allow list, wallet pinning, daily budget) lives in srv/utils/agent-grants.ts;
2227
- * the transport lane that admits `x-agent-token` in srv/utils/agent-token-auth.ts.
2228
- * Admin-only table: creation and revocation happen through CardanoAgentService
2229
- * actions, a token request may read its own row only.
2230
- */
2219
+ // Agent grants: the token is stored as SHA-256 only; a request carrying it runs as `agent:<ID>`.
2220
+ // Created and revoked through CardanoAgentService; a token may read its own row only.
2231
2221
  @title : 'Agent Grants'
2232
2222
  @description: 'Scoped, budgeted bearer capabilities for agents (token stored as SHA-256 only)'
2233
2223
  entity CardanoAgentGrants {
@@ -2290,13 +2280,8 @@ entity CardanoAgentGrants {
2290
2280
  lastUsedAt : Timestamp;
2291
2281
  }
2292
2282
 
2293
- /**
2294
- * Daily per-action counters of admitted calls under a grant (feeds
2295
- * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
2296
- * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
2297
- * handler then refuses its input. Not exposed as an entity — the function is
2298
- * the contract. A few dozen rows per grant and day at most; no retention job yet.
2299
- */
2283
+ // Daily per-action call counters of a grant, read by GetGrantUsage. The enforcement hook counts
2284
+ // calls on admission and refunds when the handler refuses the input. Not exposed as an entity.
2300
2285
  entity CardanoAgentGrantUsage {
2301
2286
 
2302
2287
  @title : 'Grant'
package/db/types.cds CHANGED
@@ -24,8 +24,8 @@ type AssetAmount : Decimal(38, 0);
24
24
  type AssetUnit : String(120);
25
25
 
26
26
  @title : 'Metadata Label'
27
- @description: 'Metadata label as string — a uint64 (0 .. 18446744073709551615, up to 20 digits)'
28
- type MetadataLabel : String(20); // was String(5): truncated labels above 5 digits
27
+ @description: 'Metadata label as string: a uint64 (0 .. 18446744073709551615, up to 20 digits)'
28
+ type MetadataLabel : String(20);
29
29
 
30
30
  @title : 'Bech32 Address'
31
31
  @description: 'Bech32 encoded address string'
@@ -89,7 +89,7 @@ type AssetSumSlice {
89
89
  type MetadataSlice {
90
90
 
91
91
  @title : 'Metadata Label'
92
- @description: 'Metadata label as string — a uint64 (0 .. 18446744073709551615, up to 20 digits)'
92
+ @description: 'Metadata label as string: a uint64 (0 .. 18446744073709551615, up to 20 digits)'
93
93
  label : MetadataLabel;
94
94
 
95
95
  @title : 'Metadata Payload'
@@ -188,16 +188,33 @@ type WalletJobKind : String(12) enum {
188
188
  multiAsset = 'multiAsset'; // BuildMultiAssetTransaction payload
189
189
  mint = 'mint'; // BuildMintTransaction payload
190
190
  plutusSpend = 'plutusSpend'; // BuildPlutusSpendTransaction payload
191
- submitSigned = 'submitSigned'; // externally signed CBOR — managed submit + confirm only
191
+ submitSigned = 'submitSigned'; // externally signed CBOR, managed submit and confirm only
192
192
  }
193
193
 
194
194
  @title : 'Worker Signer Type'
195
195
  @description: 'Enum type for how a worker wallet signs transactions'
196
196
  type WorkerSignerType : String(10) enum {
197
- hsm = 'hsm'; // PKCS#11 HSM (production) — keys never leave the module
197
+ hsm = 'hsm'; // PKCS#11 HSM for production, keys never leave the module
198
198
  software = 'software'; // operator-configured Ed25519 key (dev/test)
199
199
  }
200
200
 
201
+ @title : 'Cardano Network'
202
+ @description: 'Enum type for the Cardano networks a deployment can target'
203
+ type CardanoNetwork : String(10) enum {
204
+ mainnet = 'mainnet';
205
+ preview = 'preview';
206
+ preprod = 'preprod';
207
+ }
208
+
209
+ @title : 'UTxO Set Import Source'
210
+ @description: 'Enum type for where importUtxoSet reads the UTxO set from'
211
+ type UtxoSetImportSource : String(12) enum {
212
+ ogmios = 'ogmios';
213
+ file = 'file';
214
+ aggregates = 'aggregates';
215
+ scripts = 'scripts';
216
+ }
217
+
201
218
  // -----------------------------------------------------
202
219
  // Transaction confirmations (GetTransactionConfirmations action result)
203
220
  // -----------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odatano/core",
3
- "version": "2.0.0-rc.43",
3
+ "version": "2.0.0-rc.45",
4
4
  "description": "SAP CAP plugin for Cardano blockchain OData V4 integration",
5
5
  "imports": {
6
6
  "#cds-models/*": "./@cds-models/*/index.js"
@@ -34,7 +34,9 @@
34
34
  "@harmoniclabs/cardano-ledger-ts": "^0.5.6",
35
35
  "@harmoniclabs/cbor": "^2.0.1",
36
36
  "@harmoniclabs/crypto": "^0.3.0",
37
+ "@harmoniclabs/plutus-data": "^2.0.1",
37
38
  "@harmoniclabs/uint8array-utils": "^1.0.4",
39
+ "@harmoniclabs/uplc": "^2.0.7",
38
40
  "@odatano/cap-auth": "^0.1.0",
39
41
  "@sap/xssec": "^4",
40
42
  "axios": "^1.18.0",
@@ -1,15 +1,7 @@
1
1
  #!/usr/bin/env node
2
- // Rewrite Blocks.slotLeader values written before it became the bech32 pool id: an Ogmios
3
- // issuer key (64 hex chars) becomes bech32('pool', blake2b-224(key)); a Koios VRF key
4
- // (vrf_vk1…) is matched on blake2b-256 against the pools' registered VRF key hashes, taken
5
- // from an Ogmios `queryLedgerState/stakePools` response. Prints SQL; the database is not touched.
6
- //
7
- // psql -Atc "SELECT DISTINCT slotLeader FROM odatano_cardano_Blocks WHERE slotLeader NOT LIKE 'pool1%'" \
8
- // | node scripts/migrate-slot-leader.mjs [--stake-pools stake-pools.json] [--extra-map extra.txt] > slot-leader.sql
9
- //
10
- // The SQL fills a mapping table and runs one UPDATE (PostgreSQL and SQLite). Values that cannot
11
- // be mapped (a VRF key of a pool no longer registered, unknown formats) are listed on stderr
12
- // and left unchanged; `--extra-map` supplies them as "<old value> <pool id>" lines.
2
+ // Reads old Blocks.slotLeader values on stdin and prints SQL that rewrites them to bech32 pool ids.
3
+ // Issuer keys are hashed. VRF keys are matched via --stake-pools. Unmapped values go to stderr.
4
+ // --extra-map supplies those as "<old value> <pool id>" lines. The database is not touched.
13
5
  import fs from 'node:fs';
14
6
  import { pathToFileURL } from 'node:url';
15
7
  import { bech32 } from 'bech32';
@@ -1,16 +1,7 @@
1
1
  #!/usr/bin/env node
2
- // Move a database written before the txSeq schema onto it: TransactionInputs / TransactionOutputs
3
- // and their asset tables are keyed by Transactions.txSeq (slot * 65536 + txIndex) instead of the
4
- // transaction hash. Runs against the configured `db` (PostgreSQL or SQLite) with ODATANO stopped:
5
- //
6
- // node scripts/migrate-txseq.mjs # image: docker compose run --rm --no-deps odatano migrate-txseq
7
- // node scripts/migrate-txseq.mjs --dry-run # report what would change, touch nothing
8
- //
9
- // One transaction: fill Transactions.txSeq, rebuild the four tables in the new layout (rows copied
10
- // in key order, row counts checked), recreate the service views, refresh the planner statistics
11
- // and store the new model in `cds_model` so the next schema deployment sees no difference. A
12
- // database already on the new layout is left alone. The table indexes are recreated by the server
13
- // on its next start.
2
+ // Rekeys the transaction input and output tables by Transactions.txSeq in one transaction.
3
+ // Run with ODATANO stopped. --dry-run only reports. A database already on this layout is left alone.
4
+ // It also stores the new model in cds_model, so the next schema deploy sees no difference.
14
5
  import cds from '@sap/cds';
15
6
 
16
7
  const DRY = process.argv.includes('--dry-run');
package/src/index.d.ts CHANGED
@@ -18,10 +18,6 @@ export { verifyTxWitnesses } from '../srv/blockchain/signing/signature-verifier'
18
18
  export { posixToSlot, slotToPosixMs } from '../srv/utils/epoch-slots';
19
19
  export type { TxWitnessVerification, TransactionConfirmations } from '../srv/utils/types';
20
20
  export { applyScriptParameters, plutusScriptHash } from '../srv/utils/tx-build-helper';
21
- /**
22
- * Initialize the plugin: config from cds.env.requires["odatano-core"] or env vars,
23
- * then all blockchain components plus the optional crawler and wallet worker.
24
- */
25
21
  export declare function initialize(): Promise<void>;
26
22
  /** Shut down the plugin and close all backend connections. */
27
23
  export declare function shutdown(): Promise<void>;
package/src/index.js CHANGED
@@ -99,10 +99,8 @@ Object.defineProperty(exports, "slotToPosixMs", { enumerable: true, get: functio
99
99
  var tx_build_helper_1 = require("../srv/utils/tx-build-helper");
100
100
  Object.defineProperty(exports, "applyScriptParameters", { enumerable: true, get: function () { return tx_build_helper_1.applyScriptParameters; } });
101
101
  Object.defineProperty(exports, "plutusScriptHash", { enumerable: true, get: function () { return tx_build_helper_1.plutusScriptHash; } });
102
- /**
103
- * Initialize the plugin: config from cds.env.requires["odatano-core"] or env vars,
104
- * then all blockchain components plus the optional crawler and wallet worker.
105
- */
102
+ // Reads config from cds.env.requires["odatano-core"] or env vars.
103
+ // Starts all blockchain components plus the optional crawler and wallet worker.
106
104
  async function initialize() {
107
105
  const { loadConfigFromEnv, loadHsmConfigFromEnv, initializeFromConfig, getAppContext } = await Promise.resolve().then(() => __importStar(require('../srv/server')));
108
106
  let alreadyInitialized = false;
@@ -111,7 +109,7 @@ async function initialize() {
111
109
  alreadyInitialized = true;
112
110
  }
113
111
  catch {
114
- // not initialized yet — initializeFromConfig will create the context
112
+ // Not initialized yet. initializeFromConfig creates the context.
115
113
  }
116
114
  const config = loadConfigFromEnv();
117
115
  const hsmConfig = loadHsmConfigFromEnv();
package/src/plugin.js CHANGED
@@ -79,19 +79,15 @@ if (req) {
79
79
  req.model = [...PLUGIN_MODEL];
80
80
  }
81
81
  logger.debug('Plugin registered');
82
- /**
83
- * Agent grants (off by default). Must run at plugin load, before CAP builds its
84
- * middlewares, because it swaps the auth impl. Idempotent; server.ts repeats it for standalone.
85
- */
82
+ // Agent grants swap the auth impl, so this runs at plugin load before CAP builds middlewares.
83
+ // Idempotent. server.ts repeats it for standalone mode.
86
84
  require('../srv/utils/agent-grants-config')
87
85
  .activateAgentGrants();
88
86
  // The old path of the read service keeps answering until the 2.0.0 release.
89
87
  require('../srv/utils/legacy-service-paths')
90
88
  .registerLegacyServicePaths();
91
- /**
92
- * Plugin mode: relative @impl paths resolve from cds.root (the consumer app), so
93
- * rewrite them to package-qualified paths that Node module resolution can find.
94
- */
89
+ // In plugin mode relative @impl paths resolve from the consumer app.
90
+ // Rewrite them to package-qualified paths that Node can resolve.
95
91
  cds_1.default.on('loaded', (model) => {
96
92
  if (path_1.default.resolve(cds_1.default.root) === pluginRoot)
97
93
  return;
@@ -0,0 +1,7 @@
1
+ import type { Transaction as CapTransaction } from '@sap/cds';
2
+ import type { Transaction as ProviderTransaction } from '../utils/types';
3
+ export declare function cip68Decimals(tx: CapTransaction, unit: string, mintTxHash?: string | null): Promise<number | null>;
4
+ /** Write `decimals` on every slice of the unit; returns the rows changed. */
5
+ export declare function setAssetDecimals(tx: CapTransaction, unit: string, decimals: number): Promise<number>;
6
+ export declare function applyReferenceDatums(tx: CapTransaction, txs: ProviderTransaction[]): Promise<number>;
7
+ //# sourceMappingURL=asset-decimals.d.ts.map
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.cip68Decimals = cip68Decimals;
7
+ exports.setAssetDecimals = setAssetDecimals;
8
+ exports.applyReferenceDatums = applyReferenceDatums;
9
+ const cds_1 = __importDefault(require("@sap/cds"));
10
+ const cardano_1 = require("#cds-models/odatano/cardano");
11
+ const cip68_1 = require("../cbor/cip68");
12
+ const { SELECT, UPDATE } = cds_1.default.ql;
13
+ /** Spending transactions a reference NFT is followed through before the trail is given up. */
14
+ const MAX_HOPS = 10_000;
15
+ async function storedDatum(tx, dataHash) {
16
+ const row = await tx.run(SELECT.one.from(cardano_1.TransactionDatums).columns('datum').where({ dataHash }));
17
+ return row?.datum ?? null;
18
+ }
19
+ // The transaction that consumed an output. Collateral consumes only in a phase-2 failure,
20
+ // which is stored with collateral and reference inputs alone.
21
+ async function consumingTx(tx, spentTxHash, spentOutputIndex) {
22
+ const inputs = await tx.run(SELECT.from(cardano_1.TransactionInputs).columns('txSeq', 'isCollateral').where({ spentTxHash, spentOutputIndex, isReference: false }));
23
+ const regular = (inputs ?? []).find(i => !i.isCollateral);
24
+ if (regular)
25
+ return regular;
26
+ for (const candidate of inputs ?? []) {
27
+ const spendsRegular = await tx.run(SELECT.one.from(cardano_1.TransactionInputs).columns('txSeq').where({ txSeq: candidate.txSeq, isCollateral: false, isReference: false }));
28
+ if (!spendsRegular)
29
+ return candidate;
30
+ }
31
+ return undefined;
32
+ }
33
+ // Datum of the output holding a reference NFT now, followed from its latest mint through each spend.
34
+ // Hashed datums come from TransactionDatums. Null when the crawled chain has no trail.
35
+ async function currentReferenceDatum(tx, referenceUnit, mintTxHash) {
36
+ const mint = await tx.run(SELECT.one.from(cardano_1.AssetHistory).columns('txHash').where({ unit: referenceUnit, action: 'mint' }).orderBy('blockHeight desc', 'blockTime desc', 'txHash desc'));
37
+ let txHash = mint?.txHash ?? mintTxHash;
38
+ let datum = null;
39
+ for (let hop = 0; txHash && hop < MAX_HOPS; hop++) {
40
+ const head = await tx.run(SELECT.one.from(cardano_1.Transactions).columns('txSeq').where({ hash: txHash }));
41
+ if (head?.txSeq == null)
42
+ break;
43
+ const holder = await tx.run(SELECT.one.from(cardano_1.TransactionOutputAssets).columns('output_outputIndex').where({ output_txSeq: head.txSeq, unit: referenceUnit }));
44
+ if (holder?.output_outputIndex == null)
45
+ break;
46
+ const output = await tx.run(SELECT.one.from(cardano_1.TransactionOutputs).columns('utxo_inlineDatum', 'utxo_dataHash').where({ txSeq: head.txSeq, outputIndex: holder.output_outputIndex }));
47
+ datum = output?.utxo_inlineDatum ?? (output?.utxo_dataHash ? await storedDatum(tx, output.utxo_dataHash) : null) ?? datum;
48
+ const spender = await consumingTx(tx, txHash, holder.output_outputIndex);
49
+ if (spender?.txSeq == null)
50
+ break;
51
+ const next = await tx.run(SELECT.one.from(cardano_1.Transactions).columns('hash').where({ txSeq: spender.txSeq }));
52
+ txHash = next?.hash ?? null;
53
+ }
54
+ return datum;
55
+ }
56
+ // CIP-68 decimals of a label 333 or 444 token. `mintTxHash` is the token's own mint, tried when
57
+ // AssetHistory has no mint of the reference NFT. Null for other units or without data.
58
+ async function cip68Decimals(tx, unit, mintTxHash = null) {
59
+ const referenceUnit = (0, cip68_1.cip68ReferenceUnit)(unit);
60
+ if (!referenceUnit)
61
+ return null;
62
+ const datum = await currentReferenceDatum(tx, referenceUnit, mintTxHash);
63
+ return datum ? (0, cip68_1.cip68DecimalsFromDatum)(datum) : null;
64
+ }
65
+ /** Write `decimals` on every slice of the unit; returns the rows changed. */
66
+ async function setAssetDecimals(tx, unit, decimals) {
67
+ const changed = await tx.run(UPDATE.entity(cardano_1.Assets).set({ decimals }).where({ unit }));
68
+ return Number(changed) || 0;
69
+ }
70
+ // Copy decimals from each reference-NFT datum in a block to the matching user tokens. Returns rows changed.
71
+ async function applyReferenceDatums(tx, txs) {
72
+ let changed = 0;
73
+ for (const t of txs) {
74
+ const witness = new Map((t.datums ?? []).map((d) => [d.hash, d.cbor]));
75
+ for (const o of t.outputs ?? []) {
76
+ for (const a of o.amount ?? []) {
77
+ const users = (0, cip68_1.cip68UserUnits)(a.unit);
78
+ if (!users)
79
+ continue;
80
+ const datum = o.inlineDatum ?? (o.dataHash ? witness.get(o.dataHash) ?? await storedDatum(tx, o.dataHash) : null);
81
+ const decimals = datum ? (0, cip68_1.cip68DecimalsFromDatum)(datum) : null;
82
+ if (decimals == null)
83
+ continue;
84
+ for (const unit of users)
85
+ changed += await setAssetDecimals(tx, unit, decimals);
86
+ }
87
+ }
88
+ }
89
+ return changed;
90
+ }
91
+ //# sourceMappingURL=asset-decimals.js.map
@@ -19,7 +19,7 @@ export declare class BlockfrostBackend implements CardanoBackend, PaginatingBack
19
19
  getTransaction(hash: string): Promise<Transaction>;
20
20
  /** Metadata labels of a transaction (hash hex); NotFoundError when it has none. */
21
21
  getTransactionMetadata(tx_hash: string): Promise<MetadataLabelTx[]>;
22
- /** Address data with UTxOs (no transactions — see getAddressTransactions()). */
22
+ /** Address data with UTxOs. Transactions come from getAddressTransactions(). */
23
23
  getAddress(address: string): Promise<Address>;
24
24
  /** Transactions of an address, most recent first, with full details (batched). */
25
25
  getAddressTransactions(address: string, limit?: number): Promise<Transaction[]>;
@@ -27,16 +27,8 @@ export declare class BlockfrostBackend implements CardanoBackend, PaginatingBack
27
27
  getAddressUtxos(address: string): Promise<UTxO[]>;
28
28
  /** Stake pool by id. */
29
29
  getPool(poolId: string): Promise<PoolData>;
30
- /**
31
- * Asset info (supply, mint history, CIP-25 + CIP-26 metadata); unit = policyId + assetNameHex.
32
- * Blockfrost does not expose the initial-mint timestamp here, so `initialMintTime` stays null.
33
- */
30
+ /** Asset info. Blockfrost has no initial-mint timestamp here, so `initialMintTime` stays null. */
34
31
  getAssetInfo(unit: string): Promise<AssetInfo>;
35
- /**
36
- * Mint/burn events of an asset, most recent first (max 100 per Blockfrost page).
37
- * `assetsHistory` carries no block metadata; blockTime/blockHeight are backfilled with one
38
- * best-effort `txs()` call per entry (a failed fetch leaves them null).
39
- */
40
32
  getAssetHistory(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
41
33
  /** DRep by id (bech32). */
42
34
  getDrep(drepId: string): Promise<DrepData>;
@@ -16,8 +16,8 @@ class BlockfrostBackend {
16
16
  if (!projectId && !customBackend) {
17
17
  throw new errors_1.BackendInitError('blockfrost', new Error('Either projectId (BLOCKFROST_API_KEY) or customBackend (BLOCKFROST_CUSTOM_BACKEND) is required'));
18
18
  }
19
- // Self-hosted Blockfrost-compatible nodes reject an empty project_id header
20
- // even without authentication — placeholder for the runtime HTTP header only.
19
+ // Self-hosted Blockfrost-compatible servers reject an empty project_id header,
20
+ // even without authentication, so a placeholder is sent.
21
21
  const effectiveProjectId = projectId || 'self-hosted';
22
22
  this.api = new blockfrost_js_1.BlockFrostAPI({
23
23
  projectId: effectiveProjectId,
@@ -73,7 +73,7 @@ class BlockfrostBackend {
73
73
  /** Transaction by hash (hex), with UTxOs and metadata. */
74
74
  async getTransaction(hash) {
75
75
  return (0, backend_request_handler_1.handleBackendRequest)(async () => {
76
- // independent endpoints — fetch in parallel instead of 3 sequential roundtrips
76
+ // independent endpoints, fetched in parallel
77
77
  const [tx, txUtxos, txMetadata] = await Promise.all([
78
78
  this.api.txs(hash),
79
79
  this.api.txsUtxos(hash),
@@ -138,11 +138,11 @@ class BlockfrostBackend {
138
138
  }));
139
139
  }, this.name);
140
140
  }
141
- /** Address data with UTxOs (no transactions — see getAddressTransactions()). */
141
+ /** Address data with UTxOs. Transactions come from getAddressTransactions(). */
142
142
  async getAddress(address) {
143
143
  return (0, backend_request_handler_1.handleBackendRequest)(async () => {
144
144
  const address_data = await this.api.addresses(address);
145
- // *All variant paginates internally — plain addressesUtxos caps at 100 entries and silently truncates
145
+ // plain addressesUtxos silently stops at 100 entries; the *All variant pages through all of them
146
146
  const address_utxos = await this.api.addressesUtxosAll(address);
147
147
  return {
148
148
  address: address_data.address,
@@ -167,7 +167,7 @@ class BlockfrostBackend {
167
167
  /** Transactions of an address, most recent first, with full details (batched). */
168
168
  async getAddressTransactions(address, limit) {
169
169
  return (0, backend_request_handler_1.handleBackendRequest)(async () => {
170
- // Blockfrost rejects count > 100 with a 400 — clamp instead
170
+ // Blockfrost rejects count > 100 with a 400
171
171
  const count = limit === undefined ? undefined : Math.min(Math.max(limit, 1), 100);
172
172
  const address_txs = await this.api.addressesTransactions(address, { order: 'desc', count });
173
173
  const txHashes = address_txs.map(tx => tx.tx_hash);
@@ -223,10 +223,7 @@ class BlockfrostBackend {
223
223
  };
224
224
  }, this.name);
225
225
  }
226
- /**
227
- * Asset info (supply, mint history, CIP-25 + CIP-26 metadata); unit = policyId + assetNameHex.
228
- * Blockfrost does not expose the initial-mint timestamp here, so `initialMintTime` stays null.
229
- */
226
+ /** Asset info. Blockfrost has no initial-mint timestamp here, so `initialMintTime` stays null. */
230
227
  async getAssetInfo(unit) {
231
228
  return (0, backend_request_handler_1.handleBackendRequest)(async () => {
232
229
  const a = await this.api.assetsById(unit);
@@ -252,11 +249,8 @@ class BlockfrostBackend {
252
249
  };
253
250
  }, this.name);
254
251
  }
255
- /**
256
- * Mint/burn events of an asset, most recent first (max 100 per Blockfrost page).
257
- * `assetsHistory` carries no block metadata; blockTime/blockHeight are backfilled with one
258
- * best-effort `txs()` call per entry (a failed fetch leaves them null).
259
- */
252
+ // Mint and burn events, newest first, at most 100 per page. `assetsHistory` has no block data,
253
+ // so one `txs()` call per entry fills blockTime and blockHeight. A failed call leaves them null.
260
254
  async getAssetHistory(unit, limit = 100) {
261
255
  return (0, backend_request_handler_1.handleBackendRequest)(async () => {
262
256
  const count = Math.min(Math.max(1, limit), 100);
@@ -443,11 +437,11 @@ class BlockfrostBackend {
443
437
  const out = utxos?.outputs?.find(o => o.output_index === outputIndex);
444
438
  if (!out)
445
439
  return false;
446
- // consumed_by_tx is optional on the openapi type (Blockfrost server >= 0.1.59); without it
447
- // unspent cannot be proven — escalate so the router falls through to another backend.
440
+ // Blockfrost servers before 0.1.59 omit consumed_by_tx. Without it unspent cannot be
441
+ // proven, so the router must fall through to another backend.
448
442
  const consumed = out.consumed_by_tx;
449
443
  if (consumed === undefined) {
450
- throw new errors_1.ProviderUnavailableError(`${this.name}: server does not expose consumed_by_tx — cannot determine UTxO status`, this.name);
444
+ throw new errors_1.ProviderUnavailableError(`${this.name}: server does not expose consumed_by_tx, cannot determine UTxO status`, this.name);
451
445
  }
452
446
  return consumed === null;
453
447
  }, this.name);
@@ -466,7 +460,7 @@ class BlockfrostBackend {
466
460
  /** Most recent tx hashes of an address (no details). */
467
461
  async getAddressTransactionHashes(address, limit) {
468
462
  return (0, backend_request_handler_1.handleBackendRequest)(async () => {
469
- // Blockfrost rejects count > 100 with a 400 — clamp instead
463
+ // Blockfrost rejects count > 100 with a 400
470
464
  const count = Math.min(Math.max(limit, 1), 100);
471
465
  const txs = await this.api.addressesTransactions(address, { order: 'desc', count });
472
466
  return txs.map(tx => tx.tx_hash);
@@ -488,7 +482,7 @@ class BlockfrostBackend {
488
482
  }, this.name);
489
483
  }
490
484
  // ---------------------------------------------------------------------------
491
- // PaginatingBackend — forward iteration for the chain crawler
485
+ // PaginatingBackend: forward iteration for the chain crawler
492
486
  // ---------------------------------------------------------------------------
493
487
  /** Map a Blockfrost block summary (blocks()/blocksNext()) to BlockData. */
494
488
  toBlockData(b) {
@@ -522,7 +516,7 @@ class BlockfrostBackend {
522
516
  // a plain NotFoundError would count as transient and halt it with an error streak.
523
517
  const normalized = (0, errors_1.normalizeBackendError)(err, this.name);
524
518
  if (normalized.statusCode === 404) {
525
- throw new errors_1.ProviderUnavailableError(`CHAIN_POINT_MISMATCH: cursor block ${afterHash} is unknown to ${this.name} — likely orphaned by a reorg`, this.name);
519
+ throw new errors_1.ProviderUnavailableError(`CHAIN_POINT_MISMATCH: cursor block ${afterHash} is unknown to ${this.name}, likely orphaned by a reorg`, this.name);
526
520
  }
527
521
  throw err;
528
522
  }