@odatano/core 2.0.0-rc.42 → 2.0.0-rc.44

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 (43) hide show
  1. package/@cds-models/CardanoIndexerService/index.d.ts +78 -0
  2. package/@cds-models/CardanoIndexerService/index.js +11 -0
  3. package/@cds-models/CardanoODataService/index.d.ts +36 -0
  4. package/@cds-models/CardanoODataService/index.js +4 -0
  5. package/@cds-models/CardanoSignService/index.d.ts +1 -0
  6. package/@cds-models/CardanoTransactionService/index.d.ts +1 -0
  7. package/@cds-models/index.d.ts +1 -0
  8. package/@cds-models/odatano/cardano/index.d.ts +25 -0
  9. package/@cds-models/odatano/cardano/index.js +3 -0
  10. package/README.md +195 -195
  11. package/db/schema.cds +27 -0
  12. package/db/types.cds +421 -417
  13. package/package.json +1 -1
  14. package/srv/blockchain/asset-decimals.d.ts +16 -0
  15. package/srv/blockchain/asset-decimals.js +86 -0
  16. package/srv/blockchain/backends/ogmios-backend.js +1 -0
  17. package/srv/blockchain/cardano-indexer.js +10 -1
  18. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +20 -0
  19. package/srv/blockchain/crawler/asset-decimals-backfill.js +59 -0
  20. package/srv/blockchain/crawler/credential-backfill.d.ts +38 -0
  21. package/srv/blockchain/crawler/credential-backfill.js +126 -0
  22. package/srv/blockchain/crawler/transaction-backfill.d.ts +3 -2
  23. package/srv/blockchain/crawler/transaction-backfill.js +8 -4
  24. package/srv/blockchain/ledger-state.d.ts +1 -0
  25. package/srv/blockchain/ledger-state.js +1 -0
  26. package/srv/blockchain/stored-chain.js +5 -1
  27. package/srv/blockchain/transaction-rows.d.ts +1 -1
  28. package/srv/blockchain/transaction-rows.js +2 -1
  29. package/srv/cardano-indexer-service.cds +48 -2
  30. package/srv/cardano-indexer-service.js +47 -2
  31. package/srv/cardano-service.cds +344 -332
  32. package/srv/cardano-service.js +9 -0
  33. package/srv/cbor/cip68.d.ts +17 -0
  34. package/srv/cbor/cip68.js +58 -0
  35. package/srv/cbor/index.d.ts +2 -0
  36. package/srv/cbor/index.js +9 -1
  37. package/srv/cbor/plutus-data-json.d.ts +24 -0
  38. package/srv/cbor/plutus-data-json.js +32 -0
  39. package/srv/utils/agent-grants.js +1 -1
  40. package/srv/utils/db-indexes.js +5 -0
  41. package/srv/utils/mappers.d.ts +6 -2
  42. package/srv/utils/mappers.js +16 -0
  43. package/srv/utils/types.d.ts +9 -0
@@ -1,332 +1,344 @@
1
- using {odatano.cardano as db} from '../db/schema';
2
- using { Blake2b256, Bech32, AssetUnit, ParsedTransaction, TransactionConfirmations } from '../db/types';
3
-
4
- /**
5
- * Cardano OData Service
6
- *
7
- * Handles external read-only queries for Cardano blockchain data, including:
8
- * - Retrieving network information, blocks, epochs, pools, dreps, transactions, accounts, addresses, UTxOs, assets, and metadata
9
- * - Providing actions for fetching specific data by identifiers (hashes, addresses, etc.) and for retrieving the latest blockchain state (latest block, epoch, protocol parameters)
10
- *
11
- * ## Security: Authentication & Authorization
12
- *
13
- * All services use `@requires: 'authenticated-user'` (service-level gate).
14
- * The XSUAA scopes defined in xs-security.json (Read, Transact, Sign) are available
15
- * for consumer-level role assignment but are NOT enforced per-action in ODATANO itself.
16
- *
17
- * This is intentional — ODATANO is a blockchain bridge, not a multi-tenant application.
18
- * Per-resource ownership checks (IDOR prevention) are deliberately omitted because:
19
- *
20
- * 1. **Blockchain security model**: Unsigned transaction CBOR is not exploitable without
21
- * the corresponding private key. Viewing a build/signing request does not enable
22
- * fund theft — only the key holder can sign and submit.
23
- *
24
- * 2. **Cross-address operations are legitimate**: Smart contract interactions routinely
25
- * require building transactions for addresses the caller does not own — e.g. script
26
- * redemptions, multi-party Plutus workflows, or DApp backends building on behalf of users.
27
- * Enforcing sender == authenticated user would break these use cases.
28
- *
29
- * 3. **Consumer responsibility**: Consumers deploying ODATANO in multi-user environments
30
- * should add their own authorization layer (e.g. `@restrict` annotations, custom
31
- * middleware) that maps JWT claims to allowed wallet addresses if needed.
32
- */
33
- @requires: 'authenticated-user'
34
- @path: '/odata/v4/cardano'
35
- service CardanoODataService @(impl: './cardano-service') {
36
-
37
- // ---------------------------------------------------------------------------
38
- // Entity Projections
39
- // ---------------------------------------------------------------------------
40
-
41
- @readonly
42
- @title : 'Network Information'
43
- @description: 'Projection for Network Information'
44
- entity NetworkInformation as projection on db.NetworkInformation;
45
-
46
- @readonly
47
- @title : 'Blocks'
48
- @description: 'Projection for Blocks'
49
- entity Blocks as projection on db.Blocks;
50
-
51
- @readonly
52
- @title : 'Epochs'
53
- @description: 'Projection for Epochs'
54
- entity Epochs as projection on db.Epochs;
55
-
56
- @readonly
57
- @title : 'Pools'
58
- @description: 'Projection for Pools'
59
- entity Pools as projection on db.Pools;
60
-
61
- @readonly
62
- @title : 'Dreps'
63
- @description: 'Projection for Dreps'
64
- entity Dreps as projection on db.Dreps;
65
-
66
- @readonly
67
- @title : 'Pool Epoch Snapshots'
68
- @description: 'Projection for per-epoch stake-pool snapshots written by the chain crawler'
69
- entity PoolEpochSnapshots as projection on db.PoolEpochSnapshots;
70
-
71
- @readonly
72
- @title : 'DRep Epoch Snapshots'
73
- @description: 'Projection for per-epoch DRep snapshots written by the chain crawler'
74
- entity DrepEpochSnapshots as projection on db.DrepEpochSnapshots;
75
-
76
- @readonly
77
- @title : 'Epoch Ledger Snapshots'
78
- @description: 'Projection for per-epoch network ledger figures written by the chain crawler'
79
- entity EpochLedgerSnapshots as projection on db.EpochLedgerSnapshots;
80
-
81
- @readonly
82
- @title : 'Assets'
83
- @description: 'Projection for Native-Asset Information'
84
- entity Assets as projection on db.Assets;
85
-
86
- @readonly
87
- @title : 'Asset History'
88
- @description: 'Projection for Native-Asset Mint/Burn History'
89
- entity AssetHistory as projection on db.AssetHistory;
90
-
91
- @readonly
92
- @title : 'Transactions'
93
- @description: 'Projection for Transactions'
94
- entity Transactions as projection on db.Transactions;
95
-
96
- @readonly
97
- @title : 'Transaction Inputs'
98
- @description: 'Projection for Transaction Inputs'
99
- entity TransactionInputs as projection on db.TransactionInputs;
100
-
101
- @readonly
102
- @title : 'Transaction Outputs'
103
- @description: 'Projection for Transaction Outputs'
104
- entity TransactionOutputs as projection on db.TransactionOutputs;
105
-
106
- @readonly
107
- @title : 'Transaction Input Assets'
108
- @description: 'Projection for Transaction Input Assets'
109
- entity TransactionInputAssets as projection on db.TransactionInputAssets;
110
-
111
- @readonly
112
- @title : 'Transaction Output Assets'
113
- @description: 'Projection for Transaction Output Assets'
114
- entity TransactionOutputAssets as projection on db.TransactionOutputAssets;
115
-
116
- @readonly
117
- @title : 'Transaction Certificates'
118
- @description: 'Projection for Transaction Certificates (crawler-fed, crawler.certificates)'
119
- entity TransactionCertificates as projection on db.TransactionCertificates;
120
-
121
- @readonly
122
- @title : 'Transaction Withdrawals'
123
- @description: 'Projection for Transaction Withdrawals (crawler-fed, crawler.certificates)'
124
- entity TransactionWithdrawals as projection on db.TransactionWithdrawals;
125
-
126
- @readonly
127
- @title : 'Transaction Redeemers'
128
- @description: 'Projection for Transaction Redeemers (crawler-fed, Ogmios chain-sync)'
129
- entity TransactionRedeemers as projection on db.TransactionRedeemers;
130
-
131
- @readonly
132
- @title : 'Ledger UTxOs'
133
- @description: 'Crawler-maintained UTxO set (crawler.utxoSet); unspent while spentTxHash is null'
134
- entity LedgerUTxOs as projection on db.LedgerUTxOs;
135
-
136
- @readonly
137
- @title : 'Ledger UTxO Assets'
138
- @description: 'Native assets of a LedgerUTxOs row'
139
- entity LedgerUTxOAssets as projection on db.LedgerUTxOAssets;
140
-
141
- @readonly
142
- @title : 'Ledger Addresses'
143
- @description: 'Per-address balances from the crawler-maintained UTxO set (crawler.utxoSet)'
144
- entity LedgerAddresses as projection on db.LedgerAddresses;
145
-
146
- @readonly
147
- @title : 'Ledger Address Assets'
148
- @description: 'Native-asset balances per address (crawler.utxoSet)'
149
- entity LedgerAddressAssets as projection on db.LedgerAddressAssets;
150
-
151
- @readonly
152
- @title : 'Ledger Accounts'
153
- @description: 'Per-stake-key balances from the crawler-maintained UTxO set (crawler.utxoSet)'
154
- entity LedgerAccounts as projection on db.LedgerAccounts;
155
-
156
- @readonly
157
- @title : 'Accounts'
158
- @description: 'Projection for Accounts'
159
- entity Accounts as projection on db.Accounts;
160
-
161
- @readonly
162
- @title : 'Addresses'
163
- @description: 'Projection for Addresses'
164
- entity Addresses as projection on db.Addresses;
165
-
166
- @readonly
167
- @title : 'Address Assets'
168
- @description: 'Projection for Address Assets'
169
- entity AddressAssets as projection on db.AddressAssets;
170
-
171
- @readonly
172
- @title : 'Address UTxOs'
173
- @description: 'Projection for Address UTxOs'
174
- entity AddressUTxOs as projection on db.AddressUTxOs;
175
-
176
- @readonly
177
- @title : 'Address Transactions'
178
- @description: 'Projection for Address Transactions'
179
- entity AddressTransactions as projection on db.AddressTransactions;
180
-
181
- @readonly
182
- @title : 'UTxO Assets'
183
- @description: 'Projection for UTxO Assets'
184
- entity UTxOAssets as projection on db.UTxOAssets;
185
-
186
- @readonly
187
- @title : 'Transaction Metadata'
188
- @description: 'Projection for Transaction Metadata'
189
- entity TransactionMetadata as projection on db.TransactionMetadata;
190
-
191
- @readonly
192
- @title : 'Ledger Protocol Parameters'
193
- @description: 'Projection for Ledger Protocol Parameters'
194
- entity LedgerProtocolParameters as projection on db.LedgerProtocolParameters;
195
-
196
- // ---------------------------------------------------------------------------
197
- // Actions
198
- // ---------------------------------------------------------------------------
199
- @title : 'Get Network Information'
200
- @description: 'Retrieve current network information including network type and genesis hash'
201
- action GetNetworkInformation() returns NetworkInformation;
202
-
203
- @title : 'Get Blocks by Block Hash'
204
- @description: 'Retrieve block information using the Block Hash'
205
- action GetBlockByHash(
206
- @title: 'Block Hash'
207
- @description: 'The unique identifier of the block'
208
- hash: Blake2b256) returns Blocks;
209
-
210
- @title : 'Get Epochs by Epoch Number'
211
- @description: 'Retrieve epoch information using the Epoch Number'
212
- action GetEpochByNumber(
213
- @title: 'Epoch Number'
214
- @description: 'The sequential number of the epoch'
215
- epochNumber: Integer) returns Epochs;
216
-
217
- @title : 'Get Pools by Pool Id'
218
- @description: 'Retrieve pool information using the Pool Id'
219
- action GetPoolById(
220
- @title: 'Pool Id'
221
- @description: 'The unique identifier of the stake pool'
222
- poolId: String) returns Pools;
223
-
224
- @title : 'Get Dreps by Drep Id'
225
- @description: 'Retrieve drep information using the Drep Id'
226
- action GetDrepById(
227
- @title: 'Drep Id'
228
- @description: 'The unique identifier of the drep'
229
- drepId: String) returns Dreps;
230
-
231
- @title : 'Get Asset Info'
232
- @description: 'Retrieve native-asset information (supply, mint history, CIP-25 + CIP-26 metadata) by unit. Multi-backend (Blockfrost, Koios). Field availability differs slightly per backend — see entity description.'
233
- action GetAssetInfo(
234
- @title: 'Asset Unit'
235
- @description: 'Concatenation of policyId (56 hex) and assetNameHex (0-64 hex; ledger caps asset names at 32 bytes)'
236
- unit: AssetUnit) returns Assets;
237
-
238
- @title : 'Get Asset Mint/Burn History'
239
- @description: 'Retrieve recent mint/burn events for a native asset (most recent first). Koios is preferred (provides block timestamps); Blockfrost is the fallback (timestamps null). Always-fresh fetch — UPSERTs entries by (unit, txHash). For full pagination, query the AssetHistory entity directly with $top/$skip after seeding.'
240
- action GetAssetHistory(
241
- @title: 'Asset Unit'
242
- @description: 'Concatenation of policyId (56 hex) and assetNameHex (0-64 hex; ledger caps asset names at 32 bytes)'
243
- unit: AssetUnit,
244
- @title: 'Limit'
245
- @description: 'Maximum number of recent events to fetch (default 100, clamped to 1-100)'
246
- limit: Integer) returns many AssetHistory;
247
-
248
- @title : 'Get Accounts by Stake Address'
249
- @description: 'Retrieve account information using the Bech32 Stake Address'
250
- action GetAccountByStakeAddress(
251
- @title: 'Stake Address'
252
- @description: 'The Bech32 encoded stake address'
253
- stakeAddress: Bech32) returns Accounts;
254
-
255
- @title : 'Get Transactions by Tx Hash'
256
- @description: 'Retrieve transaction information using the Transaction Hash'
257
- action GetTransactionByHash(
258
- @title: 'Transaction Hash'
259
- @description: 'The unique identifier of the transaction'
260
- hash: Blake2b256) returns Transactions;
261
-
262
- @title : 'Get Transaction Confirmations'
263
- @description: 'Number of blocks on top of a transaction, its own block included; 0 while it is not on chain. Uses the crawled chain when the crawler is synced, else the backends.'
264
- action GetTransactionConfirmations(
265
- @title: 'Transaction Hash'
266
- @description: 'The unique identifier of the transaction'
267
- txHash: Blake2b256) returns TransactionConfirmations;
268
-
269
- @title : 'Get Transaction Metadata by Tx Hash'
270
- @description: 'Retrieve transaction metadata using the Transaction Hash'
271
- action GetMetadataByTxHash(
272
- @title: 'Transaction Hash'
273
- @description: 'The unique identifier of the transaction'
274
- txHash: Blake2b256) returns many TransactionMetadata;
275
-
276
- @title : 'Get Addresses by Bech32 Address'
277
- @description: 'Retrieve address information using the Bech32 Address'
278
- action GetAddressByBech32(
279
- @title: 'Bech32 Address'
280
- @description: 'The Bech32 encoded address'
281
- address: Bech32) returns Addresses;
282
-
283
- @title : 'Get UTxOs by Bech32 Address'
284
- @description: 'Retrieve UTxO information using the Bech32 Address'
285
- action GetUTxOsByAddress(
286
- @title: 'Bech32 Address'
287
- @description: 'The Bech32 encoded address'
288
- address: Bech32) returns many AddressUTxOs;
289
-
290
- @title : 'Get UTxOs by Payment Credential'
291
- @description: 'Retrieve UTxOs across all bech32 addresses sharing the given 28-byte payment credential (key hash or script hash). Useful for protocols that write to multiple bech32 forms of the same script (e.g. Indigo CDPs, Liqwid positions). Served from the crawled UTxO set (crawler.utxoSet active and synced) with outputs read from the node at the tip, else from Koios; throws ProviderUnavailableError when neither is available. Always fresh, no cache check.'
292
- action GetUTxOsByCredential(
293
- @title: 'Payment Credential'
294
- @description: '28-byte payment credential hash as 56-char lowercase hex string'
295
- credential: String) returns many AddressUTxOs;
296
-
297
- @title : 'Get Assets by Bech32 Address'
298
- @description: 'Retrieve asset information using the Bech32 Address'
299
- action GetAssetsByAddress(
300
- @title: 'Bech32 Address'
301
- @description: 'The Bech32 encoded address'
302
- address: Bech32) returns many AddressAssets;
303
-
304
- @title : 'Get latest Transactions by Bech32 Address'
305
- @description: 'Retrieve the latest transactions from the Bech32 Address'
306
- action GetLatestTransactionsByAddress(
307
- @title: 'Bech32 Address'
308
- @description: 'The Bech32 encoded address'
309
- address: Bech32,
310
- @title: 'Limit'
311
- @description: 'The maximum number of transactions to retrieve'
312
- limit: Integer) returns many AddressTransactions;
313
-
314
- @title : 'Get Latest Block'
315
- @description: 'Retrieve the latest block information'
316
- action GetLatestBlock() returns Blocks;
317
-
318
- @title : 'Get Latest Epoch'
319
- @description: 'Retrieve the latest epoch information'
320
- action GetLatestEpoch() returns Epochs;
321
-
322
- @title : 'Get Ledger Protocol Parameters'
323
- @description: 'Retrieve the current ledger protocol parameters'
324
- action GetLedgerProtocolParameters() returns LedgerProtocolParameters;
325
-
326
- @title : 'Parse Transaction CBOR'
327
- @description: 'Parse hex-encoded transaction CBOR (signed or unsigned) into structured fields. Pure function, no network call, no DB write.'
328
- action ParseTransactionCbor(
329
- @title: 'Transaction CBOR'
330
- @description: 'Hex-encoded transaction CBOR; signed or unsigned. Capped at 128 KiB of hex.'
331
- cbor: LargeString) returns ParsedTransaction;
332
- }
1
+ using {odatano.cardano as db} from '../db/schema';
2
+ using { Blake2b256, Bech32, AssetUnit, ParsedTransaction, TransactionConfirmations } from '../db/types';
3
+
4
+ /**
5
+ * Cardano OData Service
6
+ *
7
+ * Handles external read-only queries for Cardano blockchain data, including:
8
+ * - Retrieving network information, blocks, epochs, pools, dreps, transactions, accounts, addresses, UTxOs, assets, and metadata
9
+ * - Providing actions for fetching specific data by identifiers (hashes, addresses, etc.) and for retrieving the latest blockchain state (latest block, epoch, protocol parameters)
10
+ *
11
+ * ## Security: Authentication & Authorization
12
+ *
13
+ * All services use `@requires: 'authenticated-user'` (service-level gate).
14
+ * The XSUAA scopes defined in xs-security.json (Read, Transact, Sign) are available
15
+ * for consumer-level role assignment but are NOT enforced per-action in ODATANO itself.
16
+ *
17
+ * This is intentional — ODATANO is a blockchain bridge, not a multi-tenant application.
18
+ * Per-resource ownership checks (IDOR prevention) are deliberately omitted because:
19
+ *
20
+ * 1. **Blockchain security model**: Unsigned transaction CBOR is not exploitable without
21
+ * the corresponding private key. Viewing a build/signing request does not enable
22
+ * fund theft — only the key holder can sign and submit.
23
+ *
24
+ * 2. **Cross-address operations are legitimate**: Smart contract interactions routinely
25
+ * require building transactions for addresses the caller does not own — e.g. script
26
+ * redemptions, multi-party Plutus workflows, or DApp backends building on behalf of users.
27
+ * Enforcing sender == authenticated user would break these use cases.
28
+ *
29
+ * 3. **Consumer responsibility**: Consumers deploying ODATANO in multi-user environments
30
+ * should add their own authorization layer (e.g. `@restrict` annotations, custom
31
+ * middleware) that maps JWT claims to allowed wallet addresses if needed.
32
+ */
33
+ @requires: 'authenticated-user'
34
+ @path: '/odata/v4/cardano'
35
+ service CardanoODataService @(impl: './cardano-service') {
36
+
37
+ // ---------------------------------------------------------------------------
38
+ // Entity Projections
39
+ // ---------------------------------------------------------------------------
40
+
41
+ @readonly
42
+ @title : 'Network Information'
43
+ @description: 'Projection for Network Information'
44
+ entity NetworkInformation as projection on db.NetworkInformation;
45
+
46
+ @readonly
47
+ @title : 'Blocks'
48
+ @description: 'Projection for Blocks'
49
+ entity Blocks as projection on db.Blocks;
50
+
51
+ @readonly
52
+ @title : 'Epochs'
53
+ @description: 'Projection for Epochs'
54
+ entity Epochs as projection on db.Epochs;
55
+
56
+ @readonly
57
+ @title : 'Pools'
58
+ @description: 'Projection for Pools'
59
+ entity Pools as projection on db.Pools;
60
+
61
+ @readonly
62
+ @title : 'Dreps'
63
+ @description: 'Projection for Dreps'
64
+ entity Dreps as projection on db.Dreps;
65
+
66
+ @readonly
67
+ @title : 'Pool Epoch Snapshots'
68
+ @description: 'Projection for per-epoch stake-pool snapshots written by the chain crawler'
69
+ entity PoolEpochSnapshots as projection on db.PoolEpochSnapshots;
70
+
71
+ @readonly
72
+ @title : 'DRep Epoch Snapshots'
73
+ @description: 'Projection for per-epoch DRep snapshots written by the chain crawler'
74
+ entity DrepEpochSnapshots as projection on db.DrepEpochSnapshots;
75
+
76
+ @readonly
77
+ @title : 'Epoch Ledger Snapshots'
78
+ @description: 'Projection for per-epoch network ledger figures written by the chain crawler'
79
+ entity EpochLedgerSnapshots as projection on db.EpochLedgerSnapshots;
80
+
81
+ @readonly
82
+ @title : 'Assets'
83
+ @description: 'Projection for Native-Asset Information'
84
+ entity Assets as projection on db.Assets;
85
+
86
+ @readonly
87
+ @title : 'Asset History'
88
+ @description: 'Projection for Native-Asset Mint/Burn History'
89
+ entity AssetHistory as projection on db.AssetHistory;
90
+
91
+ @readonly
92
+ @title : 'Transactions'
93
+ @description: 'Projection for Transactions'
94
+ entity Transactions as projection on db.Transactions;
95
+
96
+ @readonly
97
+ @title : 'Transaction Inputs'
98
+ @description: 'Projection for Transaction Inputs'
99
+ entity TransactionInputs as projection on db.TransactionInputs;
100
+
101
+ @readonly
102
+ @title : 'Transaction Outputs'
103
+ @description: 'Projection for Transaction Outputs'
104
+ entity TransactionOutputs as projection on db.TransactionOutputs;
105
+
106
+ @readonly
107
+ @title : 'Transaction Input Assets'
108
+ @description: 'Projection for Transaction Input Assets'
109
+ entity TransactionInputAssets as projection on db.TransactionInputAssets;
110
+
111
+ @readonly
112
+ @title : 'Transaction Output Assets'
113
+ @description: 'Projection for Transaction Output Assets'
114
+ entity TransactionOutputAssets as projection on db.TransactionOutputAssets;
115
+
116
+ @readonly
117
+ @title : 'Transaction Certificates'
118
+ @description: 'Projection for Transaction Certificates (crawler-fed, crawler.certificates)'
119
+ entity TransactionCertificates as projection on db.TransactionCertificates;
120
+
121
+ @readonly
122
+ @title : 'Transaction Withdrawals'
123
+ @description: 'Projection for Transaction Withdrawals (crawler-fed, crawler.certificates)'
124
+ entity TransactionWithdrawals as projection on db.TransactionWithdrawals;
125
+
126
+ @readonly
127
+ @title : 'Transaction Redeemers'
128
+ @description: 'Projection for Transaction Redeemers (crawler-fed, Ogmios chain-sync)'
129
+ entity TransactionRedeemers as projection on db.TransactionRedeemers;
130
+
131
+ @readonly
132
+ @title : 'Transaction Datums'
133
+ @description: 'Projection for Transaction Datums (crawler-fed, Ogmios chain-sync): witness-set datums byte for byte'
134
+ entity TransactionDatums as projection on db.TransactionDatums;
135
+
136
+ @readonly
137
+ @title : 'Ledger UTxOs'
138
+ @description: 'Crawler-maintained UTxO set (crawler.utxoSet); unspent while spentTxHash is null'
139
+ entity LedgerUTxOs as projection on db.LedgerUTxOs;
140
+
141
+ @readonly
142
+ @title : 'Ledger UTxO Assets'
143
+ @description: 'Native assets of a LedgerUTxOs row'
144
+ entity LedgerUTxOAssets as projection on db.LedgerUTxOAssets;
145
+
146
+ @readonly
147
+ @title : 'Ledger Addresses'
148
+ @description: 'Per-address balances from the crawler-maintained UTxO set (crawler.utxoSet)'
149
+ entity LedgerAddresses as projection on db.LedgerAddresses;
150
+
151
+ @readonly
152
+ @title : 'Ledger Address Assets'
153
+ @description: 'Native-asset balances per address (crawler.utxoSet)'
154
+ entity LedgerAddressAssets as projection on db.LedgerAddressAssets;
155
+
156
+ @readonly
157
+ @title : 'Ledger Accounts'
158
+ @description: 'Per-stake-key balances from the crawler-maintained UTxO set (crawler.utxoSet)'
159
+ entity LedgerAccounts as projection on db.LedgerAccounts;
160
+
161
+ @readonly
162
+ @title : 'Accounts'
163
+ @description: 'Projection for Accounts'
164
+ entity Accounts as projection on db.Accounts;
165
+
166
+ @readonly
167
+ @title : 'Addresses'
168
+ @description: 'Projection for Addresses'
169
+ entity Addresses as projection on db.Addresses;
170
+
171
+ @readonly
172
+ @title : 'Address Assets'
173
+ @description: 'Projection for Address Assets'
174
+ entity AddressAssets as projection on db.AddressAssets;
175
+
176
+ @readonly
177
+ @title : 'Address UTxOs'
178
+ @description: 'Projection for Address UTxOs'
179
+ entity AddressUTxOs as projection on db.AddressUTxOs;
180
+
181
+ @readonly
182
+ @title : 'Address Transactions'
183
+ @description: 'Projection for Address Transactions'
184
+ entity AddressTransactions as projection on db.AddressTransactions;
185
+
186
+ @readonly
187
+ @title : 'UTxO Assets'
188
+ @description: 'Projection for UTxO Assets'
189
+ entity UTxOAssets as projection on db.UTxOAssets;
190
+
191
+ @readonly
192
+ @title : 'Transaction Metadata'
193
+ @description: 'Projection for Transaction Metadata'
194
+ entity TransactionMetadata as projection on db.TransactionMetadata;
195
+
196
+ @readonly
197
+ @title : 'Ledger Protocol Parameters'
198
+ @description: 'Projection for Ledger Protocol Parameters'
199
+ entity LedgerProtocolParameters as projection on db.LedgerProtocolParameters;
200
+
201
+ // ---------------------------------------------------------------------------
202
+ // Actions
203
+ // ---------------------------------------------------------------------------
204
+ @title : 'Get Network Information'
205
+ @description: 'Retrieve current network information including network type and genesis hash'
206
+ action GetNetworkInformation() returns NetworkInformation;
207
+
208
+ @title : 'Get Blocks by Block Hash'
209
+ @description: 'Retrieve block information using the Block Hash'
210
+ action GetBlockByHash(
211
+ @title: 'Block Hash'
212
+ @description: 'The unique identifier of the block'
213
+ hash: Blake2b256) returns Blocks;
214
+
215
+ @title : 'Get Epochs by Epoch Number'
216
+ @description: 'Retrieve epoch information using the Epoch Number'
217
+ action GetEpochByNumber(
218
+ @title: 'Epoch Number'
219
+ @description: 'The sequential number of the epoch'
220
+ epochNumber: Integer) returns Epochs;
221
+
222
+ @title : 'Get Pools by Pool Id'
223
+ @description: 'Retrieve pool information using the Pool Id'
224
+ action GetPoolById(
225
+ @title: 'Pool Id'
226
+ @description: 'The unique identifier of the stake pool'
227
+ poolId: String) returns Pools;
228
+
229
+ @title : 'Get Dreps by Drep Id'
230
+ @description: 'Retrieve drep information using the Drep Id'
231
+ action GetDrepById(
232
+ @title: 'Drep Id'
233
+ @description: 'The unique identifier of the drep'
234
+ drepId: String) returns Dreps;
235
+
236
+ @title : 'Get Asset Info'
237
+ @description: 'Retrieve native-asset information (supply, mint history, CIP-25 + CIP-26 metadata) by unit. Multi-backend (Blockfrost, Koios). Field availability differs slightly per backend — see entity description.'
238
+ action GetAssetInfo(
239
+ @title: 'Asset Unit'
240
+ @description: 'Concatenation of policyId (56 hex) and assetNameHex (0-64 hex; ledger caps asset names at 32 bytes)'
241
+ unit: AssetUnit) returns Assets;
242
+
243
+ @title : 'Get Asset Mint/Burn History'
244
+ @description: 'Retrieve recent mint/burn events for a native asset (most recent first). Koios is preferred (provides block timestamps); Blockfrost is the fallback (timestamps null). Always-fresh fetch — UPSERTs entries by (unit, txHash). For full pagination, query the AssetHistory entity directly with $top/$skip after seeding.'
245
+ action GetAssetHistory(
246
+ @title: 'Asset Unit'
247
+ @description: 'Concatenation of policyId (56 hex) and assetNameHex (0-64 hex; ledger caps asset names at 32 bytes)'
248
+ unit: AssetUnit,
249
+ @title: 'Limit'
250
+ @description: 'Maximum number of recent events to fetch (default 100, clamped to 1-100)'
251
+ limit: Integer) returns many AssetHistory;
252
+
253
+ @title : 'Get Accounts by Stake Address'
254
+ @description: 'Retrieve account information using the Bech32 Stake Address'
255
+ action GetAccountByStakeAddress(
256
+ @title: 'Stake Address'
257
+ @description: 'The Bech32 encoded stake address'
258
+ stakeAddress: Bech32) returns Accounts;
259
+
260
+ @title : 'Get Transactions by Tx Hash'
261
+ @description: 'Retrieve transaction information using the Transaction Hash'
262
+ action GetTransactionByHash(
263
+ @title: 'Transaction Hash'
264
+ @description: 'The unique identifier of the transaction'
265
+ hash: Blake2b256) returns Transactions;
266
+
267
+ @title : 'Get Transaction Confirmations'
268
+ @description: 'Number of blocks on top of a transaction, its own block included; 0 while it is not on chain. Uses the crawled chain when the crawler is synced, else the backends.'
269
+ action GetTransactionConfirmations(
270
+ @title: 'Transaction Hash'
271
+ @description: 'The unique identifier of the transaction'
272
+ txHash: Blake2b256) returns TransactionConfirmations;
273
+
274
+ @title : 'Get Transaction Metadata by Tx Hash'
275
+ @description: 'Retrieve transaction metadata using the Transaction Hash'
276
+ action GetMetadataByTxHash(
277
+ @title: 'Transaction Hash'
278
+ @description: 'The unique identifier of the transaction'
279
+ txHash: Blake2b256) returns many TransactionMetadata;
280
+
281
+ @title : 'Get Addresses by Bech32 Address'
282
+ @description: 'Retrieve address information using the Bech32 Address'
283
+ action GetAddressByBech32(
284
+ @title: 'Bech32 Address'
285
+ @description: 'The Bech32 encoded address'
286
+ address: Bech32) returns Addresses;
287
+
288
+ @title : 'Get UTxOs by Bech32 Address'
289
+ @description: 'Retrieve UTxO information using the Bech32 Address'
290
+ action GetUTxOsByAddress(
291
+ @title: 'Bech32 Address'
292
+ @description: 'The Bech32 encoded address'
293
+ address: Bech32) returns many AddressUTxOs;
294
+
295
+ @title : 'Get UTxOs by Payment Credential'
296
+ @description: 'Retrieve UTxOs across all bech32 addresses sharing the given 28-byte payment credential (key hash or script hash). Useful for protocols that write to multiple bech32 forms of the same script (e.g. Indigo CDPs, Liqwid positions). Served from the crawled UTxO set (crawler.utxoSet active and synced) with outputs read from the node at the tip, else from Koios; throws ProviderUnavailableError when neither is available. Always fresh, no cache check.'
297
+ action GetUTxOsByCredential(
298
+ @title: 'Payment Credential'
299
+ @description: '28-byte payment credential hash as 56-char lowercase hex string'
300
+ credential: String) returns many AddressUTxOs;
301
+
302
+ @title : 'Get Assets by Bech32 Address'
303
+ @description: 'Retrieve asset information using the Bech32 Address'
304
+ action GetAssetsByAddress(
305
+ @title: 'Bech32 Address'
306
+ @description: 'The Bech32 encoded address'
307
+ address: Bech32) returns many AddressAssets;
308
+
309
+ @title : 'Get latest Transactions by Bech32 Address'
310
+ @description: 'Retrieve the latest transactions from the Bech32 Address'
311
+ action GetLatestTransactionsByAddress(
312
+ @title: 'Bech32 Address'
313
+ @description: 'The Bech32 encoded address'
314
+ address: Bech32,
315
+ @title: 'Limit'
316
+ @description: 'The maximum number of transactions to retrieve'
317
+ limit: Integer) returns many AddressTransactions;
318
+
319
+ @title : 'Get Latest Block'
320
+ @description: 'Retrieve the latest block information'
321
+ action GetLatestBlock() returns Blocks;
322
+
323
+ @title : 'Get Latest Epoch'
324
+ @description: 'Retrieve the latest epoch information'
325
+ action GetLatestEpoch() returns Epochs;
326
+
327
+ @title : 'Get Ledger Protocol Parameters'
328
+ @description: 'Retrieve the current ledger protocol parameters'
329
+ action GetLedgerProtocolParameters() returns LedgerProtocolParameters;
330
+
331
+ @title : 'Parse Transaction CBOR'
332
+ @description: 'Parse hex-encoded transaction CBOR (signed or unsigned) into structured fields. Pure function, no network call, no DB write.'
333
+ action ParseTransactionCbor(
334
+ @title: 'Transaction CBOR'
335
+ @description: 'Hex-encoded transaction CBOR; signed or unsigned. Capped at 128 KiB of hex.'
336
+ cbor: LargeString) returns ParsedTransaction;
337
+
338
+ @title : 'Decode Plutus Data'
339
+ @description: 'Decode PlutusData CBOR hex (an inline datum, a witness datum, a redeemer) into the JSON the build actions accept as outputDatumJson (DetailedSchema: constructor/fields, int, bytes, list, map). Integers beyond 2^53 are decimal strings. Pure function, no network call, no DB write.'
340
+ action DecodePlutusData(
341
+ @title: 'PlutusData CBOR'
342
+ @description: 'Hex-encoded PlutusData CBOR. Capped at 128 KiB of hex.'
343
+ cbor: LargeString) returns LargeString;
344
+ }