@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
@@ -1,26 +1,18 @@
1
1
  import type { Transaction as CapTransaction } from '@sap/cds';
2
2
  import type { CardanoClient } from './cardano-client';
3
3
  import type { CardanoTransactionBuilder } from './cardano-tx-builder';
4
- import { Transaction as CardanoTransaction, AddressUTxOs, TransactionMetadata, NetworkInformation, Block, Epoch, AssetHistory, Account, Drep, Pool, Asset, Address, LedgerProtocolParameter, AddressTransactions } from '#cds-models/CardanoODataService';
4
+ import { Transaction as CardanoTransaction, type AddressUTxO, TransactionMetadata, NetworkInformation, Block, Epoch, AssetHistory, Account, Drep, Pool, Asset, Address, LedgerProtocolParameter, type AddressTransaction } from '#cds-models/CardanoODataService';
5
5
  import { TransactionBuild, TransactionSubmission } from '#cds-models/CardanoTransactionService';
6
6
  import { TxBuildRequest, TxBuildPlutusRequest, AssetInfo, AccountData, PoolData, NetworkInformation as ProviderNetworkInformation, Address as ProviderAddress, Transaction as ProviderTransaction, UTxO as OdatanoUtxo, BlockData, AssetHistoryEntry as AssetHistoryEntryProviderData, TransactionConfirmations } from '../utils/types';
7
7
  import { type LedgerAnchor, type LedgerLookup } from './ledger-state';
8
8
  import type { TxCacheTargets } from '../utils/tx-build-helper';
9
- /**
10
- * Indexes Cardano data into the OData entities: fetches via CardanoClient, maps provider data
11
- * to entity rows and UPSERTs them inside the caller's CAP transaction.
12
- */
9
+ /** Fetches chain data, maps it to entity rows and UPSERTs them in the caller's transaction. */
13
10
  export declare class CardanoIndexer {
14
11
  private client;
15
12
  private txBuilder;
16
13
  private lastParamsFetchTime;
17
14
  private static readonly CRAWL_EPOCH_REFRESH_MS;
18
15
  private static readonly CRAWL_EPOCH_RETRY_MS;
19
- /**
20
- * Crawler epoch memo: refreshed periodically while an epoch is live and once more when the
21
- * next one starts; holds at most the current and previous epoch. A row is UPSERTed until a
22
- * block transaction that wrote it has committed (`confirmBlockCommit`).
23
- */
24
16
  private crawlEpochCache;
25
17
  private crawlEpochCurrent;
26
18
  /** Epoch rows known to be committed; a refresh creates a new row object and is written again. */
@@ -35,10 +27,7 @@ export declare class CardanoIndexer {
35
27
  private crawlCertificates;
36
28
  /** Logged once per process: the active source reports no certificates (Blockfrost). */
37
29
  private certificatesUnreportedWarned;
38
- /**
39
- * Crawler-fed ledger state (`crawler.utxoSet`): blocks after `utxoAnchor` are applied to the
40
- * Ledger* tables; no anchor means configured but inactive.
41
- */
30
+ /** Blocks after utxoAnchor are applied to the Ledger* tables. Without an anchor the mode is inactive. */
42
31
  private crawlUtxoSet;
43
32
  /** crawler.authoritative: misses in the crawled chain are 404, no provider call. */
44
33
  private crawlAuthoritative;
@@ -49,20 +38,13 @@ export declare class CardanoIndexer {
49
38
  private credentialGeneration;
50
39
  /** The anchor block was found in the crawled chain (checked once, before the first apply). */
51
40
  private utxoAnchorVerified;
52
- /**
53
- * Invalidation decided inside a block transaction; the anchor stays until the crawler confirms
54
- * the commit (`takeLedgerInvalidation`), so a rolled-back attempt changes nothing.
55
- */
41
+ /** Kept until the crawler confirms the block commit, so a rolled-back attempt changes nothing. */
56
42
  private ledgerInvalidation;
57
43
  /** Units known to have an `Assets` row, so a repeat sighting costs no DB round-trip. */
58
44
  private static readonly ASSET_MEMO_CAP;
59
45
  /** Output references per node lookup when checking crawled UTxOs. */
60
46
  private static readonly OUTREF_CHUNK;
61
47
  private assetMemo;
62
- /**
63
- * Background registry enrichment queue (`assetCatalogue: 'enrich'`), drained at a fixed rate
64
- * outside the block transaction. Above the cap the oldest units are dropped (bare row stays).
65
- */
66
48
  private static readonly ENRICH_QUEUE_CAP;
67
49
  private enrichQueue;
68
50
  private enrichTimer;
@@ -76,27 +58,11 @@ export declare class CardanoIndexer {
76
58
  utxoSet?: boolean;
77
59
  authoritative?: boolean;
78
60
  }): void;
79
- /**
80
- * What the crawled data answers authoritatively: only while a live crawler is at the tip.
81
- * Every block after `fromSlot` is held; `ledger` = the crawled UTxO set is active.
82
- */
83
61
  private localCoverage;
84
- /**
85
- * Block counts of a pool from crawled blocks (`slotLeader` = pool id): the current epoch when the
86
- * crawl covers it from its first slot, the lifetime total when it covers the chain since Shelley.
87
- */
88
62
  private localPoolBlocks;
89
- /**
90
- * The crawled chain answers `method` on its own: live crawler at the tip, crawl from the Shelley
91
- * start, and either crawler.authoritative or no configured backend can serve the method.
92
- */
93
63
  private crawlAnswers;
94
64
  /** 404 for a lookup the crawled chain answers on its own (the caller already missed in the DB). */
95
65
  refuseOutsideCrawl(tx: CapTransaction, method: string, what: string): Promise<void>;
96
- /**
97
- * Asset from crawled mint/burn rows: supply = mints − burns, first mint, CIP-25 payload (label 721)
98
- * of the latest mint. Registry fields stay null. null = the crawled chain does not answer.
99
- */
100
66
  private localAssetInfo;
101
67
  /** Address from the crawled UTxO set when it answers, else from the backend. */
102
68
  resolveAddress(tx: CapTransaction, addr: string): Promise<ProviderAddress>;
@@ -112,39 +78,16 @@ export declare class CardanoIndexer {
112
78
  resolveAddressTransactionHashes(tx: CapTransaction, addr: string, limit: number): Promise<string[]>;
113
79
  /** True while the crawled UTxO set answers address queries (live crawler at the tip, set active). */
114
80
  ledgerCoverageActive(tx: CapTransaction): Promise<boolean>;
115
- /**
116
- * Address from the crawled UTxO set: the unspent `LedgerUTxOs` (see openLedgerUtxos), type and
117
- * stake address decoded from the address. An address the set has never
118
- * seen is an empty address, not an error. null = the set cannot answer.
119
- */
120
81
  private localAddress;
121
82
  /** Addresses of a stake key from the crawled UTxO set, with their unspent outputs (one read for all). */
122
83
  private localAccountAddresses;
123
- /**
124
- * Latest transactions of an address from the crawled UTxO set: the outputs it received
125
- * (`LedgerUTxOs.txHash`) and spent (`spentTxHash`) since the anchor. `complete` = the address was
126
- * first seen after the anchor, so nothing older exists. null = the set cannot answer.
127
- */
128
84
  private localAddressTransactions;
129
85
  /** Amount lists (lovelace + assets) of `LedgerUTxOs` rows, keyed `txHash#outputIndex`. */
130
86
  private ledgerAmounts;
131
- /**
132
- * Active stake of a pool from the Ogmios epoch snapshot of the running epoch (constant within
133
- * an epoch). Empty when the crawler is not at the tip or the epoch has no such snapshot.
134
- */
135
87
  private snapshotActiveStake;
136
- /**
137
- * Lifetime withdrawals of a stake key from crawled withdrawals — only when certificates are
138
- * crawled and the crawl covers the chain since Shelley; null otherwise.
139
- */
140
88
  private localWithdrawalsSum;
141
89
  /** The anchor the imported UTxO set describes (null = ledger mode inactive). */
142
90
  setUtxoAnchor(anchor: LedgerAnchor | null): void;
143
- /**
144
- * The imported set describes the chain AT the anchor block, so before the first block past it
145
- * is applied the cursor (not yet advanced in this transaction) must equal the anchor exactly;
146
- * otherwise the snapshot was taken on a fork. Skipped once `utxoAppliedSlot` is set.
147
- */
148
91
  private verifyUtxoAnchor;
149
92
  /** Null while the mode is off, nothing is imported, or an invalidation awaits its commit. */
150
93
  getUtxoAnchor(): LedgerAnchor | null;
@@ -152,84 +95,34 @@ export declare class CardanoIndexer {
152
95
  confirmBlockCommit(): void;
153
96
  /** Hand out a pending invalidation (dropping the anchor) exactly once after the block commit, or null. */
154
97
  takeLedgerInvalidation(): string | null;
155
- /**
156
- * Drain the enrichment queue at `enrichRate` units per second, one `indexAsset()` per tick in
157
- * its own transaction. A failing unit is dropped; its bare row stays for the lazy path.
158
- */
159
98
  private startAssetEnrichment;
160
99
  /** Stop the enrichment loop and forget what is still queued (shutdown, crawler halt, mode change). */
161
100
  stopAssetEnrichment(): void;
162
- /**
163
- * Network-only epoch prefetch for the crawler. Call BEFORE opening the per-block write
164
- * transaction so no backend round-trip runs under the DB write lock. Never throws.
165
- */
166
101
  prefetchCrawlEpoch(epochNumber: number): Promise<void>;
167
102
  private refreshCrawlEpoch;
168
- /**
169
- * Block, transaction and fee totals of an epoch summed over the crawled blocks, when the crawl
170
- * covers the epoch from its first slot; null otherwise. Output and active stake stay with the backend.
171
- */
172
103
  private crawledEpochTotals;
173
104
  /** Epoch row with only the slot-derived bounds, for an epoch the backend cannot describe. */
174
105
  private bareEpochRow;
175
106
  constructor(client: CardanoClient, txBuilder: CardanoTransactionBuilder);
176
- /**
177
- * Unspent outputs of an address from the crawled set for the transaction builder; null = the set
178
- * cannot answer. Runs on `cds.db`, i.e. inside the caller's request transaction when there is one.
179
- */
180
107
  private localAddressUtxos;
181
- /**
182
- * Index a transaction with inputs/outputs/assets/metadata; all UPSERTs run in the caller's
183
- * transaction, so either everything persists or nothing does.
184
- */
108
+ /** All UPSERTs run in the caller's transaction, so everything persists or nothing does. */
185
109
  indexTransaction(tx: CapTransaction, txHash: string): Promise<CardanoTransaction>;
186
110
  /** Lazy path: inputs, outputs, their assets and metadata of one transaction. */
187
111
  private writeTransactionChildren;
188
- /**
189
- * Index address data with assets and UTxOs; transactions are loaded separately via
190
- * indexAddressTransactions(). `prefetched` = address data the caller already fetched in a batch.
191
- */
192
112
  indexAddress(tx: CapTransaction, addr: string, prefetched?: ProviderAddress): Promise<Address>;
193
- /**
194
- * Index UTxOs by 28-byte payment credential (56-char hex), always fresh from Koios. Child
195
- * rows are UPSERTed without a parent Addresses row (same pattern as TransactionInputs).
196
- */
197
- indexCredentialUtxos(tx: CapTransaction, credHash: string): Promise<AddressUTxOs[]>;
198
- /**
199
- * UTxOs of a payment credential without a provider: addresses and unspent outputs from the crawled
200
- * UTxO set (see openLedgerUtxos).
201
- * null = the crawled set cannot answer (not synced, no set, credential column still filling).
202
- * An address first used in the last `confirmationDepth` blocks is not in the set yet.
203
- */
113
+ /** Always fresh from the backend. Rows are written without a parent Addresses row. */
114
+ indexCredentialUtxos(tx: CapTransaction, credHash: string): Promise<AddressUTxO[]>;
204
115
  private localCredentialUtxos;
205
- /**
206
- * Unspent outputs of addresses from the crawled set, checked against the node by output reference
207
- * (a keyed lookup; the node's address query scans its whole UTxO set): drops what was spent after
208
- * the cursor. Without a usable node, or when the check fails, the set as of the cursor.
209
- */
210
116
  private openLedgerUtxos;
211
117
  /** Unspent `LedgerUTxOs` (+ assets) of the given addresses in the provider UTxO shape. */
212
118
  private ledgerUtxosOf;
213
- /**
214
- * True once every Shelley-type `LedgerAddresses` row carries its payment credential. Until then
215
- * the fill runs in the background (started once per process) and callers use the provider.
216
- */
217
119
  paymentCredentialsReady(): Promise<boolean>;
218
120
  /** The ledger tables were replaced (re-import): the credential column has to be filled again. */
219
121
  resetPaymentCredentials(): void;
220
- /**
221
- * Index only the UTxOs of an address via getAddressUtxos (no getAddress call), so it works on
222
- * backends without address aggregation such as Ogmios. Writes no parent Addresses row.
223
- */
224
- indexAddressUtxos(tx: CapTransaction, addr: string): Promise<AddressUTxOs[]>;
225
- /**
226
- * Evict cached rows a submitted transaction made stale: every consumed input ref (under any
227
- * address) and all address-level rows of the output addresses plus `extraAddresses`. Only the
228
- * read cache is touched; lagging backends may still serve pre-submit state on refetch.
229
- */
122
+ indexAddressUtxos(tx: CapTransaction, addr: string): Promise<AddressUTxO[]>;
230
123
  invalidateUtxoCacheForTx(tx: CapTransaction, targets: TxCacheTargets, extraAddresses?: string[]): Promise<void>;
231
124
  /** Index address transactions (separate from indexAddress for lazy loading). */
232
- indexAddressTransactions(tx: CapTransaction, addr: string, limit: number): Promise<AddressTransactions[]>;
125
+ indexAddressTransactions(tx: CapTransaction, addr: string, limit: number): Promise<AddressTransaction[]>;
233
126
  /** Link an address to a signing request for address-based queries. */
234
127
  indexAddressSigningRequests(tx: CapTransaction, addr: string, signingRequestId: string): Promise<void>;
235
128
  /** Link an address to a transaction build for address-based queries. */
@@ -242,64 +135,15 @@ export declare class CardanoIndexer {
242
135
  resolveNetworkInformation(tx: CapTransaction): Promise<ProviderNetworkInformation>;
243
136
  /** Index a block by hash, with best-effort epoch enrichment. */
244
137
  indexBlock(tx: CapTransaction, blockHash: string): Promise<Block>;
245
- /**
246
- * Bulk-index a whole block and its transactions in one pass for the crawler: no per-hash
247
- * re-fetch, one UPSERT per table, all inside the caller's transaction so the block persists
248
- * atomically. Bare chain-sync inputs are backfilled by resolveInputs() first.
249
- */
250
138
  indexBlockFull(tx: CapTransaction, blockData: BlockData, txs: ProviderTransaction[]): Promise<void>;
251
- /**
252
- * Drop other Block rows at the crawled block's height that no transaction references: lazily
253
- * indexed tips that were rolled back, which no crawler reorg covers.
254
- */
255
139
  private removeSupersededBlocks;
256
- /**
257
- * Drop transactions of another fork that hold one of this block's txSeq keys (a lazily indexed
258
- * tx from a rolled-back block at the same slot); their input/output rows would mix with ours.
259
- */
260
140
  private removeStaleTxSeqs;
261
- /**
262
- * Warn once when `crawler.certificates` is on but the source reports none (`certificates`
263
- * undefined, as with Blockfrost). `[]` means "none" and is not a warning.
264
- */
265
141
  private warnIfCertificatesUnreported;
266
- /**
267
- * Backfill address, amount and datum/script fields of bare chain-sync inputs: from this block's
268
- * own outputs first, then the UTxO set, then earlier-indexed outputs from the DB. Inputs that
269
- * already carry an address are skipped.
270
- */
271
142
  resolveInputs(tx: CapTransaction, txs: ProviderTransaction[], ledger?: LedgerLookup): Promise<void>;
272
- /**
273
- * Settle the fee of phase-2-invalid transactions (collateral inputs minus collateral return)
274
- * and the block total. The declared fee is kept when the mapper already set it via
275
- * `total_collateral` or a collateral input is not indexed locally (the sum would be short).
276
- */
277
143
  private applyCollateralFees;
278
- /**
279
- * Mint/burn rows for a block from data in hand: the ledger's mint field when the source
280
- * reports it (Ogmios, Koios), else Σ outputs − Σ inputs per unit, excluding reference and
281
- * collateral inputs. A tx with an unresolvable consumed input is skipped and logged.
282
- */
283
144
  private buildAssetHistoryRows;
284
- /**
285
- * Keep the `Assets` catalogue complete for every unit the crawl meets, without provider calls.
286
- * `Assets` is temporal, key `(validFrom, unit)`: the bare row's fixed epoch-zero stamp never
287
- * aliases an enriched slice, so the UPSERT is safe inside the block transaction. The existence
288
- * check uses the DB-level entity: the service projection's temporal filter hides such rows.
289
- */
290
145
  private ensureAssetRows;
291
- /**
292
- * Remember a unit as present in the catalogue. Insertion-ordered eviction keeps a long
293
- * backfill's memory flat; losing an entry costs one SELECT, never a wrong write.
294
- */
295
146
  private noteAssetSeen;
296
- /**
297
- * Snapshot every pool and DRep for an epoch in its OWN transaction (after the block commit), plus
298
- * one EpochLedgerSnapshots row that marks the epoch as observed. With a block hash and an Ogmios
299
- * backend the node's ledger state AT that block is read; otherwise Koios reports current state
300
- * (and the live `Pools` / `Dreps` rows are refreshed). Neither available: no-op.
301
- * @returns counts written and the source used (null = skipped)
302
- */
303
147
  snapshotEpoch(epoch: number, at: {
304
148
  slot: number;
305
149
  time: number;
@@ -309,16 +153,7 @@ export declare class CardanoIndexer {
309
153
  dreps: number;
310
154
  source: 'ogmios' | 'koios' | null;
311
155
  }>;
312
- /**
313
- * Epoch snapshot from the node's ledger state at block `at`. The live `Pools` / `Dreps` rows are
314
- * NOT refreshed: the acquired state may be hours old. `blocksMinted` counts crawled blocks up to
315
- * `at`, only when the crawl covers the chain since Shelley.
316
- */
317
156
  private snapshotEpochFromLedger;
318
- /**
319
- * Active stake of epoch E = the stake distribution taken at the E-1 boundary, which is the live
320
- * stake the Ogmios snapshot of E-1 recorded at its first block. null without that snapshot.
321
- */
322
157
  private previousLiveStake;
323
158
  /** Crawled blocks per pool up to `slot`; null unless the crawl started at or before Shelley. */
324
159
  private crawledBlocksByPool;
@@ -338,10 +173,7 @@ export declare class CardanoIndexer {
338
173
  resolvePool(tx: CapTransaction, poolId: string): Promise<PoolData>;
339
174
  /** Index an asset by unit (policyId + assetNameHex). */
340
175
  indexAsset(tx: CapTransaction, unit: string): Promise<Asset>;
341
- /**
342
- * Index mint/burn history for an asset, always fresh. Rows are keyed (unit, txHash), so a
343
- * refetch refreshes the recent cap and older cached entries persist.
344
- */
176
+ /** Always fresh. Rows are keyed by unit and tx, so older cached entries persist. */
345
177
  indexAssetHistory(tx: CapTransaction, unit: string, limit?: number): Promise<AssetHistory[]>;
346
178
  /** Build a transaction and persist the build result with inputs/outputs/address association. */
347
179
  private _indexBuildResult;
@@ -359,6 +191,7 @@ export declare class CardanoIndexer {
359
191
  signedTxCbor: string;
360
192
  txHash: string;
361
193
  buildId?: string | null;
194
+ status?: 'pending' | 'submitted';
362
195
  }): Promise<TransactionSubmission>;
363
196
  /** Update a submission's status (two-phase submit: pending → submitted or failed). */
364
197
  updateSubmissionStatus(tx: CapTransaction, submissionId: string, status: TransactionSubmission['status'], errorMessage?: string): Promise<void>;
@@ -444,24 +277,11 @@ export declare class CardanoIndexer {
444
277
  blockHeight: number | null;
445
278
  blockHash: string | null;
446
279
  } | null>;
447
- /**
448
- * Blocks on top of a transaction, its own block included; 0 while it is not on chain.
449
- * A stored row counts only when its block lies in the crawled chain, because the crawler
450
- * removes those rows on a rollback. Otherwise height and tip come from the backends.
451
- */
452
280
  resolveTransactionConfirmations(tx: CapTransaction, txHash: string): Promise<TransactionConfirmations>;
453
281
  /** Height of a transaction in a crawled block and the crawler's tip; null when the crawl does not hold it. */
454
282
  private crawledTransactionDepth;
455
- /**
456
- * Ensure a set of transactions is indexed: DB check, batch fetch of the missing ones, UPSERT.
457
- * @returns provider transactions for the hashes that had to be fetched
458
- */
283
+ /** Batch-fetches the missing ones and returns only those. */
459
284
  ensureTransactionsIndexed(tx: CapTransaction, txHashes: string[]): Promise<Map<string, ProviderTransaction>>;
460
- /**
461
- * Index the addresses of an account with bounded concurrency. The address data the account
462
- * carries (from the backend, or from the crawled set) is used as is, so an account costs no
463
- * request per address; an entry without UTxOs is fetched.
464
- */
465
285
  private _ensureAddresses;
466
286
  }
467
287
  //# sourceMappingURL=cardano-indexer.d.ts.map