@odatano/core 2.0.0-rc.44 → 2.0.0-rc.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@cds-models/CardanoAgentService/index.d.ts +0 -46
- package/@cds-models/CardanoBackendService/index.d.ts +0 -10
- package/@cds-models/CardanoIndexerService/index.d.ts +5 -20
- package/@cds-models/CardanoODataService/index.d.ts +18 -47
- package/@cds-models/CardanoSignService/index.d.ts +3 -18
- package/@cds-models/CardanoTransactionService/index.d.ts +9 -31
- package/@cds-models/CardanoWorkerService/index.d.ts +3 -19
- package/@cds-models/index.d.ts +17 -0
- package/@cds-models/index.js +2 -0
- package/@cds-models/odatano/cardano/index.d.ts +0 -34
- package/README.md +20 -20
- package/db/schema.cds +25 -44
- package/db/types.cds +22 -5
- package/package.json +3 -1
- package/scripts/migrate-slot-leader.mjs +3 -11
- package/scripts/migrate-txseq.mjs +3 -12
- package/src/index.d.ts +0 -4
- package/src/index.js +3 -5
- package/src/plugin.js +4 -8
- package/srv/blockchain/asset-decimals.d.ts +0 -9
- package/srv/blockchain/asset-decimals.js +21 -16
- package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -10
- package/srv/blockchain/backends/blockfrost-backend.js +15 -21
- package/srv/blockchain/backends/cardano-backend.d.ts +12 -71
- package/srv/blockchain/backends/koios-backend.d.ts +14 -147
- package/srv/blockchain/backends/koios-backend.js +43 -166
- package/srv/blockchain/backends/odatano-backend.d.ts +1 -11
- package/srv/blockchain/backends/odatano-backend.js +11 -12
- package/srv/blockchain/backends/ogmios-backend.d.ts +19 -160
- package/srv/blockchain/backends/ogmios-backend.js +96 -175
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +2 -18
- package/srv/blockchain/backends/ogmios-frame-guard.js +8 -20
- package/srv/blockchain/cardano-client.d.ts +12 -80
- package/srv/blockchain/cardano-client.js +36 -88
- package/srv/blockchain/cardano-indexer.d.ts +14 -192
- package/srv/blockchain/cardano-indexer.js +136 -222
- package/srv/blockchain/cardano-tx-builder.d.ts +1 -28
- package/srv/blockchain/cardano-tx-builder.js +17 -34
- package/srv/blockchain/circuit-breaker.d.ts +1 -13
- package/srv/blockchain/circuit-breaker.js +5 -15
- package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +0 -5
- package/srv/blockchain/crawler/asset-decimals-backfill.js +2 -5
- package/srv/blockchain/crawler/certificate-backfill.d.ts +0 -17
- package/srv/blockchain/crawler/certificate-backfill.js +8 -22
- package/srv/blockchain/crawler/crawler.d.ts +16 -93
- package/srv/blockchain/crawler/crawler.js +85 -160
- package/srv/blockchain/crawler/credential-backfill.d.ts +0 -10
- package/srv/blockchain/crawler/credential-backfill.js +2 -4
- package/srv/blockchain/crawler/hooks.d.ts +1 -5
- package/srv/blockchain/crawler/index.d.ts +0 -12
- package/srv/blockchain/crawler/index.js +6 -20
- package/srv/blockchain/crawler/sync-state.d.ts +6 -44
- package/srv/blockchain/crawler/sync-state.js +18 -53
- package/srv/blockchain/crawler/transaction-backfill.d.ts +0 -11
- package/srv/blockchain/crawler/transaction-backfill.js +11 -30
- package/srv/blockchain/crawler/utxo-set-import.d.ts +1 -30
- package/srv/blockchain/crawler/utxo-set-import.js +27 -53
- package/srv/blockchain/ledger-state.d.ts +10 -54
- package/srv/blockchain/ledger-state.js +11 -27
- package/srv/blockchain/pending-spends.d.ts +0 -12
- package/srv/blockchain/pending-spends.js +4 -12
- package/srv/blockchain/request-coalescer.d.ts +2 -16
- package/srv/blockchain/request-coalescer.js +2 -16
- package/srv/blockchain/signing/cose-verifier.d.ts +0 -9
- package/srv/blockchain/signing/cose-verifier.js +4 -10
- package/srv/blockchain/signing/external-signer.d.ts +1 -4
- package/srv/blockchain/signing/external-signer.js +2 -8
- package/srv/blockchain/signing/hsm-signer.d.ts +6 -18
- package/srv/blockchain/signing/hsm-signer.js +16 -28
- package/srv/blockchain/signing/signature-verifier.d.ts +1 -8
- package/srv/blockchain/signing/signature-verifier.js +9 -19
- package/srv/blockchain/signing/submission-finalizer.d.ts +10 -16
- package/srv/blockchain/signing/submission-finalizer.js +53 -19
- package/srv/blockchain/stored-chain.d.ts +1 -14
- package/srv/blockchain/stored-chain.js +3 -8
- package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +0 -4
- package/srv/blockchain/transaction-building/buildooor-fee-patch.js +4 -9
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +7 -150
- package/srv/blockchain/transaction-building/buildooor-tx.js +91 -196
- package/srv/blockchain/transaction-building/caller-datums.d.ts +0 -14
- package/srv/blockchain/transaction-building/caller-datums.js +3 -9
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +1 -4
- package/srv/blockchain/wallet-worker/build-request.d.ts +0 -5
- package/srv/blockchain/wallet-worker/build-request.js +6 -9
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -23
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -20
- package/srv/blockchain/wallet-worker/index.d.ts +1 -1
- package/srv/blockchain/wallet-worker/index.js +3 -5
- package/srv/blockchain/wallet-worker/job-store.d.ts +15 -65
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -10
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -12
- package/srv/blockchain/wallet-worker/signers.d.ts +3 -11
- package/srv/blockchain/wallet-worker/signers.js +3 -6
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +3 -21
- package/srv/blockchain/wallet-worker/wallet-worker.js +47 -54
- package/srv/cardano-agent-service.cds +123 -146
- package/srv/cardano-agent-service.js +2 -5
- package/srv/cardano-backend-service.cds +10 -17
- package/srv/cardano-backend-service.js +7 -12
- package/srv/cardano-indexer-service.cds +16 -37
- package/srv/cardano-indexer-service.d.ts +5 -1
- package/srv/cardano-indexer-service.js +44 -35
- package/srv/cardano-service.cds +56 -40
- package/srv/cardano-service.js +42 -69
- package/srv/cardano-sign-service.cds +14 -23
- package/srv/cardano-sign-service.js +18 -24
- package/srv/cardano-tx-service.cds +27 -29
- package/srv/cardano-tx-service.js +60 -122
- package/srv/cardano-worker-service.cds +109 -125
- package/srv/cardano-worker-service.js +21 -31
- package/srv/cbor/cip68.d.ts +0 -4
- package/srv/cbor/cip68.js +2 -4
- package/srv/cbor/parse.d.ts +3 -18
- package/srv/cbor/parse.js +2 -7
- package/srv/cbor/plutus-data-json.d.ts +0 -4
- package/srv/server.d.ts +5 -36
- package/srv/server.js +30 -51
- package/srv/utils/agent-grants-config.d.ts +0 -18
- package/srv/utils/agent-grants-config.js +6 -13
- package/srv/utils/agent-grants.d.ts +14 -68
- package/srv/utils/agent-grants.js +42 -60
- package/srv/utils/agent-token-auth.d.ts +0 -5
- package/srv/utils/agent-token-auth.js +2 -5
- package/srv/utils/backend-request-handler.d.ts +1 -1
- package/srv/utils/collections.d.ts +1 -4
- package/srv/utils/collections.js +1 -4
- package/srv/utils/const.d.ts +0 -18
- package/srv/utils/const.js +7 -18
- package/srv/utils/crypto.js +3 -5
- package/srv/utils/db-indexes.d.ts +2 -0
- package/srv/utils/db-indexes.js +22 -9
- package/srv/utils/db-sanitize.d.ts +1 -8
- package/srv/utils/db-sanitize.js +3 -8
- package/srv/utils/epoch-slots.d.ts +1 -8
- package/srv/utils/epoch-slots.js +3 -8
- package/srv/utils/error-codes.d.ts +0 -4
- package/srv/utils/error-codes.js +2 -4
- package/srv/utils/errors.d.ts +2 -22
- package/srv/utils/errors.js +13 -27
- package/srv/utils/liveness.d.ts +0 -4
- package/srv/utils/liveness.js +2 -4
- package/srv/utils/mappers.d.ts +0 -37
- package/srv/utils/mappers.js +19 -39
- package/srv/utils/network-context.js +2 -4
- package/srv/utils/paging.d.ts +31 -0
- package/srv/utils/paging.js +43 -0
- package/srv/utils/pg-inline-json.js +3 -7
- package/srv/utils/pg-order-nulls.js +2 -5
- package/srv/utils/plutus-placeholders.d.ts +0 -13
- package/srv/utils/plutus-placeholders.js +6 -13
- package/srv/utils/rate-limiter.d.ts +0 -8
- package/srv/utils/rate-limiter.js +2 -4
- package/srv/utils/reference-script.d.ts +0 -18
- package/srv/utils/reference-script.js +8 -19
- package/srv/utils/service-events.d.ts +0 -4
- package/srv/utils/service-events.js +2 -4
- package/srv/utils/signing-helper.d.ts +1 -8
- package/srv/utils/signing-helper.js +3 -8
- package/srv/utils/tx-build-helper.d.ts +2 -32
- package/srv/utils/tx-build-helper.js +26 -40
- package/srv/utils/tx-request-parsers.d.ts +1 -25
- package/srv/utils/tx-request-parsers.js +10 -25
- package/srv/utils/tx-utils.d.ts +0 -8
- package/srv/utils/tx-utils.js +10 -13
- package/srv/utils/types.d.ts +2 -37
- package/srv/utils/validators.d.ts +0 -4
- package/srv/utils/validators.js +2 -4
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { Transaction, Address, UTxO, NetworkInformation, BlockData, EpochData, MetadataLabelTx, PoolData, DrepData, AccountData, AssetInfo, AssetHistoryEntry, LedgerProtocolParameters, ScriptEvaluationResult } from '../../utils/types';
|
|
2
2
|
/** Common interface every Cardano backend (Blockfrost, Koios, Ogmios, ...) implements. */
|
|
3
3
|
export interface CardanoBackend {
|
|
4
|
-
/** Backend name */
|
|
5
4
|
name: string;
|
|
6
|
-
/**
|
|
7
|
-
* Methods this backend declares as NOT supported; the orchestrator skips it for
|
|
8
|
-
* these without counting a circuit-breaker failure.
|
|
9
|
-
*/
|
|
5
|
+
/** Methods this backend does not support. The orchestrator skips them without a circuit-breaker failure. */
|
|
10
6
|
readonly unsupportedMethods?: ReadonlySet<string>;
|
|
11
|
-
/** Initialize the backend */
|
|
12
7
|
init(): Promise<boolean>;
|
|
13
8
|
/** Transaction by hash (hex). */
|
|
14
9
|
getTransaction(txHash: string): Promise<Transaction>;
|
|
@@ -16,7 +11,7 @@ export interface CardanoBackend {
|
|
|
16
11
|
getAddress(address: string): Promise<Address>;
|
|
17
12
|
/** UTxOs of a bech32 address. */
|
|
18
13
|
getAddressUtxos(address: string): Promise<UTxO[]>;
|
|
19
|
-
/** Transactions involving a bech32 address (
|
|
14
|
+
/** Transactions involving a bech32 address (hashes and basic info only). */
|
|
20
15
|
getAddressTransactions(address: string, limit: number): Promise<Transaction[]>;
|
|
21
16
|
/** Network information (supply, stake). */
|
|
22
17
|
getNetworkInformation(): Promise<NetworkInformation>;
|
|
@@ -32,11 +27,7 @@ export interface CardanoBackend {
|
|
|
32
27
|
getLatestBlock(): Promise<BlockData>;
|
|
33
28
|
/** Latest chain tip slot; throws ProviderUnavailableError when the latest block has no slot. */
|
|
34
29
|
getCurrentSlot(): Promise<number>;
|
|
35
|
-
/**
|
|
36
|
-
* Whether a UTxO is still unspent. `false` for txs that don't exist on chain and
|
|
37
|
-
* for out-of-range output indices.
|
|
38
|
-
* @param txHash 64-char lowercase hex
|
|
39
|
-
*/
|
|
30
|
+
/** Whether a UTxO is still unspent. `false` for unknown txs and out-of-range output indices. */
|
|
40
31
|
isUtxoUnspent(txHash: string, outputIndex: number): Promise<boolean>;
|
|
41
32
|
/** Stake pool by id. */
|
|
42
33
|
getPool(poolId: string): Promise<PoolData>;
|
|
@@ -46,30 +37,17 @@ export interface CardanoBackend {
|
|
|
46
37
|
getAccount(accountId: string): Promise<AccountData>;
|
|
47
38
|
/** Asset info (supply, mint history, CIP-25 + CIP-26 metadata); unit = policyId + assetNameHex. */
|
|
48
39
|
getAssetInfo(unit: string): Promise<AssetInfo>;
|
|
49
|
-
/**
|
|
50
|
-
* Latest mint/burn events for an asset (most recent first; limit default 100).
|
|
51
|
-
* Optional — Ogmios doesn't expose this. Blockfrost lacks block timestamps; Koios has block_time per entry.
|
|
52
|
-
*/
|
|
40
|
+
/** Latest mint and burn events of an asset, newest first. Blockfrost has no block timestamps here. */
|
|
53
41
|
getAssetHistory?(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
|
|
54
42
|
/** Current protocol parameters. */
|
|
55
43
|
getProtocolParameters(): Promise<LedgerProtocolParameters>;
|
|
56
44
|
/** Submit a signed transaction (CBOR hex); returns the tx hash. */
|
|
57
45
|
submitTransaction(signedTxCbor: string): Promise<string>;
|
|
58
|
-
/**
|
|
59
|
-
* Most recent tx hashes of an address (no details).
|
|
60
|
-
* Optional — falls back to getAddressTransactions() mapped to hashes.
|
|
61
|
-
*/
|
|
46
|
+
/** Most recent tx hashes of an address. Callers fall back to getAddressTransactions(). */
|
|
62
47
|
getAddressTransactionHashes?(address: string, limit: number): Promise<string[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Transactions by hash, as a map txHash -> Transaction.
|
|
65
|
-
* Optional — falls back to individual getTransaction() calls.
|
|
66
|
-
*/
|
|
48
|
+
/** Transactions by hash. Callers fall back to single getTransaction() calls. */
|
|
67
49
|
getTransactionsBatch?(txHashes: string[]): Promise<Map<string, Transaction>>;
|
|
68
|
-
/**
|
|
69
|
-
* UTxOs across all bech32 addresses sharing a 28-byte payment credential (key or script
|
|
70
|
-
* hash), each with its owning address. Optional — only Koios has this natively.
|
|
71
|
-
* @param credHash 28-byte payment credential as 56-char lowercase hex
|
|
72
|
-
*/
|
|
50
|
+
/** UTxOs of every address with this payment credential (56 hex chars), each with its address. */
|
|
73
51
|
getCredentialUtxos?(credHash: string): Promise<UTxO[]>;
|
|
74
52
|
}
|
|
75
53
|
/** Backend that can evaluate script execution units (Ogmios). */
|
|
@@ -87,17 +65,11 @@ export interface ChainPoint {
|
|
|
87
65
|
}
|
|
88
66
|
/** Callbacks driven by a streamed chain-sync (Ogmios). */
|
|
89
67
|
export interface ChainSyncCallbacks {
|
|
90
|
-
/**
|
|
91
|
-
* A new block (with its full transaction list) extends the chain.
|
|
92
|
-
* @param tip the node's current chain tip when the protocol supplies it (sync progress)
|
|
93
|
-
*/
|
|
68
|
+
/** A new block with all its transactions extends the chain. `tip` is the node's tip when known. */
|
|
94
69
|
rollForward(block: BlockData, txs: Transaction[], tip?: ChainPoint): Promise<void>;
|
|
95
70
|
/** The chain rolled back to `point` (or to genesis). All blocks after it are abandoned. */
|
|
96
71
|
rollBackward(point: ChainPoint | 'origin'): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* A message-handler error stalled the stream; no further blocks are requested and the
|
|
99
|
-
* consumer should record the error and close/restart. Optional — otherwise only logged.
|
|
100
|
-
*/
|
|
72
|
+
/** A handler error stalled the stream. The consumer should record it and restart the stream. */
|
|
101
73
|
onError?(err: unknown): Promise<void>;
|
|
102
74
|
}
|
|
103
75
|
/** Handle to an open chain-sync stream. */
|
|
@@ -105,24 +77,12 @@ export interface ChainSyncHandle {
|
|
|
105
77
|
/** Stop streaming and release the underlying connection. */
|
|
106
78
|
close(): Promise<void>;
|
|
107
79
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Backend that streams the chain forward from a point, emitting ordered rollForward and
|
|
110
|
-
* native rollBackward (reorg) events — Ogmios chain-synchronization, the crawler's primary source.
|
|
111
|
-
*/
|
|
80
|
+
/** Backend that streams the chain forward with native rollback events (Ogmios chain-sync). */
|
|
112
81
|
export interface ChainSyncBackend extends CardanoBackend {
|
|
113
|
-
/**
|
|
114
|
-
* Open a chain-sync stream starting just after the first of `from` still on the node's chain.
|
|
115
|
-
* @param from intersection candidates NEWEST FIRST (or 'origin'); include ancestors of the
|
|
116
|
-
* last-indexed point so a reorg during a disconnect resolves via rollBackward instead of "No intersection found"
|
|
117
|
-
*/
|
|
118
82
|
openChainSync(from: ChainPoint[] | 'origin', callbacks: ChainSyncCallbacks): Promise<ChainSyncHandle>;
|
|
119
83
|
}
|
|
120
84
|
/** Type guard: does this backend support streamed chain-sync? */
|
|
121
85
|
export declare function isChainSyncBackend(backend: CardanoBackend): backend is ChainSyncBackend;
|
|
122
|
-
/**
|
|
123
|
-
* Backend that reads UTxOs straight from the node's ledger (Ogmios `queryLedgerState/utxo`):
|
|
124
|
-
* the whole set as of a chain point inside the volatile window, or selected outputs at the tip.
|
|
125
|
-
*/
|
|
126
86
|
export interface LedgerStateBackend extends CardanoBackend {
|
|
127
87
|
queryUtxoSetAt(point: ChainPoint): Promise<UTxO[]>;
|
|
128
88
|
/** Outputs among `refs` that are unspent at the tip; spent or unknown references are absent. */
|
|
@@ -132,35 +92,20 @@ export interface LedgerStateBackend extends CardanoBackend {
|
|
|
132
92
|
}>): Promise<UTxO[]>;
|
|
133
93
|
}
|
|
134
94
|
export declare function isLedgerStateBackend(backend: CardanoBackend): backend is LedgerStateBackend;
|
|
135
|
-
/**
|
|
136
|
-
* Backend that walks the chain forward by pagination (no live node) — the crawler's fallback
|
|
137
|
-
* source. Reorgs are not delivered natively; the crawler detects them via parent-hash mismatch.
|
|
138
|
-
*/
|
|
139
95
|
export interface PaginatingBackend extends CardanoBackend {
|
|
140
|
-
/**
|
|
141
|
-
* Optional: what the crawl wants per block beyond inputs/outputs. A backend that pays per
|
|
142
|
-
* payload (Koios `_certs`/`_withdrawals`) only asks when told to.
|
|
143
|
-
*/
|
|
96
|
+
/** Extra data the crawl wants per block. Payloads that cost extra are only fetched when asked. */
|
|
144
97
|
configureCrawl?(options: {
|
|
145
98
|
certificates: boolean;
|
|
146
99
|
}): void;
|
|
147
100
|
/** Fetch a block by its height. */
|
|
148
101
|
getBlockByHeight(height: number): Promise<BlockData>;
|
|
149
|
-
/**
|
|
150
|
-
* Fetch up to `count` blocks immediately following `afterHash`, in chain order.
|
|
151
|
-
* @param afterHeight height of `afterHash` when known — lets height-listing backends skip a hash→height round-trip
|
|
152
|
-
*/
|
|
102
|
+
/** Up to `count` blocks after `afterHash` in chain order. `afterHeight` saves a height lookup. */
|
|
153
103
|
getNextBlocks(afterHash: string, count: number, afterHeight?: number): Promise<BlockData[]>;
|
|
154
104
|
/** Fetch the full transaction list of a block, in block order. */
|
|
155
105
|
getBlockTransactions(blockHash: string): Promise<Transaction[]>;
|
|
156
106
|
}
|
|
157
107
|
/** Type guard: can this backend be walked forward by pagination? */
|
|
158
108
|
export declare function isPaginatingBackend(backend: CardanoBackend): backend is PaginatingBackend;
|
|
159
|
-
/**
|
|
160
|
-
* Backend that enumerates the full stake-pool and DRep set and resolves them in batches
|
|
161
|
-
* (crawler epoch snapshots). Koios only: `/pool_list` + `POST /pool_info` make a mainnet
|
|
162
|
-
* snapshot a handful of requests; Blockfrost has no batch info endpoint (thousands of calls).
|
|
163
|
-
*/
|
|
164
109
|
export interface EnumeratingBackend extends CardanoBackend {
|
|
165
110
|
/** All known stake-pool ids (bech32). */
|
|
166
111
|
getPoolIds(): Promise<string[]>;
|
|
@@ -183,10 +128,6 @@ export interface EpochLedgerState {
|
|
|
183
128
|
drepAbstainStake: string | null;
|
|
184
129
|
drepNoConfidenceStake: string | null;
|
|
185
130
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Backend that reads the whole pool/DRep set from the node's ledger at a given block (Ogmios).
|
|
188
|
-
* The block must still be inside the node's volatile window (k blocks), else acquisition fails.
|
|
189
|
-
*/
|
|
190
131
|
export interface EpochStateBackend extends CardanoBackend {
|
|
191
132
|
epochStateAt(point: ChainPoint): Promise<EpochLedgerState>;
|
|
192
133
|
}
|
|
@@ -41,10 +41,7 @@ interface KoiosTxInfo {
|
|
|
41
41
|
/** Live Koios returns ONE object here (the spec says array); both shapes are accepted. */
|
|
42
42
|
collateral_output?: KoiosTxIO | KoiosTxIO[] | null;
|
|
43
43
|
reference_inputs?: KoiosTxIO[] | null;
|
|
44
|
-
/**
|
|
45
|
-
* Net mint/burn (`_assets: true`), quantity signed — negative is a burn. Absent on older
|
|
46
|
-
* Koios; the indexer then derives the delta from inputs/outputs.
|
|
47
|
-
*/
|
|
44
|
+
/** Net mint per asset with `_assets: true`. A negative quantity is a burn. Older Koios omits it. */
|
|
48
45
|
assets_minted?: Array<{
|
|
49
46
|
policy_id?: string;
|
|
50
47
|
asset_name?: string | null;
|
|
@@ -55,10 +52,7 @@ interface KoiosTxInfo {
|
|
|
55
52
|
amount?: string | number;
|
|
56
53
|
stake_addr?: string;
|
|
57
54
|
}> | null;
|
|
58
|
-
/**
|
|
59
|
-
* `_certs: true` only (crawler batch path). `type` is Koios' own vocabulary
|
|
60
|
-
* (stake_registration, pool_delegation, …); `info` carries per-type fields.
|
|
61
|
-
*/
|
|
55
|
+
/** Only with `_certs: true`. `type` uses Koios names such as pool_delegation. */
|
|
62
56
|
certificates?: Array<{
|
|
63
57
|
index?: number | null;
|
|
64
58
|
type?: string;
|
|
@@ -73,141 +67,38 @@ export declare class KoiosBackend implements CardanoBackend, PaginatingBackend,
|
|
|
73
67
|
constructor(network: Network, timeoutMs: number, apiKey?: string);
|
|
74
68
|
/** Probe /tip to verify connectivity. */
|
|
75
69
|
init(): Promise<boolean>;
|
|
76
|
-
/**
|
|
77
|
-
* Retry (500 → 1000 → 2000 ms) when Koios transiently returns [] for a valid query.
|
|
78
|
-
* Only non-emptiness is checked here; rows keep the caller's element type.
|
|
79
|
-
*/
|
|
70
|
+
/** Retry with backoff when Koios briefly returns [] for a valid query. */
|
|
80
71
|
private fetchWithRetryOnEmpty;
|
|
81
|
-
/**
|
|
82
|
-
* Retry on Postgres 42804 ("structure of query does not match function result type"):
|
|
83
|
-
* version-skewed Koios instances behind the load balancer return it for a request that
|
|
84
|
-
* healthy instances serve fine. Other 400s still fail fast.
|
|
85
|
-
*/
|
|
86
72
|
private getWithRetryOn42804;
|
|
87
|
-
/**
|
|
88
|
-
* Get Transaction Data for specified transaction hash
|
|
89
|
-
* @param hash transaction hash (hex)
|
|
90
|
-
* @returns {Promise<Transaction>} transaction data
|
|
91
|
-
*/
|
|
92
73
|
getTransaction(hash: string): Promise<Transaction>;
|
|
93
|
-
/**
|
|
94
|
-
* Get Block Data for specified block hash
|
|
95
|
-
* @param blockHash block hash (hex)
|
|
96
|
-
* @returns {Promise<BlockData>} block data
|
|
97
|
-
*/
|
|
98
74
|
getBlock(blockHash: string): Promise<BlockData>;
|
|
99
|
-
/**
|
|
100
|
-
* Get Epoch Data for specified epoch number
|
|
101
|
-
* @param epochNumber epoch number
|
|
102
|
-
* @returns {Promise<EpochData>} epoch data
|
|
103
|
-
*/
|
|
104
75
|
getEpoch(epochNumber: number): Promise<EpochData>;
|
|
105
|
-
/**
|
|
106
|
-
* Get Address Data (without transactions - use getAddressTransactions() separately)
|
|
107
|
-
* @param address bech32 address
|
|
108
|
-
* @returns {Promise<Address>} address data
|
|
109
|
-
*/
|
|
76
|
+
/** Address data. Transactions come from getAddressTransactions(). */
|
|
110
77
|
getAddress(address: string): Promise<Address>;
|
|
111
|
-
/**
|
|
112
|
-
* Get Address Transactions
|
|
113
|
-
* @param address bech32 address
|
|
114
|
-
* @returns {Promise<Transaction[]>} list of transactions for this address
|
|
115
|
-
*/
|
|
116
78
|
getAddressTransactions(address: string, limit: number): Promise<Transaction[]>;
|
|
117
|
-
/**
|
|
118
|
-
* Get Address UTxOs for specified address
|
|
119
|
-
* @param address bech32 address
|
|
120
|
-
* @returns {Promise<UTxO[]>} list of UTxOs
|
|
121
|
-
*/
|
|
122
79
|
getAddressUtxos(address: string): Promise<UTxO[]>;
|
|
123
|
-
/**
|
|
124
|
-
* UTxOs across all bech32 addresses sharing a payment credential (native Koios endpoint).
|
|
125
|
-
* @param credHash 28-byte payment credential as 56-char lowercase hex
|
|
126
|
-
*/
|
|
80
|
+
/** UTxOs of every address with this payment credential (56 hex chars). */
|
|
127
81
|
getCredentialUtxos(credHash: string): Promise<UTxO[]>;
|
|
128
|
-
/**
|
|
129
|
-
* Get Network Information
|
|
130
|
-
* @returns {Promise<Network>} network information
|
|
131
|
-
*/
|
|
132
82
|
getNetworkInformation(): Promise<NetworkInformation>;
|
|
133
|
-
/**
|
|
134
|
-
* Get Transaction Metadata for specified transaction hash
|
|
135
|
-
* @param tx_hash transaction hash (hex)
|
|
136
|
-
* @returns {Promise<MetadataLabelTx[]>} transaction metadata list
|
|
137
|
-
*/
|
|
138
83
|
getTransactionMetadata(tx_hash: string): Promise<MetadataLabelTx[]>;
|
|
139
|
-
/**
|
|
140
|
-
* Get Pool Data for specified pool id
|
|
141
|
-
* @param poolId pool id
|
|
142
|
-
* @returns {Promise<PoolData>} pool data
|
|
143
|
-
*/
|
|
144
84
|
getPool(poolId: string): Promise<PoolData>;
|
|
145
85
|
/** Map one Koios /pool_info row to the canonical PoolData. */
|
|
146
86
|
private _mapKoiosPool;
|
|
147
|
-
/**
|
|
148
|
-
* Asset info from Koios `asset_info`: supply, mint/burn counts, minting tx, CIP-25 + CIP-26 metadata.
|
|
149
|
-
* @param unit policyId + assetNameHex (concatenated hex)
|
|
150
|
-
*/
|
|
87
|
+
/** Asset info from Koios `asset_info`. */
|
|
151
88
|
getAssetInfo(unit: string): Promise<AssetInfo>;
|
|
152
|
-
/**
|
|
153
|
-
* Latest mint/burn events. Koios `asset_history` returns ALL events with `quantity` SIGNED
|
|
154
|
-
* (negative = burn): action derives from the sign, `quantity` stores the absolute value,
|
|
155
|
-
* `limit` is applied client-side after sorting by block_time desc.
|
|
156
|
-
*/
|
|
157
89
|
getAssetHistory(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
|
|
158
|
-
/**
|
|
159
|
-
* Get Drep Data for specified drep id
|
|
160
|
-
* @param drepId drep id
|
|
161
|
-
* @returns {Promise<DrepData>} drep data
|
|
162
|
-
*/
|
|
163
90
|
getDrep(drepId: string): Promise<DrepData>;
|
|
164
91
|
/** Map one Koios /drep_info row to the canonical DrepData. */
|
|
165
92
|
private _mapKoiosDrep;
|
|
166
|
-
/**
|
|
167
|
-
* Get Account Data for specified stake address
|
|
168
|
-
* @param accountId account id
|
|
169
|
-
* @returns {Promise<AccountData>} account data
|
|
170
|
-
*/
|
|
171
93
|
getAccount(accountId: string): Promise<AccountData>;
|
|
172
|
-
/**
|
|
173
|
-
* Submit Transaction
|
|
174
|
-
* @param signedTxCbor signed transaction in CBOR hex format
|
|
175
|
-
* @returns {Promise<string>} transaction hash
|
|
176
|
-
*/
|
|
177
94
|
submitTransaction(signedTxCbor: string): Promise<string>;
|
|
178
|
-
/**
|
|
179
|
-
* Get Protocol Parameters
|
|
180
|
-
* @returns {Promise<any>} protocol parameters
|
|
181
|
-
*/
|
|
182
95
|
getProtocolParameters(): Promise<LedgerProtocolParameters>;
|
|
183
|
-
/**
|
|
184
|
-
* Get Latest Block Data
|
|
185
|
-
* @returns {Promise<BlockData>} latest block data
|
|
186
|
-
*/
|
|
187
96
|
getLatestBlock(): Promise<BlockData>;
|
|
188
|
-
/**
|
|
189
|
-
* Get Latest Epoch Data
|
|
190
|
-
* @returns {Promise<EpochData>} latest epoch data
|
|
191
|
-
*/
|
|
192
97
|
getLatestEpoch(): Promise<EpochData>;
|
|
193
|
-
/**
|
|
194
|
-
* Get the latest chain tip slot.
|
|
195
|
-
* @returns {Promise<number>} current chain slot
|
|
196
|
-
*/
|
|
197
98
|
getCurrentSlot(): Promise<number>;
|
|
198
|
-
/**
|
|
199
|
-
* Check whether a UTxO is still unspent via Koios `POST /utxo_info`.
|
|
200
|
-
* @param txHash 64-char lowercase hex
|
|
201
|
-
* @param outputIndex non-negative integer
|
|
202
|
-
* @returns {Promise<boolean>} true iff the UTxO exists and is unspent
|
|
203
|
-
*/
|
|
99
|
+
/** Whether a UTxO exists and is unspent, via Koios `POST /utxo_info`. */
|
|
204
100
|
isUtxoUnspent(txHash: string, outputIndex: number): Promise<boolean>;
|
|
205
|
-
/**
|
|
206
|
-
* Get transaction hashes for an address (lightweight — no full tx details).
|
|
207
|
-
* @param address bech32 address
|
|
208
|
-
* @param limit maximum number of hashes
|
|
209
|
-
* @returns {Promise<string[]>} most recent tx hashes
|
|
210
|
-
*/
|
|
101
|
+
/** Most recent tx hashes of an address, without tx details. */
|
|
211
102
|
getAddressTransactionHashes(address: string, limit: number): Promise<string[]>;
|
|
212
103
|
/** crawler.certificates: ask /tx_info for certificates + withdrawals on the crawl's batch call. */
|
|
213
104
|
private crawlCertificates;
|
|
@@ -218,54 +109,30 @@ export declare class KoiosBackend implements CardanoBackend, PaginatingBackend,
|
|
|
218
109
|
getTransactionsBatch(txHashes: string[]): Promise<Map<string, Transaction>>;
|
|
219
110
|
/** Map a Koios /block_info row to BlockData. */
|
|
220
111
|
private mapKoiosBlockInfo;
|
|
221
|
-
/**
|
|
222
|
-
* Get a block by its height via the PostgREST-filtered /blocks list, then resolve
|
|
223
|
-
* full data through /block_info.
|
|
224
|
-
*/
|
|
112
|
+
/** Finds the block in the filtered /blocks list, then reads it from /block_info. */
|
|
225
113
|
getBlockByHeight(height: number): Promise<BlockData>;
|
|
226
|
-
/**
|
|
227
|
-
* Up to `count` blocks after `afterHash`, ascending. Koios has no "next after hash" endpoint:
|
|
228
|
-
* list blocks above the anchor height (PostgREST gt + order + limit), then batch /block_info.
|
|
229
|
-
* A known `afterHeight` skips the hash→height round-trip.
|
|
230
|
-
*/
|
|
231
114
|
getNextBlocks(afterHash: string, count: number, afterHeight?: number): Promise<BlockData[]>;
|
|
232
115
|
/** Rows per page when listing ids (PostgREST caps a response at 1000 rows). */
|
|
233
116
|
private static readonly LIST_PAGE_SIZE;
|
|
234
117
|
/** Ids resolved per /pool_info / /drep_info request. */
|
|
235
118
|
private static readonly INFO_BATCH_SIZE;
|
|
236
|
-
/** Page cap
|
|
119
|
+
/** Page cap. 500 pages hold 500 000 ids, far beyond any real pool or DRep set. */
|
|
237
120
|
private static readonly LIST_MAX_PAGES;
|
|
238
|
-
/**
|
|
239
|
-
* Page through a PostgREST list endpoint and collect one id column. Stops on the first
|
|
240
|
-
* short page, so a complete set costs exactly ceil(n / 1000) + 1 requests.
|
|
241
|
-
*/
|
|
121
|
+
/** Pages through a PostgREST list endpoint for one id column. Stops on the first short page. */
|
|
242
122
|
private listAllIds;
|
|
243
|
-
/**
|
|
244
|
-
* All stake-pool ids known to Koios (bech32), including retired ones — a snapshot that
|
|
245
|
-
* silently dropped retiring pools would misreport the epoch's pool set.
|
|
246
|
-
*/
|
|
123
|
+
/** All pool ids, including retired ones, so a snapshot does not drop retiring pools. */
|
|
247
124
|
getPoolIds(): Promise<string[]>;
|
|
248
|
-
/**
|
|
249
|
-
* Resolve pool ids in batches. Ids Koios does not return are omitted rather than
|
|
250
|
-
* substituted with empty rows — a missing pool is better than an invented one.
|
|
251
|
-
*/
|
|
125
|
+
/** Resolve pool ids in batches. Ids Koios does not return are omitted, never filled with empty rows. */
|
|
252
126
|
getPools(poolIds: string[]): Promise<PoolData[]>;
|
|
253
127
|
/** All DRep ids known to Koios (bech32). */
|
|
254
128
|
getDrepIds(): Promise<string[]>;
|
|
255
129
|
/** Resolve DRep ids in batches; unknown ids are omitted (see getPools). */
|
|
256
130
|
getDreps(drepIds: string[]): Promise<DrepData[]>;
|
|
257
|
-
/**
|
|
258
|
-
* Full transaction list of a block in block order via /block_txs → /tx_info batch.
|
|
259
|
-
* Accepts both the flattened ({tx_hash} per row) and the {tx_hashes:[...]} shape.
|
|
260
|
-
*/
|
|
131
|
+
/** All transactions of a block in order. /block_txs may answer flat rows or one `tx_hashes` array. */
|
|
261
132
|
getBlockTransactions(blockHash: string): Promise<Transaction[]>;
|
|
262
133
|
/** Map a Koios /tx_info row to the normalized Transaction (ledger view, see ledgerView). */
|
|
263
134
|
private _mapKoiosTx;
|
|
264
135
|
}
|
|
265
|
-
/**
|
|
266
|
-
* Normalize Koios `/tx_info` certificates (`_certs: true`). Field names inside `info` differ
|
|
267
|
-
* per type (`retiring_epoch` is spelled `retiring epoch` in current Koios), so every alias is read.
|
|
268
|
-
*/
|
|
269
136
|
export declare function mapKoiosCertificates(certs: NonNullable<KoiosTxInfo['certificates']>): TxCertificate[];
|
|
270
137
|
export {};
|
|
271
138
|
//# sourceMappingURL=koios-backend.d.ts.map
|