@odatano/core 2.0.0-rc.3 → 2.0.0-rc.31
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.
- package/@cds-models/CardanoAgentService/index.d.ts +251 -0
- package/@cds-models/CardanoAgentService/index.js +36 -0
- package/@cds-models/CardanoBackendService/index.d.ts +357 -0
- package/@cds-models/CardanoBackendService/index.js +40 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +194 -2
- package/@cds-models/CardanoIndexerService/index.js +25 -0
- package/@cds-models/CardanoODataService/index.d.ts +294 -7
- package/@cds-models/CardanoODataService/index.js +33 -0
- package/@cds-models/CardanoSignService/index.d.ts +28 -3
- package/@cds-models/CardanoSignService/index.js +3 -0
- package/@cds-models/CardanoTransactionService/index.d.ts +52 -19
- package/@cds-models/CardanoTransactionService/index.js +4 -0
- package/@cds-models/index.d.ts +18 -0
- package/@cds-models/index.js +3 -0
- package/@cds-models/odatano/cardano/index.d.ts +408 -7
- package/@cds-models/odatano/cardano/index.js +42 -0
- package/README.md +64 -5
- package/db/schema.cds +677 -13
- package/db/types.cds +27 -0
- package/package.json +182 -173
- package/scripts/migrate-slot-leader.mjs +104 -0
- package/scripts/migrate-txseq.mjs +147 -0
- package/src/index.d.ts +11 -10
- package/src/index.js +28 -14
- package/src/plugin.js +39 -52
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +49 -160
- package/srv/blockchain/backends/cardano-backend.d.ts +104 -158
- package/srv/blockchain/backends/cardano-backend.js +19 -5
- package/srv/blockchain/backends/koios-backend.d.ts +126 -60
- package/srv/blockchain/backends/koios-backend.js +356 -217
- package/srv/blockchain/backends/odatano-backend.d.ts +64 -0
- package/srv/blockchain/backends/odatano-backend.js +170 -0
- package/srv/blockchain/backends/ogmios-backend.d.ts +162 -94
- package/srv/blockchain/backends/ogmios-backend.js +548 -197
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
- package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
- package/srv/blockchain/cardano-client.d.ts +78 -205
- package/srv/blockchain/cardano-client.js +186 -242
- package/srv/blockchain/cardano-indexer.d.ts +302 -242
- package/srv/blockchain/cardano-indexer.js +1193 -362
- package/srv/blockchain/cardano-tx-builder.d.ts +43 -81
- package/srv/blockchain/cardano-tx-builder.js +177 -132
- package/srv/blockchain/crawler/certificate-backfill.d.ts +67 -0
- package/srv/blockchain/crawler/certificate-backfill.js +169 -0
- package/srv/blockchain/crawler/crawler.d.ts +139 -54
- package/srv/blockchain/crawler/crawler.js +478 -96
- package/srv/blockchain/crawler/hooks.d.ts +3 -14
- package/srv/blockchain/crawler/index.d.ts +5 -0
- package/srv/blockchain/crawler/index.js +35 -7
- package/srv/blockchain/crawler/sync-state.d.ts +46 -28
- package/srv/blockchain/crawler/sync-state.js +128 -43
- package/srv/blockchain/crawler/transaction-backfill.d.ts +52 -0
- package/srv/blockchain/crawler/transaction-backfill.js +283 -0
- package/srv/blockchain/crawler/utxo-set-import.d.ts +78 -0
- package/srv/blockchain/crawler/utxo-set-import.js +363 -0
- package/srv/blockchain/ledger-state.d.ts +101 -0
- package/srv/blockchain/ledger-state.js +432 -0
- package/srv/blockchain/pending-spends.d.ts +28 -0
- package/srv/blockchain/pending-spends.js +89 -0
- package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
- package/srv/blockchain/signing/cose-verifier.js +6 -12
- package/srv/blockchain/signing/external-signer.d.ts +16 -113
- package/srv/blockchain/signing/external-signer.js +19 -122
- package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
- package/srv/blockchain/signing/hsm-signer.js +23 -63
- package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
- package/srv/blockchain/signing/signature-verifier.js +13 -54
- package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
- package/srv/blockchain/signing/submission-finalizer.js +16 -49
- package/srv/blockchain/stored-chain.d.ts +33 -0
- package/srv/blockchain/stored-chain.js +234 -0
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +115 -160
- package/srv/blockchain/transaction-building/buildooor-tx.js +651 -287
- package/srv/blockchain/transaction-building/caller-datums.d.ts +29 -0
- package/srv/blockchain/transaction-building/caller-datums.js +139 -0
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +10 -35
- package/srv/blockchain/transaction-rows.d.ts +12 -0
- package/srv/blockchain/transaction-rows.js +43 -0
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +48 -24
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
- package/srv/blockchain/wallet-worker/index.js +2 -8
- package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
- package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
- package/srv/blockchain/wallet-worker/signers.js +3 -8
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
- package/srv/blockchain/wallet-worker/wallet-worker.js +40 -91
- package/srv/cardano-agent-service.cds +146 -0
- package/srv/cardano-agent-service.d.ts +2 -0
- package/srv/cardano-agent-service.js +12 -0
- package/srv/cardano-backend-service.cds +52 -0
- package/srv/cardano-backend-service.d.ts +2 -0
- package/srv/cardano-backend-service.js +244 -0
- package/srv/cardano-indexer-service.cds +201 -73
- package/srv/cardano-indexer-service.js +280 -11
- package/srv/cardano-service.cds +56 -1
- package/srv/cardano-service.js +52 -113
- package/srv/cardano-sign-service.cds +200 -180
- package/srv/cardano-sign-service.js +55 -173
- package/srv/cardano-tx-service.cds +439 -364
- package/srv/cardano-tx-service.js +305 -209
- package/srv/cardano-ui.cds +16 -16
- package/srv/cardano-worker-service.js +7 -15
- package/srv/cbor/parse.js +13 -1
- package/srv/server.d.ts +28 -86
- package/srv/server.js +130 -135
- package/srv/utils/agent-grants-config.d.ts +37 -0
- package/srv/utils/agent-grants-config.js +138 -0
- package/srv/utils/agent-grants.d.ts +262 -0
- package/srv/utils/agent-grants.js +922 -0
- package/srv/utils/agent-token-auth.d.ts +16 -0
- package/srv/utils/agent-token-auth.js +78 -0
- package/srv/utils/backend-request-handler.d.ts +2 -16
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +4 -8
- package/srv/utils/collections.js +4 -8
- package/srv/utils/const.d.ts +30 -67
- package/srv/utils/const.js +32 -72
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +5 -18
- package/srv/utils/db-indexes.d.ts +25 -0
- package/srv/utils/db-indexes.js +94 -0
- package/srv/utils/db-sanitize.d.ts +27 -0
- package/srv/utils/db-sanitize.js +85 -0
- package/srv/utils/epoch-slots.d.ts +13 -0
- package/srv/utils/epoch-slots.js +25 -0
- package/srv/utils/error-codes.d.ts +20 -73
- package/srv/utils/error-codes.js +19 -70
- package/srv/utils/errors.d.ts +50 -177
- package/srv/utils/errors.js +94 -218
- package/srv/utils/liveness.d.ts +16 -0
- package/srv/utils/liveness.js +40 -0
- package/srv/utils/mappers.d.ts +128 -214
- package/srv/utils/mappers.js +354 -299
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-inline-json.d.ts +8 -0
- package/srv/utils/pg-inline-json.js +62 -0
- package/srv/utils/pg-order-nulls.d.ts +14 -0
- package/srv/utils/pg-order-nulls.js +56 -0
- package/srv/utils/plutus-placeholders.d.ts +23 -16
- package/srv/utils/plutus-placeholders.js +63 -27
- package/srv/utils/rate-limiter.d.ts +46 -0
- package/srv/utils/rate-limiter.js +116 -0
- package/srv/utils/service-events.d.ts +2 -22
- package/srv/utils/service-events.js +3 -23
- package/srv/utils/signing-helper.d.ts +3 -18
- package/srv/utils/signing-helper.js +10 -32
- package/srv/utils/tx-build-helper.d.ts +26 -92
- package/srv/utils/tx-build-helper.js +68 -123
- package/srv/utils/tx-request-parsers.d.ts +107 -21
- package/srv/utils/tx-request-parsers.js +433 -34
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +238 -169
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +24 -90
- package/srv/utils/validators.js +50 -147
|
@@ -3,20 +3,12 @@ import type { CardanoClient } from './cardano-client';
|
|
|
3
3
|
import type { CardanoTransactionBuilder } from './cardano-tx-builder';
|
|
4
4
|
import { Transaction as CardanoTransaction, AddressUTxOs, TransactionMetadata, NetworkInformation, Block, Epoch, AssetHistory, Account, Drep, Pool, Asset, Address, LedgerProtocolParameter, AddressTransactions } 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 } from '../utils/types';
|
|
7
|
+
import { type LedgerAnchor, type LedgerLookup } from './ledger-state';
|
|
7
8
|
import type { TxCacheTargets } from '../utils/tx-build-helper';
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
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.
|
|
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.
|
|
20
12
|
*/
|
|
21
13
|
export declare class CardanoIndexer {
|
|
22
14
|
private client;
|
|
@@ -25,261 +17,352 @@ export declare class CardanoIndexer {
|
|
|
25
17
|
private static readonly CRAWL_EPOCH_REFRESH_MS;
|
|
26
18
|
private static readonly CRAWL_EPOCH_RETRY_MS;
|
|
27
19
|
/**
|
|
28
|
-
* Crawler epoch memo
|
|
29
|
-
*
|
|
30
|
-
*
|
|
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.
|
|
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`).
|
|
36
23
|
*/
|
|
37
24
|
private crawlEpochCache;
|
|
38
25
|
private crawlEpochCurrent;
|
|
26
|
+
/** Epoch rows known to be committed; a refresh creates a new row object and is written again. */
|
|
27
|
+
private crawlEpochWritten;
|
|
28
|
+
/** Memo updates of the running block transaction, applied only after its commit. */
|
|
29
|
+
private pendingCommit;
|
|
39
30
|
private crawlEpochPrevious;
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
/** Analytics coverage of the crawl path; defaults mirror the crawler config defaults. */
|
|
32
|
+
private crawlAssetHistory;
|
|
33
|
+
private crawlAssetCatalogue;
|
|
34
|
+
/** Certificates + withdrawals per block (ledger-state coverage). Opt-in. */
|
|
35
|
+
private crawlCertificates;
|
|
36
|
+
/** Logged once per process: the active source reports no certificates (Blockfrost). */
|
|
37
|
+
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
|
+
*/
|
|
42
|
+
private crawlUtxoSet;
|
|
43
|
+
/** crawler.authoritative: misses in the crawled chain are 404, no provider call. */
|
|
44
|
+
private crawlAuthoritative;
|
|
45
|
+
private utxoAnchor;
|
|
46
|
+
/** `LedgerAddresses.paymentCredential` is complete; the running fill and its table generation. */
|
|
47
|
+
private credentialsReady;
|
|
48
|
+
private credentialFill;
|
|
49
|
+
private credentialGeneration;
|
|
50
|
+
/** The anchor block was found in the crawled chain (checked once, before the first apply). */
|
|
51
|
+
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
|
+
*/
|
|
56
|
+
private ledgerInvalidation;
|
|
57
|
+
/** Units known to have an `Assets` row, so a repeat sighting costs no DB round-trip. */
|
|
58
|
+
private static readonly ASSET_MEMO_CAP;
|
|
59
|
+
/** Output references per node lookup when checking crawled UTxOs. */
|
|
60
|
+
private static readonly OUTREF_CHUNK;
|
|
61
|
+
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
|
+
private static readonly ENRICH_QUEUE_CAP;
|
|
67
|
+
private enrichQueue;
|
|
68
|
+
private enrichTimer;
|
|
69
|
+
private enrichRate;
|
|
70
|
+
/** Adopt the crawler's coverage settings; the lazy request path never touches these. */
|
|
71
|
+
configureCrawlCoverage(coverage: {
|
|
72
|
+
assetHistory: boolean;
|
|
73
|
+
assetCatalogue: 'off' | 'bare' | 'enrich';
|
|
74
|
+
assetEnrichRate?: number;
|
|
75
|
+
certificates?: boolean;
|
|
76
|
+
utxoSet?: boolean;
|
|
77
|
+
authoritative?: boolean;
|
|
78
|
+
}): 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
|
+
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
|
+
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
|
+
private crawlAnswers;
|
|
94
|
+
/** 404 for a lookup the crawled chain answers on its own (the caller already missed in the DB). */
|
|
95
|
+
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
|
+
private localAssetInfo;
|
|
101
|
+
/** Address from the crawled UTxO set when it answers, else from the backend. */
|
|
102
|
+
resolveAddress(tx: CapTransaction, addr: string): Promise<ProviderAddress>;
|
|
103
|
+
/** UTxOs of an address: the crawled set (checked unspent at the node) when it answers, else the backend. */
|
|
104
|
+
resolveAddressUtxos(tx: CapTransaction, addr: string): Promise<OdatanoUtxo[]>;
|
|
105
|
+
/** Asset from the crawled chain when it answers, else from the backend. */
|
|
106
|
+
resolveAssetInfo(tx: CapTransaction, unit: string): Promise<AssetInfo>;
|
|
107
|
+
/** Mint/burn events, newest first: crawled rows when the crawled chain answers, else the backend. */
|
|
108
|
+
resolveAssetHistory(tx: CapTransaction, unit: string, limit: number): Promise<AssetHistoryEntryProviderData[]>;
|
|
109
|
+
/** UTxOs of a payment credential: the crawled set when it answers, else Koios. */
|
|
110
|
+
resolveCredentialUtxos(tx: CapTransaction, credHash: string): Promise<OdatanoUtxo[]>;
|
|
111
|
+
/** Latest transaction hashes of an address: the crawled set when it has enough, else the backend. */
|
|
112
|
+
resolveAddressTransactionHashes(tx: CapTransaction, addr: string, limit: number): Promise<string[]>;
|
|
113
|
+
/** True while the crawled UTxO set answers address queries (live crawler at the tip, set active). */
|
|
114
|
+
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
|
+
private localAddress;
|
|
121
|
+
/** Addresses of a stake key from the crawled UTxO set, with their unspent outputs (one read for all). */
|
|
122
|
+
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
|
+
private localAddressTransactions;
|
|
129
|
+
/** Amount lists (lovelace + assets) of `LedgerUTxOs` rows, keyed `txHash#outputIndex`. */
|
|
130
|
+
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
|
+
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
|
+
private localWithdrawalsSum;
|
|
141
|
+
/** The anchor the imported UTxO set describes (null = ledger mode inactive). */
|
|
142
|
+
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
|
+
private verifyUtxoAnchor;
|
|
149
|
+
/** Null while the mode is off, nothing is imported, or an invalidation awaits its commit. */
|
|
150
|
+
getUtxoAnchor(): LedgerAnchor | null;
|
|
151
|
+
/** Apply the memo updates of the block transaction that just committed. */
|
|
152
|
+
confirmBlockCommit(): void;
|
|
153
|
+
/** Hand out a pending invalidation (dropping the anchor) exactly once after the block commit, or null. */
|
|
154
|
+
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
|
+
private startAssetEnrichment;
|
|
160
|
+
/** Stop the enrichment loop and forget what is still queued (shutdown, crawler halt, mode change). */
|
|
161
|
+
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.
|
|
44
165
|
*/
|
|
45
166
|
prefetchCrawlEpoch(epochNumber: number): Promise<void>;
|
|
46
167
|
private refreshCrawlEpoch;
|
|
47
168
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @param txBuilder - The CardanoTransactionBuilder instance for transaction building
|
|
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.
|
|
51
171
|
*/
|
|
172
|
+
private crawledEpochTotals;
|
|
173
|
+
/** Epoch row with only the slot-derived bounds, for an epoch the backend cannot describe. */
|
|
174
|
+
private bareEpochRow;
|
|
52
175
|
constructor(client: CardanoClient, txBuilder: CardanoTransactionBuilder);
|
|
53
176
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
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
|
+
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.
|
|
60
184
|
*/
|
|
61
185
|
indexTransaction(tx: CapTransaction, txHash: string): Promise<CardanoTransaction>;
|
|
186
|
+
/** Lazy path: inputs, outputs, their assets and metadata of one transaction. */
|
|
187
|
+
private writeTransactionChildren;
|
|
62
188
|
/**
|
|
63
|
-
* Index
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
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
|
+
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).
|
|
82
196
|
*/
|
|
83
197
|
indexCredentialUtxos(tx: CapTransaction, credHash: string): Promise<AddressUTxOs[]>;
|
|
84
198
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* the
|
|
88
|
-
*
|
|
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)
|
|
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.
|
|
96
203
|
*/
|
|
97
|
-
|
|
204
|
+
private localCredentialUtxos;
|
|
98
205
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
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
|
|
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.
|
|
114
209
|
*/
|
|
115
|
-
|
|
210
|
+
private openLedgerUtxos;
|
|
211
|
+
/** Unspent `LedgerUTxOs` (+ assets) of the given addresses in the provider UTxO shape. */
|
|
212
|
+
private ledgerUtxosOf;
|
|
116
213
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* @param addr bech32 address
|
|
120
|
-
* @param limit maximum number of transactions to fetch
|
|
121
|
-
* @return {Promise<AddressTransactions[]>} address transaction entities
|
|
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.
|
|
122
216
|
*/
|
|
123
|
-
|
|
217
|
+
paymentCredentialsReady(): Promise<boolean>;
|
|
218
|
+
/** The ledger tables were replaced (re-import): the credential column has to be filled again. */
|
|
219
|
+
resetPaymentCredentials(): void;
|
|
124
220
|
/**
|
|
125
|
-
* Index
|
|
126
|
-
*
|
|
127
|
-
* @param tx CAP transaction
|
|
128
|
-
* @param addr bech32 address
|
|
129
|
-
* @param signingRequestId signing request UUID
|
|
130
|
-
* @return {Promise<void>}
|
|
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.
|
|
131
223
|
*/
|
|
132
|
-
|
|
224
|
+
indexAddressUtxos(tx: CapTransaction, addr: string): Promise<AddressUTxOs[]>;
|
|
133
225
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* @param addr bech32 address
|
|
138
|
-
* @param buildId transaction build UUID
|
|
139
|
-
* @return {Promise<void>}
|
|
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.
|
|
140
229
|
*/
|
|
230
|
+
invalidateUtxoCacheForTx(tx: CapTransaction, targets: TxCacheTargets, extraAddresses?: string[]): Promise<void>;
|
|
231
|
+
/** Index address transactions (separate from indexAddress for lazy loading). */
|
|
232
|
+
indexAddressTransactions(tx: CapTransaction, addr: string, limit: number): Promise<AddressTransactions[]>;
|
|
233
|
+
/** Link an address to a signing request for address-based queries. */
|
|
234
|
+
indexAddressSigningRequests(tx: CapTransaction, addr: string, signingRequestId: string): Promise<void>;
|
|
235
|
+
/** Link an address to a transaction build for address-based queries. */
|
|
141
236
|
indexAddressTransactionBuilds(tx: CapTransaction, addr: string, buildId: string): Promise<void>;
|
|
237
|
+
/** Index the metadata rows of a transaction. */
|
|
238
|
+
indexTransactionMetadata(tx: CapTransaction, tx_hash: string): Promise<TransactionMetadata[]>;
|
|
239
|
+
/** Index the network information; circulating supply comes from the crawled UTxO set when it is current. */
|
|
240
|
+
indexNetworkInformation(tx: CapTransaction): Promise<NetworkInformation>;
|
|
241
|
+
/** Network information from the backend; circulating supply from the crawled UTxO set when current. */
|
|
242
|
+
resolveNetworkInformation(tx: CapTransaction): Promise<ProviderNetworkInformation>;
|
|
243
|
+
/** Index a block by hash, with best-effort epoch enrichment. */
|
|
244
|
+
indexBlock(tx: CapTransaction, blockHash: string): Promise<Block>;
|
|
142
245
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* @param metadata raw metadata object (label -> JSONValue)
|
|
147
|
-
* @return {Promise<TransactionMetadata[]>} array of transaction metadata rows
|
|
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.
|
|
148
249
|
*/
|
|
149
|
-
|
|
250
|
+
indexBlockFull(tx: CapTransaction, blockData: BlockData, txs: ProviderTransaction[]): Promise<void>;
|
|
150
251
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* @returns {Promise<NetworkInformation>} network information entity data
|
|
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.
|
|
154
254
|
*/
|
|
155
|
-
|
|
255
|
+
private removeSupersededBlocks;
|
|
156
256
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* @param blockHash block hash (hex)
|
|
160
|
-
* @returns {Promise<Block>} block entity data
|
|
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.
|
|
161
259
|
*/
|
|
162
|
-
|
|
260
|
+
private removeStaleTxSeqs;
|
|
163
261
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
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)
|
|
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.
|
|
181
264
|
*/
|
|
182
|
-
|
|
265
|
+
private warnIfCertificatesUnreported;
|
|
183
266
|
/**
|
|
184
|
-
* Backfill
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* DB. Inputs that already carry an address (Blockfrost/Koios) are skipped.
|
|
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.
|
|
188
270
|
*/
|
|
189
|
-
|
|
271
|
+
resolveInputs(tx: CapTransaction, txs: ProviderTransaction[], ledger?: LedgerLookup): Promise<void>;
|
|
190
272
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* @returns {Promise<Epoch>} epoch entity data
|
|
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).
|
|
195
276
|
*/
|
|
196
|
-
|
|
277
|
+
private applyCollateralFees;
|
|
197
278
|
/**
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
indexAccount(tx: CapTransaction, stakeAddress: string): Promise<Account>;
|
|
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
|
+
private buildAssetHistoryRows;
|
|
204
284
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
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.
|
|
209
289
|
*/
|
|
210
|
-
|
|
290
|
+
private ensureAssetRows;
|
|
211
291
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* @param poolId pool id (hex)
|
|
215
|
-
* @returns {Promise<Pool>} pool entity data
|
|
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.
|
|
216
294
|
*/
|
|
217
|
-
|
|
295
|
+
private noteAssetSeen;
|
|
218
296
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
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)
|
|
223
302
|
*/
|
|
224
|
-
|
|
303
|
+
snapshotEpoch(epoch: number, at: {
|
|
304
|
+
slot: number;
|
|
305
|
+
time: number;
|
|
306
|
+
hash?: string | null;
|
|
307
|
+
}): Promise<{
|
|
308
|
+
pools: number;
|
|
309
|
+
dreps: number;
|
|
310
|
+
source: 'ogmios' | 'koios' | null;
|
|
311
|
+
}>;
|
|
225
312
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
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
|
|
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.
|
|
234
316
|
*/
|
|
235
|
-
|
|
317
|
+
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
|
+
private previousLiveStake;
|
|
323
|
+
/** Crawled blocks per pool up to `slot`; null unless the crawl started at or before Shelley. */
|
|
324
|
+
private crawledBlocksByPool;
|
|
325
|
+
/** Every native-asset unit a block touches: outputs, consumed inputs and mint/burn rows. */
|
|
326
|
+
private collectBlockUnits;
|
|
327
|
+
/** Index an epoch by number. */
|
|
328
|
+
indexEpoch(tx: CapTransaction, epochNumber: number): Promise<Epoch>;
|
|
329
|
+
/** Index an account by stake address, plus its addresses when it has any. */
|
|
330
|
+
indexAccount(tx: CapTransaction, stakeAddress: string): Promise<Account>;
|
|
331
|
+
/** Account from the backend with the crawled overlays (controlled amount, withdrawals). */
|
|
332
|
+
resolveAccount(tx: CapTransaction, stakeAddress: string): Promise<AccountData>;
|
|
333
|
+
/** Index a DRep by bech32 id. */
|
|
334
|
+
indexDrep(tx: CapTransaction, drepId: string): Promise<Drep>;
|
|
335
|
+
/** Index a pool by id. */
|
|
336
|
+
indexPool(tx: CapTransaction, poolId: string): Promise<Pool>;
|
|
337
|
+
/** Pool from the backend with crawled block counts and the snapshot's active stake. */
|
|
338
|
+
resolvePool(tx: CapTransaction, poolId: string): Promise<PoolData>;
|
|
339
|
+
/** Index an asset by unit (policyId + assetNameHex). */
|
|
340
|
+
indexAsset(tx: CapTransaction, unit: string): Promise<Asset>;
|
|
236
341
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
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
|
|
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.
|
|
243
344
|
*/
|
|
345
|
+
indexAssetHistory(tx: CapTransaction, unit: string, limit?: number): Promise<AssetHistory[]>;
|
|
346
|
+
/** Build a transaction and persist the build result with inputs/outputs/address association. */
|
|
244
347
|
private _indexBuildResult;
|
|
245
348
|
indexSimpleBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
|
|
246
349
|
indexMetadataBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
|
|
247
350
|
indexMultiAssetBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
|
|
248
351
|
indexMintBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
|
|
249
352
|
indexPlutusSpendBuildResult(tx: CapTransaction, buildreq: TxBuildRequest): Promise<TransactionBuild>;
|
|
250
|
-
/**
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
* @returns {Promise<LedgerProtocolParameter>} protocol parameters entity data
|
|
254
|
-
*/
|
|
353
|
+
/** BuildPlutusTransaction: several script inputs; the redeemers are stored with the build. */
|
|
354
|
+
indexPlutusBuildResult(tx: CapTransaction, buildreq: TxBuildPlutusRequest): Promise<TransactionBuild>;
|
|
355
|
+
/** Protocol parameters, served from the DB row within a 5-minute TTL. */
|
|
255
356
|
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
|
-
*/
|
|
357
|
+
/** Persist a transaction submission and flag the build as submitted when linked. */
|
|
263
358
|
persistTransactionSubmission(tx: CapTransaction, params: {
|
|
264
359
|
signedTxCbor: string;
|
|
265
360
|
txHash: string;
|
|
266
361
|
buildId?: string | null;
|
|
267
362
|
}): Promise<TransactionSubmission>;
|
|
268
|
-
/**
|
|
269
|
-
|
|
270
|
-
|
|
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
|
-
*/
|
|
363
|
+
/** Update a submission's status (two-phase submit: pending → submitted or failed). */
|
|
364
|
+
updateSubmissionStatus(tx: CapTransaction, submissionId: string, status: TransactionSubmission['status'], errorMessage?: string): Promise<void>;
|
|
365
|
+
/** Persist a new signing request and link it to the build's sender address. */
|
|
283
366
|
persistSigningRequest(tx: CapTransaction, params: {
|
|
284
367
|
buildId: string;
|
|
285
368
|
signingPayload: {
|
|
@@ -308,13 +391,7 @@ export declare class CardanoIndexer {
|
|
|
308
391
|
cardanoCliCommand: string | undefined;
|
|
309
392
|
cip30TxCbor: string | undefined;
|
|
310
393
|
}>;
|
|
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
|
-
*/
|
|
394
|
+
/** Persist a signature verification and update the signing request status. */
|
|
318
395
|
persistSignatureVerification(tx: CapTransaction, params: {
|
|
319
396
|
signingRequestId: string;
|
|
320
397
|
signedTxCbor: string;
|
|
@@ -340,13 +417,7 @@ export declare class CardanoIndexer {
|
|
|
340
417
|
warnings: string;
|
|
341
418
|
verifiedAt: string;
|
|
342
419
|
}>;
|
|
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
|
-
*/
|
|
420
|
+
/** Persist a verified submission: verification, submission, signing request and build updates. */
|
|
350
421
|
indexVerifiedTransactionSubmission(tx: CapTransaction, params: {
|
|
351
422
|
signingRequestId: string;
|
|
352
423
|
buildId: string;
|
|
@@ -361,37 +432,26 @@ export declare class CardanoIndexer {
|
|
|
361
432
|
signerType?: string;
|
|
362
433
|
signerInfo?: string;
|
|
363
434
|
}): 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
|
-
*/
|
|
435
|
+
/** Index the latest epoch. */
|
|
369
436
|
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
|
-
*/
|
|
437
|
+
/** Index the latest block, with best-effort epoch enrichment. */
|
|
375
438
|
indexLatestBlock(tx: CapTransaction): Promise<Block>;
|
|
376
439
|
/** Max addresses to index concurrently (avoid overloading backends) */
|
|
377
440
|
private static readonly ADDR_CONCURRENCY;
|
|
441
|
+
/** Block position of a transaction already in the local index (crawled or cached), or null. */
|
|
442
|
+
findIndexedTransaction(tx: CapTransaction, txHash: string): Promise<{
|
|
443
|
+
slot: number | null;
|
|
444
|
+
blockHeight: number | null;
|
|
445
|
+
} | null>;
|
|
378
446
|
/**
|
|
379
|
-
* Ensure a set of transactions
|
|
380
|
-
*
|
|
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)
|
|
447
|
+
* Ensure a set of transactions is indexed: DB check, batch fetch of the missing ones, UPSERT.
|
|
448
|
+
* @returns provider transactions for the hashes that had to be fetched
|
|
388
449
|
*/
|
|
389
450
|
ensureTransactionsIndexed(tx: CapTransaction, txHashes: string[]): Promise<Map<string, ProviderTransaction>>;
|
|
390
451
|
/**
|
|
391
|
-
* Index
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* @param bech32List array of bech32 addresses
|
|
452
|
+
* Index the addresses of an account with bounded concurrency. The address data the account
|
|
453
|
+
* carries (from the backend, or from the crawled set) is used as is, so an account costs no
|
|
454
|
+
* request per address; an entry without UTxOs is fetched.
|
|
395
455
|
*/
|
|
396
456
|
private _ensureAddresses;
|
|
397
457
|
}
|