@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,205 +1,140 @@
1
- import { CardanoBackend, PaginatingBackend } from './cardano-backend';
2
- import { Transaction, BlockData, Address, UTxO, NetworkInformation, EpochData, MetadataLabelTx, PoolData, DrepData, AccountData, AssetInfo, AssetHistoryEntry, LedgerProtocolParameters } from '../../utils/types';
1
+ import { CardanoBackend, PaginatingBackend, EnumeratingBackend, TokenRegistryBackend } from './cardano-backend';
2
+ import { Transaction, BlockData, Address, UTxO, NetworkInformation, EpochData, MetadataLabelTx, PoolData, DrepData, AccountData, AssetInfo, AssetHistoryEntry, LedgerProtocolParameters, TxCertificate } from '../../utils/types';
3
3
  import { Network } from '../cardano-client';
4
- /**
5
- * KoiosBackend Implementation for CardanoBackend Interface
6
- * Implements the CardanoBackend interface using Koios API with Axios
7
- */
8
- export declare class KoiosBackend implements CardanoBackend, PaginatingBackend {
4
+ /** Shape of a Koios tx-in/tx-out row from /tx_info */
5
+ interface KoiosTxIO {
6
+ address?: string;
7
+ payment_addr?: {
8
+ bech32?: string;
9
+ };
10
+ tx_hash: string;
11
+ tx_index: number;
12
+ value: string;
13
+ datum_hash?: string | null;
14
+ inline_datum?: unknown;
15
+ reference_script?: unknown;
16
+ asset_list?: Array<{
17
+ policy_id: string;
18
+ asset_name: string;
19
+ quantity: string;
20
+ }>;
21
+ }
22
+ /** Shape of a Koios /tx_info response row */
23
+ interface KoiosTxInfo {
24
+ tx_hash: string;
25
+ block_hash: string;
26
+ block_height: number | string;
27
+ tx_timestamp?: number;
28
+ block_time?: number;
29
+ absolute_slot?: number;
30
+ slot_no?: number;
31
+ tx_block_index?: number;
32
+ fee?: string;
33
+ deposit?: string;
34
+ tx_size: number;
35
+ metadata?: Record<string, unknown> | null;
36
+ inputs: KoiosTxIO[];
37
+ outputs: KoiosTxIO[];
38
+ /** False when the script phase failed (collateral consumed, regular ins/outs not applied). Absent on older Koios. */
39
+ valid_contract?: boolean | null;
40
+ collateral_inputs?: KoiosTxIO[] | null;
41
+ /** Live Koios returns ONE object here (the spec says array); both shapes are accepted. */
42
+ collateral_output?: KoiosTxIO | KoiosTxIO[] | null;
43
+ reference_inputs?: KoiosTxIO[] | null;
44
+ /** Net mint per asset with `_assets: true`. A negative quantity is a burn. Older Koios omits it. */
45
+ assets_minted?: Array<{
46
+ policy_id?: string;
47
+ asset_name?: string | null;
48
+ quantity?: string | number;
49
+ }> | null;
50
+ /** `_withdrawals: true` only (crawler batch path); null/absent otherwise. */
51
+ withdrawals?: Array<{
52
+ amount?: string | number;
53
+ stake_addr?: string;
54
+ }> | null;
55
+ /** Only with `_certs: true`. `type` uses Koios names such as pool_delegation. */
56
+ certificates?: Array<{
57
+ index?: number | null;
58
+ type?: string;
59
+ info?: Record<string, unknown> | null;
60
+ }> | null;
61
+ }
62
+ /** CardanoBackend implementation on the Koios REST API (Axios). */
63
+ export declare class KoiosBackend implements CardanoBackend, PaginatingBackend, EnumeratingBackend, TokenRegistryBackend {
9
64
  readonly name = "koios";
10
65
  private api;
11
66
  private network;
12
- /**
13
- * Constructor
14
- */
15
67
  constructor(network: Network, timeoutMs: number, apiKey?: string);
16
- /**
17
- * Initialize the backend
18
- */
68
+ /** Probe /tip to verify connectivity. */
19
69
  init(): Promise<boolean>;
20
- /**
21
- * Retry a Koios API call up to 3 times with exponential backoff if the
22
- * result is an empty array. Koios sometimes returns [] transiently for
23
- * valid queries — a single retry is not always sufficient for historical
24
- * epoch lookups, so we retry with increasing delays (500 → 1000 → 2000 ms).
25
- */
70
+ /** Retry with backoff when Koios briefly returns [] for a valid query. */
26
71
  private fetchWithRetryOnEmpty;
27
- /**
28
- * Koios runs several load-balanced grest instances and they are occasionally
29
- * version-skewed: some return HTTP 400 with Postgres error 42804 ("structure
30
- * of query does not match function result type", e.g. `out_sum_lovelace`
31
- * word128 vs numeric on /epoch_info) while healthy instances serve the
32
- * IDENTICAL request fine. The same request therefore flips 200/400 between
33
- * calls. Retrying a few times lands on a healthy instance. Scoped strictly to
34
- * the 42804 type-skew error so genuine 400s (bad params) still fail fast.
35
- */
36
72
  private getWithRetryOn42804;
37
- /**
38
- * Get Transaction Data for specified transaction hash
39
- * @param hash transaction hash (hex)
40
- * @returns {Promise<Transaction>} transaction data
41
- */
42
73
  getTransaction(hash: string): Promise<Transaction>;
43
- /**
44
- * Get Block Data for specified block hash
45
- * @param blockHash block hash (hex)
46
- * @returns {Promise<BlockData>} block data
47
- */
48
74
  getBlock(blockHash: string): Promise<BlockData>;
49
- /**
50
- * Get Epoch Data for specified epoch number
51
- * @param epochNumber epoch number
52
- * @returns {Promise<EpochData>} epoch data
53
- */
54
75
  getEpoch(epochNumber: number): Promise<EpochData>;
55
- /**
56
- * Get Address Data (without transactions - use getAddressTransactions() separately)
57
- * @param address bech32 address
58
- * @returns {Promise<Address>} address data
59
- */
76
+ /** Address data. Transactions come from getAddressTransactions(). */
60
77
  getAddress(address: string): Promise<Address>;
61
- /**
62
- * Get Address Transactions
63
- * @param address bech32 address
64
- * @returns {Promise<Transaction[]>} list of transactions for this address
65
- */
66
78
  getAddressTransactions(address: string, limit: number): Promise<Transaction[]>;
67
- /**
68
- * Get Address UTxOs for specified address
69
- * @param address bech32 address
70
- * @returns {Promise<UTxO[]>} list of UTxOs
71
- */
72
79
  getAddressUtxos(address: string): Promise<UTxO[]>;
73
- /**
74
- * Get UTxOs by payment credential. Returns UTxOs across all bech32 addresses
75
- * sharing the given 28-byte payment credential (key hash or script hash).
76
- * Native Koios endpoint — single round-trip with inline-datum hydration.
77
- * @param credHash 28-byte payment credential as 56-char lowercase hex
78
- * @returns {Promise<UTxO[]>} list of UTxOs across all bech32 forms
79
- */
80
+ /** UTxOs of every address with this payment credential (56 hex chars). */
80
81
  getCredentialUtxos(credHash: string): Promise<UTxO[]>;
81
- /**
82
- * Get Network Information
83
- * @returns {Promise<Network>} network information
84
- */
85
82
  getNetworkInformation(): Promise<NetworkInformation>;
86
- /**
87
- * Get Transaction Metadata for specified transaction hash
88
- * @param tx_hash transaction hash (hex)
89
- * @returns {Promise<MetadataLabelTx[]>} transaction metadata list
90
- */
91
83
  getTransactionMetadata(tx_hash: string): Promise<MetadataLabelTx[]>;
92
- /**
93
- * Get Pool Data for specified pool id
94
- * @param poolId pool id
95
- * @returns {Promise<PoolData>} pool data
96
- */
97
84
  getPool(poolId: string): Promise<PoolData>;
98
- /**
99
- * Get Asset Info (supply, mint history, CIP-25 + CIP-26 metadata).
100
- * Koios's `asset_info` returns total_supply, mint/burn counts split,
101
- * minting tx + creation_time, and both on-chain and registry metadata.
102
- * @param unit policyId + assetNameHex (concatenated hex)
103
- * @returns {Promise<AssetInfo>} canonical asset info
104
- */
85
+ /** Map one Koios /pool_info row to the canonical PoolData. */
86
+ private _mapKoiosPool;
87
+ /** Asset info from Koios `asset_info`. */
105
88
  getAssetInfo(unit: string): Promise<AssetInfo>;
106
- /**
107
- * Get latest mint/burn events for an asset.
108
- * Koios's `asset_history` returns minting_txs[{ tx_hash, block_time, quantity }]
109
- * with `quantity` SIGNED (negative = burn). Action is derived from sign;
110
- * the canonical `quantity` field stores absolute value.
111
- * @param unit policyId + assetNameHex (concatenated hex)
112
- * @param limit max number of events (default 100). Note: Koios returns ALL events;
113
- * limit is applied client-side after sort-by-block_time desc.
114
- * @returns {Promise<AssetHistoryEntry[]>} list of mint/burn events (most recent first)
115
- */
116
89
  getAssetHistory(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
117
- /**
118
- * Get Drep Data for specified drep id
119
- * @param drepId drep id
120
- * @returns {Promise<DrepData>} drep data
121
- */
122
90
  getDrep(drepId: string): Promise<DrepData>;
123
- /**
124
- * Get Account Data for specified stake address
125
- * @param accountId account id
126
- * @returns {Promise<AccountData>} account data
127
- */
91
+ /** Map one Koios /drep_info row to the canonical DrepData. */
92
+ private _mapKoiosDrep;
128
93
  getAccount(accountId: string): Promise<AccountData>;
129
- /**
130
- * Submit Transaction
131
- * @param signedTxCbor signed transaction in CBOR hex format
132
- * @returns {Promise<string>} transaction hash
133
- */
134
94
  submitTransaction(signedTxCbor: string): Promise<string>;
135
- /**
136
- * Get Protocol Parameters
137
- * @returns {Promise<any>} protocol parameters
138
- */
139
95
  getProtocolParameters(): Promise<LedgerProtocolParameters>;
140
- /**
141
- * Get Latest Block Data
142
- * @returns {Promise<BlockData>} latest block data
143
- */
144
96
  getLatestBlock(): Promise<BlockData>;
145
- /**
146
- * Get Latest Epoch Data
147
- * @returns {Promise<EpochData>} latest epoch data
148
- */
149
97
  getLatestEpoch(): Promise<EpochData>;
150
- /**
151
- * Get the latest chain tip slot.
152
- * @returns {Promise<number>} current chain slot
153
- */
154
98
  getCurrentSlot(): Promise<number>;
155
- /**
156
- * Check whether a UTxO is still unspent via Koios `POST /utxo_info`.
157
- * @param txHash 64-char lowercase hex
158
- * @param outputIndex non-negative integer
159
- * @returns {Promise<boolean>} true iff the UTxO exists and is unspent
160
- */
99
+ /** Whether a UTxO exists and is unspent, via Koios `POST /utxo_info`. */
161
100
  isUtxoUnspent(txHash: string, outputIndex: number): Promise<boolean>;
162
- /**
163
- * Get transaction hashes for an address (lightweight — no full tx details).
164
- * @param address bech32 address
165
- * @param limit maximum number of hashes
166
- * @returns {Promise<string[]>} most recent tx hashes
167
- */
101
+ /** Most recent tx hashes of an address, without tx details. */
168
102
  getAddressTransactionHashes(address: string, limit: number): Promise<string[]>;
169
- /**
170
- * Batch fetch multiple transactions by hash using Koios POST /tx_info.
171
- * Sends all hashes in one request (chunked at 100 per Koios limit).
172
- * @param txHashes array of transaction hashes
173
- * @returns {Promise<Map<string, Transaction>>} map of hash -> Transaction
174
- */
103
+ /** crawler.certificates: ask /tx_info for certificates + withdrawals on the crawl's batch call. */
104
+ private crawlCertificates;
105
+ configureCrawl(options: {
106
+ certificates: boolean;
107
+ }): void;
108
+ /** Batch fetch transactions via POST /tx_info, chunked at 100 hashes (Koios limit). */
175
109
  getTransactionsBatch(txHashes: string[]): Promise<Map<string, Transaction>>;
176
- /**
177
- * Map a Koios /block_info response object to our BlockData (same shape getBlock
178
- * maps inline; kept private to avoid touching getBlock).
179
- */
110
+ /** Map a Koios /block_info row to BlockData. */
180
111
  private mapKoiosBlockInfo;
181
- /**
182
- * Get a block by its height via the PostgREST-filtered /blocks list, then resolve
183
- * full data through /block_info.
184
- */
112
+ /** Finds the block in the filtered /blocks list, then reads it from /block_info. */
185
113
  getBlockByHeight(height: number): Promise<BlockData>;
186
- /**
187
- * Get up to `count` blocks following `afterHash`, in ascending chain order.
188
- * Koios has no "next after hash" endpoint, so we list blocks above the anchor height
189
- * (PostgREST gt + order + limit), then batch /block_info. When the caller already
190
- * knows the anchor height (the crawler's cursor), the hash→height resolution
191
- * round-trip is skipped entirely.
192
- */
193
114
  getNextBlocks(afterHash: string, count: number, afterHeight?: number): Promise<BlockData[]>;
194
- /**
195
- * Get the full transaction list of a block in block order via /block_txs → /tx_info
196
- * batch. Handles both the current flattened shape ({tx_hash} per row) and the older
197
- * {tx_hashes:[...]} shape defensively.
198
- */
115
+ /** Rows per page when listing ids (PostgREST caps a response at 1000 rows). */
116
+ private static readonly LIST_PAGE_SIZE;
117
+ /** Ids resolved per /pool_info / /drep_info request. */
118
+ private static readonly INFO_BATCH_SIZE;
119
+ /** Page cap. 500 pages hold 500 000 ids, far beyond any real pool or DRep set. */
120
+ private static readonly LIST_MAX_PAGES;
121
+ /** Pages through a PostgREST list endpoint for one id column. Stops on the first short page. */
122
+ private listAllIds;
123
+ /** Units with a CIP-26 registry entry, from `asset_token_registry` (the whole registry, paged). */
124
+ getTokenRegistryUnits(): Promise<string[]>;
125
+ /** All pool ids, including retired ones, so a snapshot does not drop retiring pools. */
126
+ getPoolIds(): Promise<string[]>;
127
+ /** Resolve pool ids in batches. Ids Koios does not return are omitted, never filled with empty rows. */
128
+ getPools(poolIds: string[]): Promise<PoolData[]>;
129
+ /** All DRep ids known to Koios (bech32). */
130
+ getDrepIds(): Promise<string[]>;
131
+ /** Resolve DRep ids in batches; unknown ids are omitted (see getPools). */
132
+ getDreps(drepIds: string[]): Promise<DrepData[]>;
133
+ /** All transactions of a block in order. /block_txs may answer flat rows or one `tx_hashes` array. */
199
134
  getBlockTransactions(blockHash: string): Promise<Transaction[]>;
200
- /**
201
- * Map a Koios /tx_info response object to the normalized Transaction type.
202
- */
135
+ /** Map a Koios /tx_info row to the normalized Transaction (ledger view, see ledgerView). */
203
136
  private _mapKoiosTx;
204
137
  }
138
+ export declare function mapKoiosCertificates(certs: NonNullable<KoiosTxInfo['certificates']>): TxCertificate[];
139
+ export {};
205
140
  //# sourceMappingURL=koios-backend.d.ts.map