@odatano/core 2.0.0-rc.5 → 2.0.0-rc.50

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 (208) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +99 -51
  2. package/@cds-models/CardanoAgentService/index.js +15 -0
  3. package/@cds-models/CardanoBackendService/index.d.ts +347 -0
  4. package/@cds-models/CardanoBackendService/index.js +40 -0
  5. package/@cds-models/CardanoIndexerService/index.d.ts +496 -11
  6. package/@cds-models/CardanoIndexerService/index.js +64 -0
  7. package/@cds-models/CardanoODataService/index.d.ts +414 -57
  8. package/@cds-models/CardanoODataService/index.js +42 -0
  9. package/@cds-models/CardanoSignService/index.d.ts +32 -19
  10. package/@cds-models/CardanoSignService/index.js +3 -0
  11. package/@cds-models/CardanoTransactionService/index.d.ts +58 -44
  12. package/@cds-models/CardanoTransactionService/index.js +4 -0
  13. package/@cds-models/CardanoWorkerService/index.d.ts +7 -22
  14. package/@cds-models/index.d.ts +101 -1
  15. package/@cds-models/index.js +16 -1
  16. package/@cds-models/odatano/cardano/index.d.ts +437 -32
  17. package/@cds-models/odatano/cardano/index.js +48 -0
  18. package/README.md +207 -167
  19. package/db/schema.cds +2402 -1705
  20. package/db/types.cds +446 -295
  21. package/package.json +41 -16
  22. package/scripts/migrate-schema.mjs +334 -0
  23. package/scripts/migrate-slot-leader.mjs +96 -0
  24. package/src/index.d.ts +20 -21
  25. package/src/index.js +45 -31
  26. package/src/plugin.js +17 -35
  27. package/srv/blockchain/asset-decimals.d.ts +7 -0
  28. package/srv/blockchain/asset-decimals.js +91 -0
  29. package/srv/blockchain/backends/blockfrost-backend.d.ts +25 -135
  30. package/srv/blockchain/backends/blockfrost-backend.js +66 -172
  31. package/srv/blockchain/backends/cardano-backend.d.ts +94 -186
  32. package/srv/blockchain/backends/cardano-backend.js +29 -5
  33. package/srv/blockchain/backends/koios-backend.d.ts +103 -168
  34. package/srv/blockchain/backends/koios-backend.js +428 -360
  35. package/srv/blockchain/backends/odatano-backend.d.ts +54 -0
  36. package/srv/blockchain/backends/odatano-backend.js +169 -0
  37. package/srv/blockchain/backends/ogmios-backend.d.ts +123 -190
  38. package/srv/blockchain/backends/ogmios-backend.js +637 -315
  39. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +14 -0
  40. package/srv/blockchain/backends/ogmios-frame-guard.js +89 -0
  41. package/srv/blockchain/cardano-client.d.ts +61 -241
  42. package/srv/blockchain/cardano-client.js +253 -293
  43. package/srv/blockchain/cardano-indexer.d.ts +282 -281
  44. package/srv/blockchain/cardano-indexer.js +1551 -484
  45. package/srv/blockchain/cardano-tx-builder.d.ts +25 -89
  46. package/srv/blockchain/cardano-tx-builder.js +164 -140
  47. package/srv/blockchain/circuit-breaker.d.ts +1 -13
  48. package/srv/blockchain/circuit-breaker.js +5 -15
  49. package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
  50. package/srv/blockchain/crawler/account-snapshots.js +153 -0
  51. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +15 -0
  52. package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
  53. package/srv/blockchain/crawler/asset-registry-backfill.d.ts +43 -0
  54. package/srv/blockchain/crawler/asset-registry-backfill.js +153 -0
  55. package/srv/blockchain/crawler/certificate-backfill.d.ts +52 -0
  56. package/srv/blockchain/crawler/certificate-backfill.js +162 -0
  57. package/srv/blockchain/crawler/crawler.d.ts +104 -81
  58. package/srv/blockchain/crawler/crawler.js +532 -160
  59. package/srv/blockchain/crawler/credential-backfill.d.ts +28 -0
  60. package/srv/blockchain/crawler/credential-backfill.js +124 -0
  61. package/srv/blockchain/crawler/hooks.d.ts +2 -17
  62. package/srv/blockchain/crawler/index.d.ts +1 -8
  63. package/srv/blockchain/crawler/index.js +31 -17
  64. package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
  65. package/srv/blockchain/crawler/input-asset-copies.js +171 -0
  66. package/srv/blockchain/crawler/metadata-position-backfill.d.ts +16 -0
  67. package/srv/blockchain/crawler/metadata-position-backfill.js +55 -0
  68. package/srv/blockchain/crawler/output-datum-backfill.d.ts +39 -0
  69. package/srv/blockchain/crawler/output-datum-backfill.js +110 -0
  70. package/srv/blockchain/crawler/sync-state.d.ts +27 -47
  71. package/srv/blockchain/crawler/sync-state.js +113 -63
  72. package/srv/blockchain/crawler/transaction-backfill.d.ts +44 -0
  73. package/srv/blockchain/crawler/transaction-backfill.js +278 -0
  74. package/srv/blockchain/crawler/utxo-set-import.d.ts +66 -0
  75. package/srv/blockchain/crawler/utxo-set-import.js +399 -0
  76. package/srv/blockchain/ledger-state.d.ts +62 -0
  77. package/srv/blockchain/ledger-state.js +419 -0
  78. package/srv/blockchain/pending-spends.d.ts +16 -0
  79. package/srv/blockchain/pending-spends.js +81 -0
  80. package/srv/blockchain/pool-metadata.d.ts +15 -0
  81. package/srv/blockchain/pool-metadata.js +132 -0
  82. package/srv/blockchain/request-coalescer.d.ts +2 -16
  83. package/srv/blockchain/request-coalescer.js +2 -16
  84. package/srv/blockchain/signing/cose-verifier.d.ts +3 -17
  85. package/srv/blockchain/signing/cose-verifier.js +146 -70
  86. package/srv/blockchain/signing/external-signer.d.ts +15 -115
  87. package/srv/blockchain/signing/external-signer.js +17 -126
  88. package/srv/blockchain/signing/hsm-signer.d.ts +10 -54
  89. package/srv/blockchain/signing/hsm-signer.js +28 -79
  90. package/srv/blockchain/signing/signature-verifier.d.ts +9 -47
  91. package/srv/blockchain/signing/signature-verifier.js +70 -83
  92. package/srv/blockchain/signing/submission-finalizer.d.ts +23 -45
  93. package/srv/blockchain/signing/submission-finalizer.js +219 -86
  94. package/srv/blockchain/stored-chain.d.ts +20 -0
  95. package/srv/blockchain/stored-chain.js +237 -0
  96. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +31 -229
  97. package/srv/blockchain/transaction-building/buildooor-tx.js +652 -416
  98. package/srv/blockchain/transaction-building/cardano-tx.d.ts +9 -37
  99. package/srv/blockchain/transaction-presence.d.ts +5 -0
  100. package/srv/blockchain/transaction-presence.js +29 -0
  101. package/srv/blockchain/transaction-rows.d.ts +12 -0
  102. package/srv/blockchain/transaction-rows.js +44 -0
  103. package/srv/blockchain/wallet-worker/build-request.d.ts +5 -20
  104. package/srv/blockchain/wallet-worker/build-request.js +47 -30
  105. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -46
  106. package/srv/blockchain/wallet-worker/confirmation-tracker.js +25 -45
  107. package/srv/blockchain/wallet-worker/index.d.ts +1 -1
  108. package/srv/blockchain/wallet-worker/index.js +3 -11
  109. package/srv/blockchain/wallet-worker/job-store.d.ts +30 -148
  110. package/srv/blockchain/wallet-worker/job-store.js +101 -201
  111. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -26
  112. package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -28
  113. package/srv/blockchain/wallet-worker/signers.d.ts +5 -24
  114. package/srv/blockchain/wallet-worker/signers.js +4 -12
  115. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +8 -80
  116. package/srv/blockchain/wallet-worker/wallet-worker.js +107 -155
  117. package/srv/cardano-agent-service.cds +122 -84
  118. package/srv/cardano-agent-service.js +4 -9
  119. package/srv/cardano-backend-service.cds +78 -0
  120. package/srv/cardano-backend-service.d.ts +2 -0
  121. package/srv/cardano-backend-service.js +242 -0
  122. package/srv/cardano-indexer-service.cds +387 -73
  123. package/srv/cardano-indexer-service.d.ts +5 -1
  124. package/srv/cardano-indexer-service.js +532 -16
  125. package/srv/cardano-service.cds +424 -269
  126. package/srv/cardano-service.js +289 -201
  127. package/srv/cardano-sign-service.cds +201 -180
  128. package/srv/cardano-sign-service.js +71 -201
  129. package/srv/cardano-tx-service.cds +451 -370
  130. package/srv/cardano-tx-service.js +271 -289
  131. package/srv/cardano-ui.cds +16 -16
  132. package/srv/cardano-worker-service.cds +118 -125
  133. package/srv/cardano-worker-service.js +52 -61
  134. package/srv/cbor/cip68.d.ts +13 -0
  135. package/srv/cbor/cip68.js +56 -0
  136. package/srv/cbor/index.d.ts +3 -1
  137. package/srv/cbor/index.js +9 -1
  138. package/srv/cbor/parse.d.ts +30 -18
  139. package/srv/cbor/parse.js +44 -9
  140. package/srv/cbor/plutus-data-json.d.ts +20 -0
  141. package/srv/cbor/plutus-data-json.js +32 -0
  142. package/srv/config.d.ts +113 -0
  143. package/srv/config.js +409 -0
  144. package/srv/server.d.ts +15 -110
  145. package/srv/server.js +84 -404
  146. package/srv/utils/agent-access.d.ts +9 -0
  147. package/srv/utils/agent-access.js +67 -0
  148. package/srv/utils/agent-grants-config.d.ts +0 -46
  149. package/srv/utils/agent-grants-config.js +17 -85
  150. package/srv/utils/agent-grants.d.ts +106 -122
  151. package/srv/utils/agent-grants.js +538 -236
  152. package/srv/utils/agent-token-auth.d.ts +4 -99
  153. package/srv/utils/agent-token-auth.js +18 -182
  154. package/srv/utils/backend-request-handler.d.ts +3 -17
  155. package/srv/utils/backend-request-handler.js +3 -18
  156. package/srv/utils/collections.d.ts +3 -10
  157. package/srv/utils/collections.js +3 -10
  158. package/srv/utils/const.d.ts +23 -74
  159. package/srv/utils/const.js +32 -79
  160. package/srv/utils/crypto.d.ts +3 -12
  161. package/srv/utils/crypto.js +6 -21
  162. package/srv/utils/db-indexes.d.ts +27 -0
  163. package/srv/utils/db-indexes.js +120 -0
  164. package/srv/utils/db-sanitize.d.ts +20 -0
  165. package/srv/utils/db-sanitize.js +80 -0
  166. package/srv/utils/deep-json.d.ts +6 -0
  167. package/srv/utils/deep-json.js +240 -0
  168. package/srv/utils/epoch-slots.d.ts +13 -0
  169. package/srv/utils/epoch-slots.js +38 -0
  170. package/srv/utils/error-codes.d.ts +22 -75
  171. package/srv/utils/error-codes.js +23 -72
  172. package/srv/utils/errors.d.ts +46 -187
  173. package/srv/utils/errors.js +114 -230
  174. package/srv/utils/liveness.d.ts +12 -0
  175. package/srv/utils/liveness.js +35 -0
  176. package/srv/utils/mappers.d.ts +102 -223
  177. package/srv/utils/mappers.js +387 -316
  178. package/srv/utils/network-context.js +2 -13
  179. package/srv/utils/paging.d.ts +31 -0
  180. package/srv/utils/paging.js +43 -0
  181. package/srv/utils/pg-inline-json.d.ts +8 -0
  182. package/srv/utils/pg-inline-json.js +58 -0
  183. package/srv/utils/pg-order-nulls.d.ts +14 -0
  184. package/srv/utils/pg-order-nulls.js +54 -0
  185. package/srv/utils/plutus-placeholders.d.ts +16 -22
  186. package/srv/utils/plutus-placeholders.js +62 -33
  187. package/srv/utils/rate-limiter.d.ts +2 -21
  188. package/srv/utils/rate-limiter.js +5 -17
  189. package/srv/utils/readiness.d.ts +12 -0
  190. package/srv/utils/readiness.js +29 -0
  191. package/srv/utils/reference-script.d.ts +19 -0
  192. package/srv/utils/reference-script.js +84 -0
  193. package/srv/utils/result-numbers.d.ts +15 -0
  194. package/srv/utils/result-numbers.js +61 -0
  195. package/srv/utils/service-events.d.ts +0 -24
  196. package/srv/utils/service-events.js +3 -25
  197. package/srv/utils/signing-helper.d.ts +3 -20
  198. package/srv/utils/signing-helper.js +35 -64
  199. package/srv/utils/tx-build-helper.d.ts +10 -105
  200. package/srv/utils/tx-build-helper.js +81 -144
  201. package/srv/utils/tx-request-parsers.d.ts +82 -33
  202. package/srv/utils/tx-request-parsers.js +401 -49
  203. package/srv/utils/tx-utils.d.ts +3 -27
  204. package/srv/utils/tx-utils.js +32 -50
  205. package/srv/utils/types.d.ts +261 -191
  206. package/srv/utils/types.js +2 -6
  207. package/srv/utils/validators.d.ts +22 -92
  208. package/srv/utils/validators.js +50 -149
@@ -1,285 +1,309 @@
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
- import { TxBuildRequest, Transaction as ProviderTransaction, BlockData } from '../utils/types';
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
+ import { type LedgerAnchor, type LedgerLookup } from './ledger-state';
7
8
  import type { TxCacheTargets } from '../utils/tx-build-helper';
8
- /**
9
- * CardanoIndexer - Indexer for Cardano blockchain data into OData entities
10
- *
11
- * Provides methods to index & manage db consistency for various Cardano blockchain data (transactions, addresses, blocks, epochs, accounts, pools, dreps)
12
- * 1. Fetches data from the configured Cardano data provider via the CardanoClient
13
- * 2. Maps the provider data into corresponding OData entity rows
14
- * 3. Upserts the data rows into the database via CAP transactions
15
- * 4. Ensures referential integrity and consistency across related entities (e.g., addresses in transactions, UTxOs in addresses)
16
- * 5. Returns the indexed entity data for further processing
17
- *
18
- * Each method corresponds to a specific Cardano Entity type and handles the necessary mapping and persistence
19
- * into the corresponding OData entities defined in the CardanoODataService(M1) and CardanoTransactionService(M2) models.
20
- */
9
+ /** Newest transactions of an address as read: the rows to answer with and what is not stored yet. */
10
+ export interface FetchedAddressTransactions {
11
+ rows: AddressTransaction[];
12
+ newRows: AddressTransaction[];
13
+ transactions: Map<string, ProviderTransaction>;
14
+ }
15
+ /** An address as read; `transactions` is null when their read failed. */
16
+ export interface FetchedAddress {
17
+ address: string;
18
+ data: ProviderAddress;
19
+ transactions: FetchedAddressTransactions | null;
20
+ }
21
+ /** An account as read, with the addresses it controls. */
22
+ export interface FetchedAccount {
23
+ account: AccountData;
24
+ addresses: FetchedAddress[];
25
+ }
26
+ /** A block as read; `epoch` is missing when the backend has no data for its epoch. */
27
+ export interface FetchedBlock {
28
+ block: BlockData;
29
+ epoch?: Epoch;
30
+ }
31
+ /** Metadata of a transaction as the backend reports it. */
32
+ export interface FetchedTransactionMetadata {
33
+ txHash: string;
34
+ metadata: Awaited<ReturnType<CardanoClient['getTransactionMetadata']>>;
35
+ }
36
+ /** Progress of backfillEpochs. */
37
+ export interface EpochBackfillProgress {
38
+ atEpoch: number;
39
+ toEpoch: number;
40
+ updated: number;
41
+ created: number;
42
+ }
43
+ /** Protocol parameters; `fresh` is false when the stored row was still current. */
44
+ export interface FetchedProtocolParameters {
45
+ row: LedgerProtocolParameter;
46
+ fresh: boolean;
47
+ }
48
+ /** Fetches chain data, maps it to entity rows and UPSERTs them in the caller's transaction. */
21
49
  export declare class CardanoIndexer {
22
50
  private client;
23
51
  private txBuilder;
24
52
  private lastParamsFetchTime;
25
53
  private static readonly CRAWL_EPOCH_REFRESH_MS;
26
54
  private static readonly CRAWL_EPOCH_RETRY_MS;
27
- /**
28
- * Crawler epoch memo. Network reads are refreshed periodically while an epoch is
29
- * live and once more when the next epoch starts, so counters such as block_count,
30
- * fees and lastBlockTime do not remain frozen at their first observed value.
31
- *
32
- * At most the current and immediately previous epoch are retained. The rows are
33
- * intentionally UPSERTed in every block transaction: the caller owns that
34
- * transaction, so an in-memory "persisted" bit cannot know whether its commit later
35
- * succeeded. Repeating one local UPSERT is cheap and remains correct after rollback.
36
- */
37
55
  private crawlEpochCache;
38
56
  private crawlEpochCurrent;
57
+ /** Epoch rows known to be committed; a refresh creates a new row object and is written again. */
58
+ private crawlEpochWritten;
59
+ /** Memo updates of the running block transaction, applied only after its commit. */
60
+ private pendingCommit;
39
61
  private crawlEpochPrevious;
40
- /**
41
- * Network-only epoch prefetch for the crawler. Call BEFORE opening the per-block
42
- * write transaction — the backend round-trip must never run while the DB write
43
- * lock is held (indexBlockFull then serves the epoch from this memo). Never throws.
44
- */
62
+ /** Analytics coverage of the crawl path; defaults mirror the crawler config defaults. */
63
+ private crawlAssetHistory;
64
+ private crawlAssetCatalogue;
65
+ /** Certificates + withdrawals per block (ledger-state coverage). Opt-in. */
66
+ private crawlCertificates;
67
+ /** Logged once per process: the active source reports no certificates (Blockfrost). */
68
+ private certificatesUnreportedWarned;
69
+ /** Blocks after utxoAnchor are applied to the Ledger* tables. Without an anchor the mode is inactive. */
70
+ private crawlUtxoSet;
71
+ /** crawler.authoritative: misses in the crawled chain are 404, no provider call. */
72
+ private crawlAuthoritative;
73
+ /** crawler.inputAssetCopies: every crawled input keeps a copy of its assets and points at no output. */
74
+ private crawlInputAssetCopies;
75
+ private utxoAnchor;
76
+ /** `LedgerAddresses.paymentCredential` is complete; the running fill and its table generation. */
77
+ private credentialsReady;
78
+ private credentialFill;
79
+ private credentialGeneration;
80
+ /** The anchor block was found in the crawled chain (checked once, before the first apply). */
81
+ private utxoAnchorVerified;
82
+ /** Kept until the crawler confirms the block commit, so a rolled-back attempt changes nothing. */
83
+ private ledgerInvalidation;
84
+ /** Load pool metadata files from their registered URL. Off unless configured. */
85
+ private poolMetadataFetch;
86
+ private poolMetadataByHash;
87
+ private static readonly POOL_METADATA_MEMO_CAP;
88
+ /** Units known to have an `Assets` row, so a repeat sighting costs no DB round-trip. */
89
+ private static readonly ASSET_MEMO_CAP;
90
+ /** Output references per node lookup when checking crawled UTxOs. */
91
+ private static readonly OUTREF_CHUNK;
92
+ private assetMemo;
93
+ private static readonly ENRICH_QUEUE_CAP;
94
+ private enrichQueue;
95
+ private enrichTimer;
96
+ private enrichRate;
97
+ /** Adopt the crawler's coverage settings; the lazy request path never touches these. */
98
+ configureCrawlCoverage(coverage: {
99
+ assetHistory: boolean;
100
+ assetCatalogue: 'off' | 'bare' | 'enrich';
101
+ assetEnrichRate?: number;
102
+ certificates?: boolean;
103
+ utxoSet?: boolean;
104
+ authoritative?: boolean;
105
+ inputAssetCopies?: boolean;
106
+ }): void;
107
+ private localCoverage;
108
+ private localPoolBlocks;
109
+ private crawlAnswers;
110
+ /** 404 for a lookup the crawled chain answers on its own (the caller already missed in the DB). */
111
+ refuseOutsideCrawl(tx: CapTransaction, method: string, what: string): Promise<void>;
112
+ private localAssetInfo;
113
+ /** Address from the crawled UTxO set when it answers, else from the backend. */
114
+ resolveAddress(tx: CapTransaction, addr: string): Promise<ProviderAddress>;
115
+ /** UTxOs of an address: the crawled set (checked unspent at the node) when it answers, else the backend. */
116
+ resolveAddressUtxos(tx: CapTransaction, addr: string): Promise<OdatanoUtxo[]>;
117
+ /** Asset from the crawled chain when it answers, else from the backend. */
118
+ resolveAssetInfo(tx: CapTransaction, unit: string): Promise<AssetInfo>;
119
+ /** Stored mint/burn rows, newest first. Null when the crawled chain does not answer for them. */
120
+ private crawledAssetHistory;
121
+ /** Mint/burn events, newest first: crawled rows when the crawled chain answers, else the backend. */
122
+ resolveAssetHistory(tx: CapTransaction, unit: string, limit: number): Promise<AssetHistoryEntryProviderData[]>;
123
+ /** UTxOs of a payment credential: the crawled set when it answers, else Koios. */
124
+ resolveCredentialUtxos(tx: CapTransaction, credHash: string): Promise<OdatanoUtxo[]>;
125
+ /** Latest transaction hashes of an address: the crawled set when it has enough, else the backend. */
126
+ resolveAddressTransactionHashes(tx: CapTransaction, addr: string, limit: number): Promise<string[]>;
127
+ /** True while the crawled UTxO set answers address queries (live crawler at the tip, set active). */
128
+ ledgerCoverageActive(tx: CapTransaction): Promise<boolean>;
129
+ private localAddress;
130
+ /** Addresses of a stake key in the crawled UTxO set, with their stored unspent outputs (one read for all). */
131
+ private ledgerAccountUtxos;
132
+ private localAddressTransactions;
133
+ /** Amount lists (lovelace + assets) of `LedgerUTxOs` rows, keyed `txHash#outputIndex`. */
134
+ private ledgerAmounts;
135
+ private snapshotActiveStake;
136
+ private localWithdrawalsSum;
137
+ /** The anchor the imported UTxO set describes (null = ledger mode inactive). */
138
+ setUtxoAnchor(anchor: LedgerAnchor | null): void;
139
+ private verifyUtxoAnchor;
140
+ /** Null while the mode is off, nothing is imported, or an invalidation awaits its commit. */
141
+ getUtxoAnchor(): LedgerAnchor | null;
142
+ /** Apply the memo updates of the block transaction that just committed. */
143
+ confirmBlockCommit(): void;
144
+ /** Hand out a pending invalidation (dropping the anchor) exactly once after the block commit, or null. */
145
+ takeLedgerInvalidation(): string | null;
146
+ private startAssetEnrichment;
147
+ /** Stop the enrichment loop and forget what is still queued (shutdown, crawler halt, mode change). */
148
+ stopAssetEnrichment(): void;
45
149
  prefetchCrawlEpoch(epochNumber: number): Promise<void>;
46
150
  private refreshCrawlEpoch;
47
- /**
48
- * Create a new CardanoIndexer instance
49
- * @param client - The CardanoClient instance for blockchain queries
50
- * @param txBuilder - The CardanoTransactionBuilder instance for transaction building
51
- */
151
+ private crawledEpochTotals;
152
+ /** Epoch row with only the slot-derived bounds, for an epoch the backend cannot describe. */
153
+ private bareEpochRow;
154
+ backfillEpochs(onProgress?: (p: EpochBackfillProgress) => void): Promise<EpochBackfillProgress>;
52
155
  constructor(client: CardanoClient, txBuilder: CardanoTransactionBuilder);
53
- /**
54
- * Index & return a single transaction with inputs/outputs/assets/UTxOs/addresses
55
- * All UPSERTs execute within the same CAP transaction (cds.tx), which ensures
56
- * atomicity: either all entities are persisted or none are (automatic rollback on error).
57
- * @param tx CAP transaction (cds.tx(req))
58
- * @param txHash Cardano transaction hash (hex)
59
- * @returns {Promise<CardanoTransaction>} transaction entity data
60
- */
156
+ private localAddressUtxos;
157
+ /** A transaction from the backend. 404 when the crawled chain answers for it alone. */
158
+ fetchTransaction(tx: CapTransaction, txHash: string): Promise<ProviderTransaction>;
159
+ /** All UPSERTs run in the caller's transaction, so everything persists or nothing does. */
160
+ storeTransaction(tx: CapTransaction, providerTx: ProviderTransaction): Promise<CardanoTransaction>;
161
+ /** Reads a transaction from the backend and stores it. */
61
162
  indexTransaction(tx: CapTransaction, txHash: string): Promise<CardanoTransaction>;
62
- /**
63
- * Index & return address data with assets and UTxOs (without transactions)
64
- * Transactions are loaded separately via indexAddressTransactions() for better performance
65
- * @param tx CAP transaction
66
- * @param addr bech32 address
67
- * @return {Promise<Address>} address entity data
68
- */
69
- indexAddress(tx: CapTransaction, addr: string): Promise<Address>;
70
- /**
71
- * Index UTxOs by 28-byte payment credential. Always-fresh fetch from Koios
72
- * (bypasses cache) — credential queries serve dApp-state use cases that require
73
- * current data. Underlying AddressUTxOs/UTxOAssets rows are UPSERTed and stay
74
- * available for follow-up address-keyed queries within the TTL.
75
- *
76
- * Does NOT upsert parent Addresses rows; child rows reference bech32 addresses
77
- * that may not yet have a parent stub. Same pattern as TransactionInputs.
78
- *
79
- * @param tx CAP transaction
80
- * @param credHash 28-byte payment credential as 56-char lowercase hex
81
- * @return UTxO entity rows across all bech32 addresses sharing the credential
82
- */
83
- indexCredentialUtxos(tx: CapTransaction, credHash: string): Promise<AddressUTxOs[]>;
84
- /**
85
- * Index ONLY the UTxOs at a bech32 address via getAddressUtxos — deliberately
86
- * WITHOUT a getAddress (address-detail) call, so it works on backends that serve
87
- * the live UTxO set but not address aggregation (e.g. Ogmios). Used as the
88
- * GetUTxOsByAddress fallback when no configured backend supports getAddress.
89
- *
90
- * Does NOT upsert a parent Addresses row (same pattern as indexCredentialUtxos);
91
- * AddressUTxOs/UTxOAssets reference the bech32 address directly.
92
- *
93
- * @param tx CAP transaction
94
- * @param addr bech32 address
95
- * @return UTxO entity rows for the address (empty when the address holds none)
96
- */
97
- indexAddressUtxos(tx: CapTransaction, addr: string): Promise<AddressUTxOs[]>;
98
- /**
99
- * Evict cached rows a submitted transaction made stale, so the next read
100
- * refetches instead of serving spent UTxOs for up to indexTtlMs:
101
- * - every consumed input ref (spent under WHATEVER address cached it),
102
- * - all address-level rows of the output addresses (their UTxO set gained
103
- * the new outputs — sender change included) and of `extraAddresses`
104
- * (e.g. the build's sender when the CBOR could not be parsed).
105
- *
106
- * Only the read cache is touched; submissions/builds stay untouched. Note the
107
- * next refetch may STILL see pre-submit state on lagging backends
108
- * (Blockfrost/Koios propagation) — that matches cache-less behaviour and is
109
- * not recoverable server-side.
110
- *
111
- * @param tx CAP transaction
112
- * @param targets input refs + output addresses from extractTxCacheTargets
113
- * @param extraAddresses additional bech32 addresses to evict
114
- */
163
+ /** Lazy path: inputs, outputs, their assets and metadata of one transaction. */
164
+ private writeTransactionChildren;
165
+ fetchAddress(tx: CapTransaction, addr: string, prefetched?: ProviderAddress): Promise<FetchedAddress>;
166
+ /** Reads an address and its newest transactions, then stores them. */
167
+ indexAddress(tx: CapTransaction, addr: string, prefetched?: ProviderAddress): Promise<Address>;
168
+ /** Stores what fetchAddress read: the address, its assets, UTxOs and newest transactions. */
169
+ storeAddress(tx: CapTransaction, fetched: FetchedAddress): Promise<Address>;
170
+ /** UTxOs of a payment credential, always fresh: the crawled set when it answers, else the backend. */
171
+ fetchCredentialUtxos(tx: CapTransaction, credHash: string): Promise<OdatanoUtxo[]>;
172
+ /** Reads the UTxOs of a payment credential and stores them. */
173
+ indexCredentialUtxos(tx: CapTransaction, credHash: string): Promise<AddressUTxO[]>;
174
+ /** Stores credential UTxOs. Rows are written without a parent Addresses row. */
175
+ storeCredentialUtxos(tx: CapTransaction, utxos: OdatanoUtxo[]): Promise<AddressUTxO[]>;
176
+ private localCredentialUtxos;
177
+ private unspentAtNode;
178
+ /** Unspent `LedgerUTxOs` (+ assets) of the given addresses in the provider UTxO shape. */
179
+ private ledgerUtxosOf;
180
+ paymentCredentialsReady(): Promise<boolean>;
181
+ /** The ledger tables were replaced (re-import): the credential column has to be filled again. */
182
+ resetPaymentCredentials(): void;
183
+ indexAddressUtxos(tx: CapTransaction, addr: string): Promise<AddressUTxO[]>;
184
+ /** The UTxOs of an address from the backend. */
185
+ fetchAddressUtxos(addr: string): Promise<OdatanoUtxo[]>;
186
+ /** Stores the UTxOs of an address. Writes no parent Addresses row. */
187
+ storeAddressUtxos(tx: CapTransaction, addr: string, utxos: OdatanoUtxo[]): Promise<AddressUTxO[]>;
115
188
  invalidateUtxoCacheForTx(tx: CapTransaction, targets: TxCacheTargets, extraAddresses?: string[]): Promise<void>;
116
- /**
117
- * Index & return address transactions (separate from indexAddress for lazy loading)
118
- * @param tx CAP transaction
119
- * @param addr bech32 address
120
- * @param limit maximum number of transactions to fetch
121
- * @return {Promise<AddressTransactions[]>} address transaction entities
122
- */
123
- indexAddressTransactions(tx: CapTransaction, addr: string, limit: number): Promise<AddressTransactions[]>;
124
- /**
125
- * Index & return address signing request association
126
- * Links an address to a signing request for address-based queries
127
- * @param tx CAP transaction
128
- * @param addr bech32 address
129
- * @param signingRequestId signing request UUID
130
- * @return {Promise<void>}
131
- */
189
+ /** Index address transactions (separate from indexAddress for lazy loading). */
190
+ indexAddressTransactions(tx: CapTransaction, addr: string, limit: number): Promise<AddressTransaction[]>;
191
+ fetchAddressTransactions(tx: CapTransaction, addr: string, limit: number): Promise<FetchedAddressTransactions>;
192
+ storeAddressTransactions(tx: CapTransaction, fetched: FetchedAddressTransactions): Promise<AddressTransaction[]>;
193
+ /** Link an address to a signing request for address-based queries. */
132
194
  indexAddressSigningRequests(tx: CapTransaction, addr: string, signingRequestId: string): Promise<void>;
133
- /**
134
- * Index & return address transaction build association
135
- * Links an address to a transaction build for address-based queries
136
- * @param tx CAP transaction
137
- * @param addr bech32 address
138
- * @param buildId transaction build UUID
139
- * @return {Promise<void>}
140
- */
195
+ /** Link an address to a transaction build for address-based queries. */
141
196
  indexAddressTransactionBuilds(tx: CapTransaction, addr: string, buildId: string): Promise<void>;
142
- /**
143
- * Index & return metadata for a single transaction (Metadata)
144
- * @param tx CAP transaction
145
- * @param txHash transaction hash
146
- * @param metadata raw metadata object (label -> JSONValue)
147
- * @return {Promise<TransactionMetadata[]>} array of transaction metadata rows
148
- */
197
+ /** Index the metadata rows of a transaction. */
149
198
  indexTransactionMetadata(tx: CapTransaction, tx_hash: string): Promise<TransactionMetadata[]>;
150
- /**
151
- * Index & return the network information data
152
- * @param tx CAP transaction object
153
- * @returns {Promise<NetworkInformation>} network information entity data
154
- */
199
+ /** Metadata of a transaction from the backend. Null when the transaction is known to have none. */
200
+ fetchTransactionMetadata(tx: CapTransaction, tx_hash: string): Promise<FetchedTransactionMetadata | null>;
201
+ /** Stores the metadata rows of a transaction and returns them. */
202
+ storeTransactionMetadata(tx: CapTransaction, fetched: FetchedTransactionMetadata | null): Promise<TransactionMetadata[]>;
203
+ /** Index the network information; circulating supply comes from the crawled UTxO set when it is current. */
155
204
  indexNetworkInformation(tx: CapTransaction): Promise<NetworkInformation>;
156
- /**
157
- * Index & return the block information data
158
- * @param tx CAP transaction object
159
- * @param blockHash block hash (hex)
160
- * @returns {Promise<Block>} block entity data
161
- */
205
+ /** The network information row, read but not stored. */
206
+ fetchNetworkInformation(tx: CapTransaction): Promise<NetworkInformation>;
207
+ storeNetworkInformation(tx: CapTransaction, netEntity: NetworkInformation): Promise<NetworkInformation>;
208
+ /** Network information from the backend; circulating supply from the crawled UTxO set when current. */
209
+ resolveNetworkInformation(tx: CapTransaction): Promise<ProviderNetworkInformation>;
210
+ /** Index a block by hash, with best-effort epoch enrichment. */
162
211
  indexBlock(tx: CapTransaction, blockHash: string): Promise<Block>;
163
- /**
164
- * Bulk-index a whole block and all of its transactions in ONE pass (chain crawler,
165
- * v2.0). Unlike indexTransaction()/indexBlock() this does NOT re-fetch per hash — the
166
- * crawler already carries the block + full tx list from the stream/page. Rows are
167
- * accumulated across the block's txs and UPSERTed once per table (few statements).
168
- *
169
- * All writes run inside the caller's CAP transaction (`tx`), so a block is persisted
170
- * atomically — a failure mid-block rolls the whole block back, keeping the cursor and
171
- * the data consistent.
172
- *
173
- * Inputs from the Ogmios chain-sync path arrive as bare references (no address/amount);
174
- * resolveInputs() backfills them from this block's own outputs and previously-indexed
175
- * outputs before mapping. Blockfrost/Koios inputs already carry address/amount and are
176
- * left untouched.
177
- *
178
- * @param tx CAP transaction (one per block, committed by the crawler)
179
- * @param blockData block header/summary from the crawler source
180
- * @param txs the block's full transaction list (in block order)
181
- */
212
+ /** A block and its epoch from the backend. 404 when the crawled chain answers for it alone. */
213
+ fetchBlock(tx: CapTransaction, blockHash: string): Promise<FetchedBlock>;
214
+ private withEpoch;
215
+ /** Stores a block and, when it was read, its epoch. */
216
+ storeBlock(tx: CapTransaction, fetched: FetchedBlock): Promise<Block>;
182
217
  indexBlockFull(tx: CapTransaction, blockData: BlockData, txs: ProviderTransaction[]): Promise<void>;
183
- /**
184
- * Backfill input address/amount for chain-sync transactions whose inputs are bare
185
- * references. Resolves first from this block's own outputs (a tx may spend an earlier
186
- * tx's output in the same block), then batch-reads previously-indexed outputs from the
187
- * DB. Inputs that already carry an address (Blockfrost/Koios) are skipped.
188
- */
189
- private resolveInputs;
190
- /**
191
- * Index & return the epoch information data
192
- * @param tx CAP transaction object
193
- * @param epochNumber epoch number
194
- * @returns {Promise<Epoch>} epoch entity data
195
- */
218
+ private removeSupersededBlocks;
219
+ private removeStaleTxSeqs;
220
+ private warnIfCertificatesUnreported;
221
+ resolveInputs(tx: CapTransaction, txs: ProviderTransaction[], ledger?: LedgerLookup): Promise<void>;
222
+ private referenceStoredOutputs;
223
+ private applyDeposits;
224
+ private applyCollateralFees;
225
+ private buildAssetHistoryRows;
226
+ private ensureAssetRows;
227
+ private noteAssetSeen;
228
+ snapshotEpoch(epoch: number, at: {
229
+ slot: number;
230
+ time: number;
231
+ hash?: string | null;
232
+ }): Promise<{
233
+ pools: number;
234
+ dreps: number;
235
+ source: 'ogmios' | 'koios' | null;
236
+ }>;
237
+ private snapshotEpochFromLedger;
238
+ private previousLiveStake;
239
+ /** Crawled blocks per pool up to `slot`; null unless the crawl started at or before Shelley. */
240
+ private crawledBlocksByPool;
241
+ /** Every native-asset unit a block touches: outputs, consumed inputs and mint/burn rows. */
242
+ private collectBlockUnits;
243
+ /** Index an epoch by number. */
196
244
  indexEpoch(tx: CapTransaction, epochNumber: number): Promise<Epoch>;
197
- /**
198
- * Index & return the account information data
199
- * @param tx CAP transaction object
200
- * @param stakeAddress stake address (bech32)
201
- * @returns {Promise<Account>} account entity data
202
- */
245
+ /** An epoch row from the backend. */
246
+ fetchEpoch(epochNumber: number): Promise<Epoch>;
247
+ storeEpoch(tx: CapTransaction, epochEntity: Epoch): Promise<Epoch>;
248
+ /** Index an account by stake address, plus its addresses when it has any. */
203
249
  indexAccount(tx: CapTransaction, stakeAddress: string): Promise<Account>;
204
- /**
205
- * Index & return the drep information data
206
- * @param tx CAP transaction object
207
- * @param drepId drep id (bech32)
208
- * @returns {Promise<Drep>} drep entity data
209
- */
250
+ /** An account and the addresses it controls, read but not stored. */
251
+ fetchAccount(tx: CapTransaction, stakeAddress: string): Promise<FetchedAccount>;
252
+ /** Stores what fetchAccount read. */
253
+ storeAccount(tx: CapTransaction, fetched: FetchedAccount): Promise<Account>;
254
+ /** Account from the backend with the crawled overlays (controlled amount, withdrawals). */
255
+ resolveAccount(tx: CapTransaction, stakeAddress: string): Promise<AccountData>;
256
+ /** Index a DRep by bech32 id. */
210
257
  indexDrep(tx: CapTransaction, drepId: string): Promise<Drep>;
211
- /**
212
- * Index & return the pool information data
213
- * @param tx CAP transaction object
214
- * @param poolId pool id (hex)
215
- * @returns {Promise<Pool>} pool entity data
216
- */
258
+ /** A DRep row from the backend. */
259
+ fetchDrep(drepId: string): Promise<Drep>;
260
+ storeDrep(tx: CapTransaction, drepEntity: Drep): Promise<Drep>;
261
+ /** Index a pool by id. */
217
262
  indexPool(tx: CapTransaction, poolId: string): Promise<Pool>;
218
- /**
219
- * Index & return the asset information data
220
- * @param tx CAP transaction object
221
- * @param unit asset unit (policyId + assetNameHex)
222
- * @returns {Promise<Asset>} asset entity data
223
- */
263
+ /** A pool row, read but not stored. */
264
+ fetchPool(tx: CapTransaction, poolId: string): Promise<Pool>;
265
+ storePool(tx: CapTransaction, poolEntity: Pool): Promise<Pool>;
266
+ /** Pool from the backend with crawled block counts, the snapshot's active stake and its metadata file. */
267
+ resolvePool(tx: CapTransaction, poolId: string): Promise<PoolData>;
268
+ private poolMetadataOf;
269
+ /** Turns the loading of pool metadata files on or off (`poolMetadataFetch`). */
270
+ setPoolMetadataFetch(enabled: boolean): void;
271
+ /** Index an asset by unit (policyId + assetNameHex). */
224
272
  indexAsset(tx: CapTransaction, unit: string): Promise<Asset>;
225
- /**
226
- * Index & return mint/burn history for an asset. Always-fresh from the
227
- * preferred backend (Koios for block timestamps, Blockfrost as fallback).
228
- * UPSERTs entries by (unit, txHash) — events are immutable, so re-fetching
229
- * just refreshes the cap of recent entries; older cached entries persist.
230
- * @param tx CAP transaction object
231
- * @param unit asset unit (policyId + assetNameHex)
232
- * @param limit max number of recent events to fetch (default 100)
233
- * @returns {Promise<AssetHistory[]>} list of mint/burn event entity rows
234
- */
273
+ /** Stores an asset read with resolveAssetInfo. */
274
+ storeAsset(tx: CapTransaction, assetInfo: AssetInfo): Promise<Asset>;
275
+ /** Like indexAsset, but always from the backend: the crawled chain has no CIP-26 registry fields. */
276
+ indexAssetFromBackend(tx: CapTransaction, unit: string): Promise<Asset>;
277
+ private writeAsset;
278
+ /** Always fresh. Rows are keyed by unit and tx, so older cached entries persist. */
235
279
  indexAssetHistory(tx: CapTransaction, unit: string, limit?: number): Promise<AssetHistory[]>;
236
- /**
237
- * Common method: build a transaction, persist build result with inputs/outputs/address associations.
238
- * All four public indexBuild*Result methods delegate to this to eliminate duplication.
239
- * @param tx CAP transaction object
240
- * @param buildreq transaction build request data
241
- * @param buildFn the specific builder method to call
242
- * @returns {Promise<TransactionBuild>} transaction build entity data
243
- */
280
+ /** Build a transaction and persist the build result with inputs/outputs/address association. */
244
281
  private _indexBuildResult;
245
282
  indexSimpleBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
246
283
  indexMetadataBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
247
284
  indexMultiAssetBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
248
285
  indexMintBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
249
286
  indexPlutusSpendBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
250
- /**
251
- * Index & return the protocol parameters data
252
- * @param tx CAP transaction object
253
- * @returns {Promise<LedgerProtocolParameter>} protocol parameters entity data
254
- */
287
+ /** BuildPlutusTransaction: several script inputs; the redeemers are stored with the build. */
288
+ indexPlutusBuildResult(tx: CapTransaction, buildreq: TxBuildPlutusRequest): Promise<TransactionBuild>;
289
+ /** Protocol parameters, served from the DB row within a 5-minute TTL. */
255
290
  indexProtocolParameters(tx: CapTransaction): Promise<LedgerProtocolParameter>;
256
- /**
257
- * Persist a transaction submission with optional build association
258
- * Handles: TransactionSubmission insert, optional Build status update
259
- * @param tx CAP transaction object
260
- * @param params submission parameters
261
- * @returns {Promise<TransactionSubmission>} persisted transaction submission entity
262
- */
291
+ /** The stored row within its TTL, else the parameters from the backend. Nothing is written. */
292
+ fetchProtocolParameters(tx: CapTransaction): Promise<FetchedProtocolParameters>;
293
+ /** Stores parameters that came from the backend and restarts their TTL. */
294
+ storeProtocolParameters(tx: CapTransaction, fetched: FetchedProtocolParameters): Promise<LedgerProtocolParameter>;
295
+ /** Persist a transaction submission and flag the build as submitted when linked. */
263
296
  persistTransactionSubmission(tx: CapTransaction, params: {
264
297
  signedTxCbor: string;
265
298
  txHash: string;
266
299
  buildId?: string | null;
300
+ status?: 'pending' | 'submitted';
267
301
  }): Promise<TransactionSubmission>;
268
- /**
269
- * Update the status of a transaction submission
270
- * Used for the two-phase submit flow: pending → submitted (or failed)
271
- * @param tx CAP transaction object
272
- * @param submissionId the submission to update
273
- * @param status new status value
274
- * @param errorMessage optional error message for failed status
275
- */
276
- updateSubmissionStatus(tx: CapTransaction, submissionId: string, status: string, errorMessage?: string): Promise<void>;
277
- /**
278
- * Persist a new signing request
279
- * @param tx CAP transaction object
280
- * @param params signing request parameters from external signer module
281
- * @returns persisted signing request record
282
- */
302
+ /** Update a submission's status. With onlyFrom the row changes only while it has that status. */
303
+ updateSubmissionStatus(tx: CapTransaction, submissionId: string, status: TransactionSubmission['status'], errorMessage?: string, onlyFrom?: TransactionSubmission['status']): Promise<void>;
304
+ /** Deletes a resubmit's row when the transaction already has a submitted or confirmed row. */
305
+ dropDuplicateSubmission(tx: CapTransaction, submissionId: string, txHash: string): Promise<boolean>;
306
+ /** Persist a new signing request and link it to the build's sender address. */
283
307
  persistSigningRequest(tx: CapTransaction, params: {
284
308
  buildId: string;
285
309
  signingPayload: {
@@ -308,13 +332,7 @@ export declare class CardanoIndexer {
308
332
  cardanoCliCommand: string | undefined;
309
333
  cip30TxCbor: string | undefined;
310
334
  }>;
311
- /**
312
- * Persist a signature verification with signing request status update
313
- * Handles: SignatureVerification insert, SigningRequest status update
314
- * @param tx CAP transaction object
315
- * @param params verification parameters
316
- * @returns persisted signature verification record
317
- */
335
+ /** Persist a signature verification and update the signing request status. */
318
336
  persistSignatureVerification(tx: CapTransaction, params: {
319
337
  signingRequestId: string;
320
338
  signedTxCbor: string;
@@ -340,13 +358,7 @@ export declare class CardanoIndexer {
340
358
  warnings: string;
341
359
  verifiedAt: string;
342
360
  }>;
343
- /**
344
- * Index a verified transaction submission with all related records
345
- * Handles persistence of: SignatureVerification, TransactionSubmission, SigningRequest update, Build update
346
- * @param tx CAP transaction object
347
- * @param params submission parameters
348
- * @returns {Promise<TransactionSubmission>} transaction submission entity data
349
- */
361
+ /** Persist a verified submission: verification, submission, signing request and build updates. */
350
362
  indexVerifiedTransactionSubmission(tx: CapTransaction, params: {
351
363
  signingRequestId: string;
352
364
  buildId: string;
@@ -361,38 +373,27 @@ export declare class CardanoIndexer {
361
373
  signerType?: string;
362
374
  signerInfo?: string;
363
375
  }): Promise<TransactionSubmission>;
364
- /**
365
- * Index & return the latest epoch information data
366
- * @param tx CAP transaction object
367
- * @returns {Promise<Epoch>} epoch entity data
368
- */
376
+ /** Index the latest epoch. */
369
377
  indexLatestEpoch(tx: CapTransaction): Promise<Epoch>;
370
- /**
371
- * Index & return the latest block information data
372
- * @param tx CAP transaction object
373
- * @returns {Promise<Block>} block entity data
374
- */
378
+ /** Index the latest block, with best-effort epoch enrichment. */
375
379
  indexLatestBlock(tx: CapTransaction): Promise<Block>;
376
380
  /** Max addresses to index concurrently (avoid overloading backends) */
377
381
  private static readonly ADDR_CONCURRENCY;
378
- /**
379
- * Ensure a set of transactions are indexed — batch DB-check + batch fetch.
380
- * 1. Deduplicate hashes
381
- * 2. Check which hashes already exist in DB
382
- * 3. Batch-fetch missing transactions from backend
383
- * 4. UPSERT all entities (Transactions, Inputs, Outputs, Assets, Metadata)
384
- *
385
- * @param tx CAP transaction (cds.tx)
386
- * @param txHashes array of transaction hashes to ensure
387
- * @returns Map of txHash → provider Transaction (all requested, from DB fetch or backend)
388
- */
382
+ /** Block position of a transaction already in the local index (crawled or cached), or null. */
383
+ findIndexedTransaction(tx: CapTransaction, txHash: string): Promise<{
384
+ slot: number | null;
385
+ blockHeight: number | null;
386
+ blockHash: string | null;
387
+ } | null>;
388
+ resolveTransactionConfirmations(tx: CapTransaction, txHash: string): Promise<TransactionConfirmations>;
389
+ /** Height of a transaction in a crawled block and the crawler's tip; null when the crawl does not hold it. */
390
+ private crawledTransactionDepth;
391
+ /** Batch-fetches the missing ones, stores them and returns only those. */
389
392
  ensureTransactionsIndexed(tx: CapTransaction, txHashes: string[]): Promise<Map<string, ProviderTransaction>>;
390
- /**
391
- * Index multiple addresses with concurrency-limited parallelism.
392
- * Processes addresses in chunks to avoid overwhelming backends.
393
- * @param tx CAP transaction object
394
- * @param bech32List array of bech32 addresses
395
- */
396
- private _ensureAddresses;
393
+ /** The hashes among the given ones that have no stored transaction. */
394
+ private unstoredTransactionHashes;
395
+ /** Stores transactions read from a backend, each with its inputs, outputs and metadata. */
396
+ private storeTransactions;
397
+ private fetchAddresses;
397
398
  }
398
399
  //# sourceMappingURL=cardano-indexer.d.ts.map