@odatano/core 2.0.0-rc.44 → 2.0.0-rc.46

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 (168) 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 +5 -20
  4. package/@cds-models/CardanoODataService/index.d.ts +18 -47
  5. package/@cds-models/CardanoSignService/index.d.ts +3 -18
  6. package/@cds-models/CardanoTransactionService/index.d.ts +9 -31
  7. package/@cds-models/CardanoWorkerService/index.d.ts +3 -19
  8. package/@cds-models/index.d.ts +17 -0
  9. package/@cds-models/index.js +2 -0
  10. package/@cds-models/odatano/cardano/index.d.ts +0 -34
  11. package/README.md +20 -20
  12. package/db/schema.cds +25 -44
  13. package/db/types.cds +22 -5
  14. package/package.json +3 -1
  15. package/scripts/migrate-slot-leader.mjs +3 -11
  16. package/scripts/migrate-txseq.mjs +3 -12
  17. package/src/index.d.ts +0 -4
  18. package/src/index.js +3 -5
  19. package/src/plugin.js +4 -8
  20. package/srv/blockchain/asset-decimals.d.ts +0 -9
  21. package/srv/blockchain/asset-decimals.js +21 -16
  22. package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -10
  23. package/srv/blockchain/backends/blockfrost-backend.js +15 -21
  24. package/srv/blockchain/backends/cardano-backend.d.ts +12 -71
  25. package/srv/blockchain/backends/koios-backend.d.ts +14 -147
  26. package/srv/blockchain/backends/koios-backend.js +43 -166
  27. package/srv/blockchain/backends/odatano-backend.d.ts +1 -11
  28. package/srv/blockchain/backends/odatano-backend.js +11 -12
  29. package/srv/blockchain/backends/ogmios-backend.d.ts +19 -160
  30. package/srv/blockchain/backends/ogmios-backend.js +96 -175
  31. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +2 -18
  32. package/srv/blockchain/backends/ogmios-frame-guard.js +8 -20
  33. package/srv/blockchain/cardano-client.d.ts +12 -80
  34. package/srv/blockchain/cardano-client.js +36 -88
  35. package/srv/blockchain/cardano-indexer.d.ts +14 -192
  36. package/srv/blockchain/cardano-indexer.js +136 -222
  37. package/srv/blockchain/cardano-tx-builder.d.ts +1 -28
  38. package/srv/blockchain/cardano-tx-builder.js +17 -34
  39. package/srv/blockchain/circuit-breaker.d.ts +1 -13
  40. package/srv/blockchain/circuit-breaker.js +5 -15
  41. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +0 -5
  42. package/srv/blockchain/crawler/asset-decimals-backfill.js +2 -5
  43. package/srv/blockchain/crawler/certificate-backfill.d.ts +0 -17
  44. package/srv/blockchain/crawler/certificate-backfill.js +8 -22
  45. package/srv/blockchain/crawler/crawler.d.ts +16 -93
  46. package/srv/blockchain/crawler/crawler.js +85 -160
  47. package/srv/blockchain/crawler/credential-backfill.d.ts +0 -10
  48. package/srv/blockchain/crawler/credential-backfill.js +2 -4
  49. package/srv/blockchain/crawler/hooks.d.ts +1 -5
  50. package/srv/blockchain/crawler/index.d.ts +0 -12
  51. package/srv/blockchain/crawler/index.js +6 -20
  52. package/srv/blockchain/crawler/sync-state.d.ts +6 -44
  53. package/srv/blockchain/crawler/sync-state.js +18 -53
  54. package/srv/blockchain/crawler/transaction-backfill.d.ts +0 -11
  55. package/srv/blockchain/crawler/transaction-backfill.js +11 -30
  56. package/srv/blockchain/crawler/utxo-set-import.d.ts +1 -30
  57. package/srv/blockchain/crawler/utxo-set-import.js +27 -53
  58. package/srv/blockchain/ledger-state.d.ts +10 -54
  59. package/srv/blockchain/ledger-state.js +11 -27
  60. package/srv/blockchain/pending-spends.d.ts +0 -12
  61. package/srv/blockchain/pending-spends.js +4 -12
  62. package/srv/blockchain/request-coalescer.d.ts +2 -16
  63. package/srv/blockchain/request-coalescer.js +2 -16
  64. package/srv/blockchain/signing/cose-verifier.d.ts +0 -9
  65. package/srv/blockchain/signing/cose-verifier.js +4 -10
  66. package/srv/blockchain/signing/external-signer.d.ts +1 -4
  67. package/srv/blockchain/signing/external-signer.js +2 -8
  68. package/srv/blockchain/signing/hsm-signer.d.ts +6 -18
  69. package/srv/blockchain/signing/hsm-signer.js +16 -28
  70. package/srv/blockchain/signing/signature-verifier.d.ts +1 -8
  71. package/srv/blockchain/signing/signature-verifier.js +9 -19
  72. package/srv/blockchain/signing/submission-finalizer.d.ts +10 -16
  73. package/srv/blockchain/signing/submission-finalizer.js +53 -19
  74. package/srv/blockchain/stored-chain.d.ts +1 -14
  75. package/srv/blockchain/stored-chain.js +3 -8
  76. package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +0 -4
  77. package/srv/blockchain/transaction-building/buildooor-fee-patch.js +4 -9
  78. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +7 -150
  79. package/srv/blockchain/transaction-building/buildooor-tx.js +91 -196
  80. package/srv/blockchain/transaction-building/caller-datums.d.ts +0 -14
  81. package/srv/blockchain/transaction-building/caller-datums.js +3 -9
  82. package/srv/blockchain/transaction-building/cardano-tx.d.ts +1 -4
  83. package/srv/blockchain/wallet-worker/build-request.d.ts +0 -5
  84. package/srv/blockchain/wallet-worker/build-request.js +6 -9
  85. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -23
  86. package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -20
  87. package/srv/blockchain/wallet-worker/index.d.ts +1 -1
  88. package/srv/blockchain/wallet-worker/index.js +3 -5
  89. package/srv/blockchain/wallet-worker/job-store.d.ts +15 -65
  90. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  91. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -10
  92. package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -12
  93. package/srv/blockchain/wallet-worker/signers.d.ts +3 -11
  94. package/srv/blockchain/wallet-worker/signers.js +3 -6
  95. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +3 -21
  96. package/srv/blockchain/wallet-worker/wallet-worker.js +47 -54
  97. package/srv/cardano-agent-service.cds +123 -146
  98. package/srv/cardano-agent-service.js +2 -5
  99. package/srv/cardano-backend-service.cds +10 -17
  100. package/srv/cardano-backend-service.js +7 -12
  101. package/srv/cardano-indexer-service.cds +16 -37
  102. package/srv/cardano-indexer-service.d.ts +5 -1
  103. package/srv/cardano-indexer-service.js +44 -35
  104. package/srv/cardano-service.cds +56 -40
  105. package/srv/cardano-service.js +42 -69
  106. package/srv/cardano-sign-service.cds +14 -23
  107. package/srv/cardano-sign-service.js +18 -24
  108. package/srv/cardano-tx-service.cds +27 -29
  109. package/srv/cardano-tx-service.js +60 -122
  110. package/srv/cardano-worker-service.cds +109 -125
  111. package/srv/cardano-worker-service.js +21 -31
  112. package/srv/cbor/cip68.d.ts +0 -4
  113. package/srv/cbor/cip68.js +2 -4
  114. package/srv/cbor/parse.d.ts +3 -18
  115. package/srv/cbor/parse.js +2 -7
  116. package/srv/cbor/plutus-data-json.d.ts +0 -4
  117. package/srv/server.d.ts +5 -36
  118. package/srv/server.js +30 -51
  119. package/srv/utils/agent-grants-config.d.ts +0 -18
  120. package/srv/utils/agent-grants-config.js +6 -13
  121. package/srv/utils/agent-grants.d.ts +14 -68
  122. package/srv/utils/agent-grants.js +42 -60
  123. package/srv/utils/agent-token-auth.d.ts +0 -5
  124. package/srv/utils/agent-token-auth.js +2 -5
  125. package/srv/utils/backend-request-handler.d.ts +1 -1
  126. package/srv/utils/collections.d.ts +1 -4
  127. package/srv/utils/collections.js +1 -4
  128. package/srv/utils/const.d.ts +0 -18
  129. package/srv/utils/const.js +7 -18
  130. package/srv/utils/crypto.js +3 -5
  131. package/srv/utils/db-indexes.d.ts +2 -0
  132. package/srv/utils/db-indexes.js +22 -9
  133. package/srv/utils/db-sanitize.d.ts +1 -8
  134. package/srv/utils/db-sanitize.js +3 -8
  135. package/srv/utils/epoch-slots.d.ts +1 -8
  136. package/srv/utils/epoch-slots.js +3 -8
  137. package/srv/utils/error-codes.d.ts +0 -4
  138. package/srv/utils/error-codes.js +2 -4
  139. package/srv/utils/errors.d.ts +2 -22
  140. package/srv/utils/errors.js +13 -27
  141. package/srv/utils/liveness.d.ts +0 -4
  142. package/srv/utils/liveness.js +2 -4
  143. package/srv/utils/mappers.d.ts +0 -37
  144. package/srv/utils/mappers.js +19 -39
  145. package/srv/utils/network-context.js +2 -4
  146. package/srv/utils/paging.d.ts +31 -0
  147. package/srv/utils/paging.js +43 -0
  148. package/srv/utils/pg-inline-json.js +3 -7
  149. package/srv/utils/pg-order-nulls.js +2 -5
  150. package/srv/utils/plutus-placeholders.d.ts +0 -13
  151. package/srv/utils/plutus-placeholders.js +6 -13
  152. package/srv/utils/rate-limiter.d.ts +0 -8
  153. package/srv/utils/rate-limiter.js +2 -4
  154. package/srv/utils/reference-script.d.ts +0 -18
  155. package/srv/utils/reference-script.js +8 -19
  156. package/srv/utils/service-events.d.ts +0 -4
  157. package/srv/utils/service-events.js +2 -4
  158. package/srv/utils/signing-helper.d.ts +1 -8
  159. package/srv/utils/signing-helper.js +3 -8
  160. package/srv/utils/tx-build-helper.d.ts +2 -32
  161. package/srv/utils/tx-build-helper.js +26 -40
  162. package/srv/utils/tx-request-parsers.d.ts +1 -25
  163. package/srv/utils/tx-request-parsers.js +10 -25
  164. package/srv/utils/tx-utils.d.ts +0 -8
  165. package/srv/utils/tx-utils.js +10 -13
  166. package/srv/utils/types.d.ts +2 -37
  167. package/srv/utils/validators.d.ts +0 -4
  168. 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'
@@ -471,7 +471,7 @@ entity Assets : temporal {
471
471
  }
472
472
 
473
473
  @title : 'Asset History Entry'
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.'
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.'
475
475
  @readonly
476
476
  entity AssetHistory {
477
477
 
@@ -488,7 +488,7 @@ entity AssetHistory {
488
488
  action : String(10);
489
489
 
490
490
  @title : 'Quantity'
491
- @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`)'
492
492
  quantity : String(40);
493
493
 
494
494
  @title : 'Block Time'
@@ -882,8 +882,7 @@ entity TransactionInputAssets {
882
882
  }
883
883
 
884
884
  // -----------------------------------------------------
885
- // Crawler-fed ledger state (crawler.utxoSet) — non-temporal, separate from the lazy
886
- // 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.
887
886
  // -----------------------------------------------------
888
887
 
889
888
  @title : 'Ledger UTxOs'
@@ -1078,7 +1077,7 @@ entity TransactionCertificates {
1078
1077
  key certIndex : Integer;
1079
1078
 
1080
1079
  @title : 'Certificate Kind (key)'
1081
- @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'
1082
1081
  key kind : String(40);
1083
1082
 
1084
1083
  @title : 'Stake Address'
@@ -1921,7 +1920,7 @@ entity SignatureVerifications {
1921
1920
  }
1922
1921
 
1923
1922
  // -----------------------------------------------------
1924
- // Chain Crawler / Pre-Sync (v2.0)
1923
+ // Chain Crawler / Pre-Sync
1925
1924
  // -----------------------------------------------------
1926
1925
 
1927
1926
  @title : 'Cardano Sync State'
@@ -1929,7 +1928,7 @@ entity SignatureVerifications {
1929
1928
  entity CardanoSyncState {
1930
1929
 
1931
1930
  @title : 'Cursor Id (Key)'
1932
- @description: 'Singleton key — always the literal string SINGLETON'
1931
+ @description: 'Singleton key, always the literal string SINGLETON'
1933
1932
  key ID : String(10) default 'SINGLETON';
1934
1933
 
1935
1934
  @title : 'Network'
@@ -1949,7 +1948,7 @@ entity CardanoSyncState {
1949
1948
  lastSlot : Integer64 default 0;
1950
1949
 
1951
1950
  @title : 'Last Block Hash'
1952
- @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'
1953
1952
  lastBlockHash : Blake2b256;
1954
1953
 
1955
1954
  @title : 'Last Height'
@@ -1972,9 +1971,7 @@ entity CardanoSyncState {
1972
1971
  @description: 'Current crawler state (stopped | syncing | synced | error)'
1973
1972
  syncStatus : CrawlSyncStatus default 'stopped';
1974
1973
 
1975
- // NOTE: live progress is computed by CardanoIndexerService.getStatus from
1976
- // lastHeight/tipHeight — deliberately NOT persisted here (a stored copy went
1977
- // 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.
1978
1975
 
1979
1976
  @title : 'Last Error'
1980
1977
  @description: 'Message of the most recent crawler error (null when healthy)'
@@ -2113,11 +2110,8 @@ entity CardanoWorkerWallets {
2113
2110
 
2114
2111
  @title : 'Cardano Wallet Jobs'
2115
2112
  @description: 'Asynchronous transaction jobs executed by the wallet worker (build → sign → submit → confirm)'
2116
- // Idempotency is enforced by the DATABASE, not by a read-before-insert check:
2117
- // concurrent retries of the same key (two app instances, or two HANA sessions)
2118
- // can both find no existing job and both insert. The unique constraint makes one
2119
- // of them lose, and insertJob returns the winner's job to it. See `dedupKey`.
2120
- // 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.
2121
2115
  @assert.unique.dedup: [
2122
2116
  walletId,
2123
2117
  kind,
@@ -2142,11 +2136,11 @@ entity CardanoWalletJobs {
2142
2136
  status : WalletJobStatus default 'pending';
2143
2137
 
2144
2138
  @title : 'Idempotency Key'
2145
- @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'
2146
2140
  idempotencyKey : String(100);
2147
2141
 
2148
2142
  @title : 'Dedup Key (internal)'
2149
- @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.'
2150
2144
  dedupKey : String(100);
2151
2145
 
2152
2146
  @title : 'Request'
@@ -2154,7 +2148,7 @@ entity CardanoWalletJobs {
2154
2148
  request : LargeString;
2155
2149
 
2156
2150
  @title : 'Priority'
2157
- @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)'
2158
2152
  priority : Integer default 100;
2159
2153
 
2160
2154
  @title : 'Not Before'
@@ -2170,7 +2164,7 @@ entity CardanoWalletJobs {
2170
2164
  maxAttempts : Integer default 3;
2171
2165
 
2172
2166
  @title : 'Transaction Hash'
2173
- @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'
2174
2168
  txHash : Blake2b256;
2175
2169
 
2176
2170
  @title : 'Unsigned Transaction CBOR'
@@ -2178,7 +2172,7 @@ entity CardanoWalletJobs {
2178
2172
  unsignedTxCbor : LargeString;
2179
2173
 
2180
2174
  @title : 'Signed Transaction CBOR'
2181
- @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)'
2182
2176
  signedTxCbor : LargeString;
2183
2177
 
2184
2178
  @title : 'Fee'
@@ -2186,7 +2180,7 @@ entity CardanoWalletJobs {
2186
2180
  fee : Lovelace;
2187
2181
 
2188
2182
  @title : 'Submitted At'
2189
- @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'
2190
2184
  submittedAt : Timestamp;
2191
2185
 
2192
2186
  @title : 'Confirmed At'
@@ -2194,11 +2188,11 @@ entity CardanoWalletJobs {
2194
2188
  confirmedAt : Timestamp;
2195
2189
 
2196
2190
  @title : 'Confirmed Slot'
2197
- @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'
2198
2192
  confirmedSlot : Integer64;
2199
2193
 
2200
2194
  @title : 'Confirmed Height'
2201
- @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'
2202
2196
  confirmedHeight : Integer64;
2203
2197
 
2204
2198
  @title : 'Error Code'
@@ -2222,16 +2216,8 @@ entity CardanoWalletJobs {
2222
2216
  finishedAt : Timestamp;
2223
2217
  }
2224
2218
 
2225
- /**
2226
- * Agent grants (v2.0): scoped bearer capabilities an Admin hands to an agent
2227
- * instead of a full user. The token is a capability, not an identity — it is
2228
- * stored as SHA-256 only, and a request carrying it runs as the principal
2229
- * `agent:<ID>` with the role `agent-grant`, never as the operator. Enforcement
2230
- * (allow list, wallet pinning, daily budget) lives in srv/utils/agent-grants.ts;
2231
- * the transport lane that admits `x-agent-token` in srv/utils/agent-token-auth.ts.
2232
- * Admin-only table: creation and revocation happen through CardanoAgentService
2233
- * actions, a token request may read its own row only.
2234
- */
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.
2235
2221
  @title : 'Agent Grants'
2236
2222
  @description: 'Scoped, budgeted bearer capabilities for agents (token stored as SHA-256 only)'
2237
2223
  entity CardanoAgentGrants {
@@ -2294,13 +2280,8 @@ entity CardanoAgentGrants {
2294
2280
  lastUsedAt : Timestamp;
2295
2281
  }
2296
2282
 
2297
- /**
2298
- * Daily per-action counters of admitted calls under a grant (feeds
2299
- * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
2300
- * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
2301
- * handler then refuses its input. Not exposed as an entity — the function is
2302
- * the contract. A few dozen rows per grant and day at most; no retention job yet.
2303
- */
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.
2304
2285
  entity CardanoAgentGrantUsage {
2305
2286
 
2306
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.44",
3
+ "version": "2.0.0-rc.46",
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;
@@ -1,16 +1,7 @@
1
1
  import type { Transaction as CapTransaction } from '@sap/cds';
2
2
  import type { Transaction as ProviderTransaction } from '../utils/types';
3
- /**
4
- * CIP-68 decimals of a user token (label 333 or 444) from the crawled chain. `mintTxHash` is the
5
- * token's own mint, tried when AssetHistory has no mint of the reference NFT. null for any other
6
- * unit or when the chain does not answer.
7
- */
8
3
  export declare function cip68Decimals(tx: CapTransaction, unit: string, mintTxHash?: string | null): Promise<number | null>;
9
4
  /** Write `decimals` on every slice of the unit; returns the rows changed. */
10
5
  export declare function setAssetDecimals(tx: CapTransaction, unit: string, decimals: number): Promise<number>;
11
- /**
12
- * Apply the reference datums a block carries: for every output holding a reference NFT, the
13
- * decimals of its datum go to the catalogue rows of the matching user tokens. Returns the rows changed.
14
- */
15
6
  export declare function applyReferenceDatums(tx: CapTransaction, txs: ProviderTransaction[]): Promise<number>;
16
7
  //# sourceMappingURL=asset-decimals.d.ts.map
@@ -16,13 +16,24 @@ async function storedDatum(tx, dataHash) {
16
16
  const row = await tx.run(SELECT.one.from(cardano_1.TransactionDatums).columns('datum').where({ dataHash }));
17
17
  return row?.datum ?? null;
18
18
  }
19
- /**
20
- * Datum on the output that holds a reference NFT now: from the NFT's latest mint, each output is
21
- * followed to the transaction that spent it until an unspent one is reached. A datum given by
22
- * hash is read from TransactionDatums. null when the crawled chain has no trail.
23
- */
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.
24
35
  async function currentReferenceDatum(tx, referenceUnit, mintTxHash) {
25
- const mint = await tx.run(SELECT.one.from(cardano_1.AssetHistory).columns('txHash').where({ unit: referenceUnit, action: 'mint' }).orderBy('blockHeight desc'));
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'));
26
37
  let txHash = mint?.txHash ?? mintTxHash;
27
38
  let datum = null;
28
39
  for (let hop = 0; txHash && hop < MAX_HOPS; hop++) {
@@ -34,7 +45,7 @@ async function currentReferenceDatum(tx, referenceUnit, mintTxHash) {
34
45
  break;
35
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 }));
36
47
  datum = output?.utxo_inlineDatum ?? (output?.utxo_dataHash ? await storedDatum(tx, output.utxo_dataHash) : null) ?? datum;
37
- const spender = await tx.run(SELECT.one.from(cardano_1.TransactionInputs).columns('txSeq').where({ spentTxHash: txHash, spentOutputIndex: holder.output_outputIndex }));
48
+ const spender = await consumingTx(tx, txHash, holder.output_outputIndex);
38
49
  if (spender?.txSeq == null)
39
50
  break;
40
51
  const next = await tx.run(SELECT.one.from(cardano_1.Transactions).columns('hash').where({ txSeq: spender.txSeq }));
@@ -42,11 +53,8 @@ async function currentReferenceDatum(tx, referenceUnit, mintTxHash) {
42
53
  }
43
54
  return datum;
44
55
  }
45
- /**
46
- * CIP-68 decimals of a user token (label 333 or 444) from the crawled chain. `mintTxHash` is the
47
- * token's own mint, tried when AssetHistory has no mint of the reference NFT. null for any other
48
- * unit or when the chain does not answer.
49
- */
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.
50
58
  async function cip68Decimals(tx, unit, mintTxHash = null) {
51
59
  const referenceUnit = (0, cip68_1.cip68ReferenceUnit)(unit);
52
60
  if (!referenceUnit)
@@ -59,10 +67,7 @@ async function setAssetDecimals(tx, unit, decimals) {
59
67
  const changed = await tx.run(UPDATE.entity(cardano_1.Assets).set({ decimals }).where({ unit }));
60
68
  return Number(changed) || 0;
61
69
  }
62
- /**
63
- * Apply the reference datums a block carries: for every output holding a reference NFT, the
64
- * decimals of its datum go to the catalogue rows of the matching user tokens. Returns the rows changed.
65
- */
70
+ // Copy decimals from each reference-NFT datum in a block to the matching user tokens. Returns rows changed.
66
71
  async function applyReferenceDatums(tx, txs) {
67
72
  let changed = 0;
68
73
  for (const t of txs) {
@@ -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
  }