@odatano/core 2.0.0-rc.4 → 2.0.0-rc.41

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 (166) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +251 -0
  2. package/@cds-models/CardanoAgentService/index.js +36 -0
  3. package/@cds-models/CardanoBackendService/index.d.ts +357 -0
  4. package/@cds-models/CardanoBackendService/index.js +40 -0
  5. package/@cds-models/CardanoIndexerService/index.d.ts +194 -2
  6. package/@cds-models/CardanoIndexerService/index.js +25 -0
  7. package/@cds-models/CardanoODataService/index.d.ts +305 -7
  8. package/@cds-models/CardanoODataService/index.js +34 -0
  9. package/@cds-models/CardanoSignService/index.d.ts +28 -3
  10. package/@cds-models/CardanoSignService/index.js +3 -0
  11. package/@cds-models/CardanoTransactionService/index.d.ts +46 -13
  12. package/@cds-models/CardanoTransactionService/index.js +4 -0
  13. package/@cds-models/index.d.ts +72 -0
  14. package/@cds-models/index.js +12 -0
  15. package/@cds-models/odatano/cardano/index.d.ts +408 -7
  16. package/@cds-models/odatano/cardano/index.js +42 -0
  17. package/README.md +64 -5
  18. package/db/schema.cds +2297 -1633
  19. package/db/types.cds +114 -0
  20. package/package.json +27 -6
  21. package/scripts/migrate-slot-leader.mjs +104 -0
  22. package/scripts/migrate-txseq.mjs +147 -0
  23. package/src/index.d.ts +18 -11
  24. package/src/index.js +44 -14
  25. package/src/plugin.js +42 -52
  26. package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
  27. package/srv/blockchain/backends/blockfrost-backend.js +53 -162
  28. package/srv/blockchain/backends/cardano-backend.d.ts +104 -158
  29. package/srv/blockchain/backends/cardano-backend.js +19 -5
  30. package/srv/blockchain/backends/koios-backend.d.ts +126 -60
  31. package/srv/blockchain/backends/koios-backend.js +376 -235
  32. package/srv/blockchain/backends/odatano-backend.d.ts +64 -0
  33. package/srv/blockchain/backends/odatano-backend.js +170 -0
  34. package/srv/blockchain/backends/ogmios-backend.d.ts +162 -94
  35. package/srv/blockchain/backends/ogmios-backend.js +556 -201
  36. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
  37. package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
  38. package/srv/blockchain/cardano-client.d.ts +87 -202
  39. package/srv/blockchain/cardano-client.js +210 -240
  40. package/srv/blockchain/cardano-indexer.d.ts +311 -242
  41. package/srv/blockchain/cardano-indexer.js +1238 -362
  42. package/srv/blockchain/cardano-tx-builder.d.ts +44 -81
  43. package/srv/blockchain/cardano-tx-builder.js +173 -132
  44. package/srv/blockchain/crawler/certificate-backfill.d.ts +67 -0
  45. package/srv/blockchain/crawler/certificate-backfill.js +169 -0
  46. package/srv/blockchain/crawler/crawler.d.ts +139 -54
  47. package/srv/blockchain/crawler/crawler.js +478 -96
  48. package/srv/blockchain/crawler/hooks.d.ts +3 -14
  49. package/srv/blockchain/crawler/index.d.ts +5 -0
  50. package/srv/blockchain/crawler/index.js +35 -7
  51. package/srv/blockchain/crawler/sync-state.d.ts +46 -28
  52. package/srv/blockchain/crawler/sync-state.js +128 -43
  53. package/srv/blockchain/crawler/transaction-backfill.d.ts +52 -0
  54. package/srv/blockchain/crawler/transaction-backfill.js +283 -0
  55. package/srv/blockchain/crawler/utxo-set-import.d.ts +78 -0
  56. package/srv/blockchain/crawler/utxo-set-import.js +363 -0
  57. package/srv/blockchain/ledger-state.d.ts +101 -0
  58. package/srv/blockchain/ledger-state.js +432 -0
  59. package/srv/blockchain/pending-spends.d.ts +28 -0
  60. package/srv/blockchain/pending-spends.js +89 -0
  61. package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
  62. package/srv/blockchain/signing/cose-verifier.js +6 -12
  63. package/srv/blockchain/signing/external-signer.d.ts +16 -113
  64. package/srv/blockchain/signing/external-signer.js +19 -122
  65. package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
  66. package/srv/blockchain/signing/hsm-signer.js +23 -63
  67. package/srv/blockchain/signing/signature-verifier.d.ts +14 -45
  68. package/srv/blockchain/signing/signature-verifier.js +73 -76
  69. package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
  70. package/srv/blockchain/signing/submission-finalizer.js +16 -49
  71. package/srv/blockchain/stored-chain.d.ts +33 -0
  72. package/srv/blockchain/stored-chain.js +234 -0
  73. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +111 -173
  74. package/srv/blockchain/transaction-building/buildooor-tx.js +649 -326
  75. package/srv/blockchain/transaction-building/caller-datums.d.ts +29 -0
  76. package/srv/blockchain/transaction-building/caller-datums.js +139 -0
  77. package/srv/blockchain/transaction-building/cardano-tx.d.ts +10 -35
  78. package/srv/blockchain/transaction-rows.d.ts +12 -0
  79. package/srv/blockchain/transaction-rows.js +43 -0
  80. package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
  81. package/srv/blockchain/wallet-worker/build-request.js +18 -23
  82. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
  83. package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
  84. package/srv/blockchain/wallet-worker/index.js +2 -8
  85. package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
  86. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  87. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
  88. package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
  89. package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
  90. package/srv/blockchain/wallet-worker/signers.js +3 -8
  91. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
  92. package/srv/blockchain/wallet-worker/wallet-worker.js +40 -91
  93. package/srv/cardano-agent-service.cds +146 -0
  94. package/srv/cardano-agent-service.d.ts +2 -0
  95. package/srv/cardano-agent-service.js +12 -0
  96. package/srv/cardano-backend-service.cds +52 -0
  97. package/srv/cardano-backend-service.d.ts +2 -0
  98. package/srv/cardano-backend-service.js +244 -0
  99. package/srv/cardano-indexer-service.cds +201 -73
  100. package/srv/cardano-indexer-service.js +280 -11
  101. package/srv/cardano-service.cds +65 -2
  102. package/srv/cardano-service.js +170 -129
  103. package/srv/cardano-sign-service.cds +200 -180
  104. package/srv/cardano-sign-service.js +57 -184
  105. package/srv/cardano-tx-service.cds +439 -370
  106. package/srv/cardano-tx-service.js +231 -190
  107. package/srv/cardano-ui.cds +16 -16
  108. package/srv/cardano-worker-service.js +7 -15
  109. package/srv/cbor/index.d.ts +1 -1
  110. package/srv/cbor/parse.d.ts +27 -0
  111. package/srv/cbor/parse.js +63 -2
  112. package/srv/server.d.ts +28 -86
  113. package/srv/server.js +132 -135
  114. package/srv/utils/agent-grants-config.d.ts +37 -0
  115. package/srv/utils/agent-grants-config.js +138 -0
  116. package/srv/utils/agent-grants.d.ts +262 -0
  117. package/srv/utils/agent-grants.js +922 -0
  118. package/srv/utils/agent-token-auth.d.ts +16 -0
  119. package/srv/utils/agent-token-auth.js +78 -0
  120. package/srv/utils/backend-request-handler.d.ts +2 -16
  121. package/srv/utils/backend-request-handler.js +3 -18
  122. package/srv/utils/collections.d.ts +4 -8
  123. package/srv/utils/collections.js +4 -8
  124. package/srv/utils/const.d.ts +30 -67
  125. package/srv/utils/const.js +32 -72
  126. package/srv/utils/crypto.d.ts +3 -12
  127. package/srv/utils/crypto.js +5 -18
  128. package/srv/utils/db-indexes.d.ts +25 -0
  129. package/srv/utils/db-indexes.js +94 -0
  130. package/srv/utils/db-sanitize.d.ts +27 -0
  131. package/srv/utils/db-sanitize.js +85 -0
  132. package/srv/utils/epoch-slots.d.ts +20 -0
  133. package/srv/utils/epoch-slots.js +43 -0
  134. package/srv/utils/error-codes.d.ts +20 -73
  135. package/srv/utils/error-codes.js +19 -70
  136. package/srv/utils/errors.d.ts +50 -177
  137. package/srv/utils/errors.js +94 -218
  138. package/srv/utils/legacy-service-paths.d.ts +11 -0
  139. package/srv/utils/legacy-service-paths.js +58 -0
  140. package/srv/utils/liveness.d.ts +16 -0
  141. package/srv/utils/liveness.js +40 -0
  142. package/srv/utils/mappers.d.ts +128 -214
  143. package/srv/utils/mappers.js +354 -299
  144. package/srv/utils/network-context.js +2 -11
  145. package/srv/utils/pg-inline-json.d.ts +8 -0
  146. package/srv/utils/pg-inline-json.js +62 -0
  147. package/srv/utils/pg-order-nulls.d.ts +14 -0
  148. package/srv/utils/pg-order-nulls.js +56 -0
  149. package/srv/utils/plutus-placeholders.d.ts +23 -16
  150. package/srv/utils/plutus-placeholders.js +63 -27
  151. package/srv/utils/rate-limiter.d.ts +46 -0
  152. package/srv/utils/rate-limiter.js +116 -0
  153. package/srv/utils/service-events.d.ts +2 -22
  154. package/srv/utils/service-events.js +3 -23
  155. package/srv/utils/signing-helper.d.ts +6 -16
  156. package/srv/utils/signing-helper.js +36 -60
  157. package/srv/utils/tx-build-helper.d.ts +28 -93
  158. package/srv/utils/tx-build-helper.js +75 -124
  159. package/srv/utils/tx-request-parsers.d.ts +101 -28
  160. package/srv/utils/tx-request-parsers.js +410 -43
  161. package/srv/utils/tx-utils.d.ts +4 -23
  162. package/srv/utils/tx-utils.js +12 -41
  163. package/srv/utils/types.d.ts +252 -179
  164. package/srv/utils/types.js +2 -6
  165. package/srv/utils/validators.d.ts +24 -90
  166. package/srv/utils/validators.js +50 -147
package/src/plugin.js CHANGED
@@ -41,80 +41,73 @@ const path_1 = __importDefault(require("path"));
41
41
  const logger = cds_1.default.log('ODATANO');
42
42
  const pluginRoot = path_1.default.resolve(__dirname, '..');
43
43
  let initialized = false;
44
- /**
45
- * CAP Plugin registration for @odatano/core
46
- * This is executed when the plugin is loaded via cds-plugin.js
47
- */
48
- // Register service kinds so consumer apps can configure via cds.env.requires
44
+ // CAP plugin registration for @odatano/core; loaded via cds-plugin.js.
45
+ // Register the service kind so consumer apps can configure via cds.env.requires
49
46
  if (!cds_1.default.env.requires) {
50
47
  cds_1.default.env.requires = {};
51
48
  }
52
49
  if (!cds_1.default.env.requires.kinds) {
53
50
  cds_1.default.env.requires.kinds = {};
54
51
  }
52
+ /** The schema and the six CDS services this package ships, package-qualified. */
53
+ const PLUGIN_MODEL = [
54
+ '@odatano/core/db/schema',
55
+ '@odatano/core/srv/cardano-service',
56
+ '@odatano/core/srv/cardano-tx-service',
57
+ '@odatano/core/srv/cardano-sign-service',
58
+ '@odatano/core/srv/cardano-indexer-service',
59
+ '@odatano/core/srv/cardano-worker-service',
60
+ '@odatano/core/srv/cardano-agent-service'
61
+ ];
62
+ /** Relative `@impl` values used in the CDS files (rewritten in plugin mode, see below). */
63
+ const IMPL_PATHS = [
64
+ 'srv/cardano-service',
65
+ 'srv/cardano-tx-service',
66
+ 'srv/cardano-sign-service',
67
+ 'srv/cardano-indexer-service',
68
+ 'srv/cardano-worker-service',
69
+ 'srv/cardano-agent-service'
70
+ ];
55
71
  cds_1.default.env.requires.kinds['odatano-core'] = {
56
72
  impl: '@odatano/core',
57
- model: [
58
- '@odatano/core/db/schema',
59
- '@odatano/core/srv/cardano-service',
60
- '@odatano/core/srv/cardano-tx-service',
61
- '@odatano/core/srv/cardano-sign-service',
62
- '@odatano/core/srv/cardano-indexer-service',
63
- '@odatano/core/srv/cardano-worker-service'
64
- ]
73
+ model: [...PLUGIN_MODEL]
65
74
  };
66
- // CRITICAL: Also set model directly on the requires entry.
67
- // CAP's _link_required_services() merges kind→requires BEFORE cds-plugin.js runs,
68
- // so the model array on the kind is never merged. Set it directly.
75
+ // Also set model on the requires entry: CAP merges kind→requires before cds-plugin.js
76
+ // runs, so the model array on the kind alone is never picked up.
69
77
  const req = cds_1.default.env.requires['odatano-core'];
70
78
  if (req) {
71
- req.model = [
72
- '@odatano/core/db/schema',
73
- '@odatano/core/srv/cardano-service',
74
- '@odatano/core/srv/cardano-tx-service',
75
- '@odatano/core/srv/cardano-sign-service',
76
- '@odatano/core/srv/cardano-indexer-service',
77
- '@odatano/core/srv/cardano-worker-service'
78
- ];
79
+ req.model = [...PLUGIN_MODEL];
79
80
  }
80
81
  logger.debug('Plugin registered');
81
82
  /**
82
- * Rewrite @impl paths for plugin mode.
83
- * CDS files use relative @impl (e.g. 'srv/cardano-service') which resolves from cds.root.
84
- * In standalone mode cds.root IS the package root, so it works.
85
- * In plugin mode cds.root is the consumer app — rewrite to package-qualified paths
86
- * so CAP resolves via Node module resolution (node_modules/@odatano/core/srv/...).
83
+ * Agent grants (off by default). Must run at plugin load, before CAP builds its
84
+ * middlewares, because it swaps the auth impl. Idempotent; server.ts repeats it for standalone.
85
+ */
86
+ require('../srv/utils/agent-grants-config')
87
+ .activateAgentGrants();
88
+ // The old path of the read service keeps answering until the 2.0.0 release.
89
+ require('../srv/utils/legacy-service-paths')
90
+ .registerLegacyServicePaths();
91
+ /**
92
+ * Plugin mode: relative @impl paths resolve from cds.root (the consumer app), so
93
+ * rewrite them to package-qualified paths that Node module resolution can find.
87
94
  */
88
95
  cds_1.default.on('loaded', (model) => {
89
96
  if (path_1.default.resolve(cds_1.default.root) === pluginRoot)
90
97
  return;
91
98
  const defs = model.definitions ?? {};
92
99
  for (const def of Object.values(defs)) {
93
- if (def['@impl'] === 'srv/cardano-service') {
94
- def['@impl'] = '@odatano/core/srv/cardano-service';
95
- }
96
- else if (def['@impl'] === 'srv/cardano-tx-service') {
97
- def['@impl'] = '@odatano/core/srv/cardano-tx-service';
98
- }
99
- else if (def['@impl'] === 'srv/cardano-sign-service') {
100
- def['@impl'] = '@odatano/core/srv/cardano-sign-service';
101
- }
102
- else if (def['@impl'] === 'srv/cardano-indexer-service') {
103
- def['@impl'] = '@odatano/core/srv/cardano-indexer-service';
104
- }
105
- else if (def['@impl'] === 'srv/cardano-worker-service') {
106
- def['@impl'] = '@odatano/core/srv/cardano-worker-service';
100
+ const impl = def['@impl'];
101
+ if (impl && IMPL_PATHS.includes(impl)) {
102
+ def['@impl'] = `@odatano/core/${impl}`;
107
103
  }
108
104
  }
109
105
  });
110
- /**
111
- * Initialize blockchain components when services are served
112
- */
106
+ // Initialize blockchain components once services are served.
113
107
  cds_1.default.on('served', async () => {
114
108
  if (initialized)
115
109
  return;
116
- // Honor SKIP_AUTO_INIT so consumer test suites can mount the plugin without it
117
- // opening real backend connections (matches srv/server.ts's standalone hook).
110
+ // SKIP_AUTO_INIT lets consumer test suites mount the plugin without backend connections.
118
111
  if (process.env.SKIP_AUTO_INIT === 'true') {
119
112
  logger.info('Skipping plugin auto-initialization (SKIP_AUTO_INIT=true)');
120
113
  return;
@@ -127,13 +120,10 @@ cds_1.default.on('served', async () => {
127
120
  initialized = true;
128
121
  }
129
122
  catch (err) {
130
- // Don't throw - plugin failure shouldn't crash the host app
123
+ // Never throw: a plugin failure must not crash the host app.
131
124
  logger.error('Failed to initialize plugin:', err);
132
125
  }
133
126
  });
134
- /**
135
- * Graceful shutdown handler
136
- */
137
127
  cds_1.default.on('shutdown', async () => {
138
128
  if (!initialized)
139
129
  return;
@@ -1,174 +1,72 @@
1
1
  import { CardanoBackend, PaginatingBackend } from './cardano-backend';
2
2
  import { Transaction, BlockData, Address, UTxO, NetworkInformation, EpochData, MetadataLabelTx, PoolData, AccountData, DrepData, AssetInfo, AssetHistoryEntry, LedgerProtocolParameters } from '../../utils/types';
3
3
  import { Network } from '../cardano-client';
4
- /**
5
- * BlockfrostBackend Implementation for CardanoBackend Interface
6
- * Implements the CardanoBackend interface using Blockfrost API SDK
7
- */
4
+ /** CardanoBackend + PaginatingBackend implementation on the Blockfrost API SDK. */
8
5
  export declare class BlockfrostBackend implements CardanoBackend, PaginatingBackend {
9
6
  readonly name = "blockfrost";
10
7
  private api;
11
8
  private network;
12
9
  private timeoutMs;
13
- /**
14
- * Constructor
15
- */
16
10
  constructor(network: Network, timeoutMs: number, projectId: string, customBackend?: string);
17
- /**
18
- * Initialize the backend
19
- */
20
11
  init(): Promise<boolean>;
21
- /**
22
- * Get Network Information
23
- * @returns {Promise<NetworkInformation>} network information
24
- */
12
+ /** Network information (supply, stake). */
25
13
  getNetworkInformation(): Promise<NetworkInformation>;
26
- /**
27
- * Get Block Data
28
- * @param blockHash block hash (hex)
29
- * @returns {Promise<BlockData>} block data
30
- */
14
+ /** Block by hash (hex). */
31
15
  getBlock(blockHash: string): Promise<BlockData>;
32
- /**
33
- * Get Epoch Data
34
- * @param epochNumber epoch number
35
- * @returns {Promise<EpochData>} epoch data
36
- */
16
+ /** Epoch by number. */
37
17
  getEpoch(epochNumber: number): Promise<EpochData>;
38
- /**
39
- * Get Transaction Data
40
- * @param hash transaction hash (hex)
41
- * @returns {Promise<Transaction>} transaction data
42
- */
18
+ /** Transaction by hash (hex), with UTxOs and metadata. */
43
19
  getTransaction(hash: string): Promise<Transaction>;
44
- /**
45
- * Get Transaction Metadata
46
- * @param tx_hash transaction hash (hex)
47
- * @returns {Promise<MetadataLabelTx[]>} transaction metadata list
48
- */
20
+ /** Metadata labels of a transaction (hash hex); NotFoundError when it has none. */
49
21
  getTransactionMetadata(tx_hash: string): Promise<MetadataLabelTx[]>;
50
- /**
51
- * Get Address Data (without transactions - use getAddressTransactions() separately)
52
- * @param address bech32 address string
53
- * @returns {Promise<Address>} address data
54
- */
22
+ /** Address data with UTxOs (no transactions — see getAddressTransactions()). */
55
23
  getAddress(address: string): Promise<Address>;
56
- /**
57
- * Get Address Transactions
58
- * @param address bech32 address string
59
- * @returns {Promise<Transaction[]>} list of transactions for this address
60
- */
24
+ /** Transactions of an address, most recent first, with full details (batched). */
61
25
  getAddressTransactions(address: string, limit?: number): Promise<Transaction[]>;
62
- /**
63
- * Get Address UTxOs
64
- * @param address bech32 address string
65
- * @returns {Promise<UTxO[]>} list of UTxOs
66
- */
26
+ /** UTxOs of an address. */
67
27
  getAddressUtxos(address: string): Promise<UTxO[]>;
68
- /**
69
- * Get Pool Data
70
- * @param poolId stake pool id (hex)
71
- * @return {Promise<PoolData>} pool data
72
- */
28
+ /** Stake pool by id. */
73
29
  getPool(poolId: string): Promise<PoolData>;
74
30
  /**
75
- * Get Asset Info (supply, mint history, CIP-25 + CIP-26 metadata).
76
- * Blockfrost does NOT expose initial-mint timestamp in this endpoint —
77
- * `initialMintTime` is left null. Filling it would cost an extra tx fetch.
78
- * @param unit policyId + assetNameHex (concatenated hex)
79
- * @return {Promise<AssetInfo>} canonical asset info
31
+ * Asset info (supply, mint history, CIP-25 + CIP-26 metadata); unit = policyId + assetNameHex.
32
+ * Blockfrost does not expose the initial-mint timestamp here, so `initialMintTime` stays null.
80
33
  */
81
34
  getAssetInfo(unit: string): Promise<AssetInfo>;
82
35
  /**
83
- * Get latest mint/burn events for an asset, with backfilled block metadata.
84
- * Blockfrost's `assetsHistory` returns tx_hash + action + amount only; we
85
- * backfill `blockTime` and `blockHeight` via concurrent `api.txs(...)` calls.
86
- * Cost: 1 extra API call per history entry. Failed tx fetches leave the
87
- * timestamp fields null instead of failing the whole call (best-effort).
88
- * @param unit policyId + assetNameHex (concatenated hex)
89
- * @param limit max number of events (default 100, max 100 per Blockfrost page)
90
- * @return {Promise<AssetHistoryEntry[]>} list of mint/burn events (most recent first)
36
+ * Mint/burn events of an asset, most recent first (max 100 per Blockfrost page).
37
+ * `assetsHistory` carries no block metadata; blockTime/blockHeight are backfilled with one
38
+ * best-effort `txs()` call per entry (a failed fetch leaves them null).
91
39
  */
92
40
  getAssetHistory(unit: string, limit?: number): Promise<AssetHistoryEntry[]>;
93
- /**
94
- * Get Drep Data
95
- * @param drepId drep id (bech32)
96
- * @return {Promise<DrepData>} drep data
97
- */
41
+ /** DRep by id (bech32). */
98
42
  getDrep(drepId: string): Promise<DrepData>;
99
- /**
100
- * Get Account Data
101
- * @param stakeAddress bech32 stake address
102
- * @return {Promise<AccountData>} account data
103
- */
43
+ /** Account by stake address (bech32), with all its addresses and their UTxOs. */
104
44
  getAccount(stakeAddress: string): Promise<AccountData>;
105
- /**
106
- * Submit Transaction
107
- * @param signedTxCbor hex-encoded signed transaction CBOR
108
- * @returns {Promise<string>} transaction hash
109
- */
45
+ /** Submit a signed transaction (CBOR hex); returns the tx hash. */
110
46
  submitTransaction(signedTxCbor: string): Promise<string>;
111
- /**
112
- * Get Protocol Parameters
113
- * @returns {Promise<LedgerProtocolParameters>} protocol parameters
114
- */
47
+ /** Protocol parameters of the latest epoch. */
115
48
  getProtocolParameters(): Promise<LedgerProtocolParameters>;
116
- /**
117
- * Get Latest Epoch Data
118
- * @returns {Promise<EpochData>} latest epoch data
119
- */
49
+ /** Latest epoch. */
120
50
  getLatestEpoch(): Promise<EpochData>;
121
- /**
122
- * Get Latest Block Data
123
- * @returns {Promise<BlockData>} latest block data
124
- */
51
+ /** Latest block. */
125
52
  getLatestBlock(): Promise<BlockData>;
126
- /**
127
- * Get the latest chain tip slot.
128
- * @returns {Promise<number>} current chain slot
129
- */
53
+ /** Latest chain tip slot; ProviderUnavailableError when the latest block has no slot. */
130
54
  getCurrentSlot(): Promise<number>;
131
- /**
132
- * Check whether a UTxO is still unspent via Blockfrost's `consumed_by_tx` field.
133
- * @param txHash 64-char lowercase hex
134
- * @param outputIndex non-negative integer
135
- * @returns {Promise<boolean>} true iff the UTxO exists and is unspent
136
- */
55
+ /** Whether a UTxO is unspent, via Blockfrost's `consumed_by_tx`; false for unknown tx or out-of-range index. */
137
56
  isUtxoUnspent(txHash: string, outputIndex: number): Promise<boolean>;
138
57
  /** Max concurrent Blockfrost API calls (free tier: ~10 req/s) */
139
58
  private static readonly MAX_CONCURRENT;
140
- /**
141
- * Get transaction hashes for an address (lightweight — no full tx details).
142
- * @param address bech32 address
143
- * @param limit maximum number of hashes
144
- * @returns {Promise<string[]>} most recent tx hashes
145
- */
59
+ /** Most recent tx hashes of an address (no details). */
146
60
  getAddressTransactionHashes(address: string, limit: number): Promise<string[]>;
147
- /**
148
- * Batch fetch multiple transactions by hash.
149
- * Blockfrost has no batch endpoint — uses concurrency-limited parallel calls.
150
- * @param txHashes array of transaction hashes
151
- * @returns {Promise<Map<string, Transaction>>} map of hash -> Transaction
152
- */
61
+ /** Transactions by hash (map hash -> Transaction); no batch endpoint, so concurrency-limited parallel calls. */
153
62
  getTransactionsBatch(txHashes: string[]): Promise<Map<string, Transaction>>;
154
- /**
155
- * Map a Blockfrost block summary (from blocks()/blocksNext()) to our BlockData.
156
- * Same shape getBlock() maps inline — kept private to avoid touching getBlock().
157
- */
63
+ /** Map a Blockfrost block summary (blocks()/blocksNext()) to BlockData. */
158
64
  private toBlockData;
159
- /**
160
- * Get a block by its height. Blockfrost's `blocks` endpoint accepts a height as
161
- * well as a hash.
162
- */
65
+ /** Block by height; Blockfrost's `blocks` endpoint accepts a height as well as a hash. */
163
66
  getBlockByHeight(height: number): Promise<BlockData>;
164
- /**
165
- * Get up to `count` blocks immediately following `afterHash`, in ascending chain order.
166
- */
67
+ /** Up to `count` blocks immediately following `afterHash`, in ascending chain order. */
167
68
  getNextBlocks(afterHash: string, count: number): Promise<BlockData[]>;
168
- /**
169
- * Get the full transaction list of a block in block order. Blockfrost returns tx
170
- * hashes; details are batched via getTransactionsBatch. Order is preserved.
171
- */
69
+ /** Full transaction list of a block in block order (hashes from blocksTxsAll, details batched). */
172
70
  getBlockTransactions(blockHash: string): Promise<Transaction[]>;
173
71
  }
174
72
  //# sourceMappingURL=blockfrost-backend.d.ts.map