@odatano/core 2.0.0-rc.50 → 2.0.0-rc.52

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 (151) hide show
  1. package/@cds-models/CardanoBackendService/index.d.ts +14 -3
  2. package/@cds-models/CardanoBackendService/index.js +1 -0
  3. package/@cds-models/CardanoIndexerService/index.d.ts +98 -0
  4. package/@cds-models/CardanoIndexerService/index.js +10 -0
  5. package/@cds-models/CardanoODataService/index.d.ts +3 -0
  6. package/@cds-models/CardanoSignService/index.d.ts +13 -0
  7. package/@cds-models/CardanoSignService/index.js +1 -0
  8. package/@cds-models/CardanoTransactionService/index.d.ts +12 -0
  9. package/@cds-models/CardanoTransactionService/index.js +1 -0
  10. package/@cds-models/CardanoWorkerService/index.d.ts +28 -0
  11. package/@cds-models/CardanoWorkerService/index.js +2 -0
  12. package/@cds-models/index.d.ts +13 -3
  13. package/@cds-models/index.js +4 -3
  14. package/@cds-models/odatano/cardano/index.d.ts +14 -0
  15. package/README.md +45 -149
  16. package/db/schema.cds +63 -10
  17. package/db/types.cds +10 -0
  18. package/package.json +7 -44
  19. package/scripts/deploy-schema.mjs +113 -0
  20. package/scripts/migrate-schema.mjs +209 -15
  21. package/srv/blockchain/backends/blockfrost-backend.d.ts +2 -4
  22. package/srv/blockchain/backends/blockfrost-backend.js +61 -45
  23. package/srv/blockchain/backends/call-signal.d.ts +7 -0
  24. package/srv/blockchain/backends/call-signal.js +22 -0
  25. package/srv/blockchain/backends/cardano-backend.d.ts +6 -3
  26. package/srv/blockchain/backends/koios-backend.d.ts +9 -6
  27. package/srv/blockchain/backends/koios-backend.js +145 -207
  28. package/srv/blockchain/backends/odatano-backend.d.ts +2 -1
  29. package/srv/blockchain/backends/odatano-backend.js +51 -9
  30. package/srv/blockchain/backends/ogmios-backend.d.ts +1 -2
  31. package/srv/blockchain/backends/ogmios-backend.js +82 -48
  32. package/srv/blockchain/cardano-client.d.ts +15 -5
  33. package/srv/blockchain/cardano-client.js +143 -71
  34. package/srv/blockchain/cardano-indexer.d.ts +27 -16
  35. package/srv/blockchain/cardano-indexer.js +223 -102
  36. package/srv/blockchain/circuit-breaker.d.ts +1 -0
  37. package/srv/blockchain/circuit-breaker.js +6 -0
  38. package/srv/blockchain/crawler/account-snapshots.js +22 -2
  39. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +2 -0
  40. package/srv/blockchain/crawler/asset-decimals-backfill.js +29 -29
  41. package/srv/blockchain/crawler/asset-registry-backfill.d.ts +3 -0
  42. package/srv/blockchain/crawler/asset-registry-backfill.js +4 -0
  43. package/srv/blockchain/crawler/asset-slice-backfill.d.ts +35 -0
  44. package/srv/blockchain/crawler/asset-slice-backfill.js +149 -0
  45. package/srv/blockchain/crawler/certificate-backfill.d.ts +4 -0
  46. package/srv/blockchain/crawler/certificate-backfill.js +15 -3
  47. package/srv/blockchain/crawler/crawler.d.ts +22 -1
  48. package/srv/blockchain/crawler/crawler.js +223 -24
  49. package/srv/blockchain/crawler/credential-backfill.d.ts +2 -0
  50. package/srv/blockchain/crawler/credential-backfill.js +43 -66
  51. package/srv/blockchain/crawler/input-asset-copies.d.ts +4 -4
  52. package/srv/blockchain/crawler/input-asset-copies.js +17 -27
  53. package/srv/blockchain/crawler/key-pages.d.ts +12 -0
  54. package/srv/blockchain/crawler/key-pages.js +48 -0
  55. package/srv/blockchain/crawler/metadata-position-backfill.d.ts +6 -0
  56. package/srv/blockchain/crawler/metadata-position-backfill.js +23 -19
  57. package/srv/blockchain/crawler/output-datum-backfill.d.ts +3 -1
  58. package/srv/blockchain/crawler/output-datum-backfill.js +8 -18
  59. package/srv/blockchain/crawler/sync-state.d.ts +5 -1
  60. package/srv/blockchain/crawler/sync-state.js +63 -106
  61. package/srv/blockchain/crawler/transaction-backfill.d.ts +2 -0
  62. package/srv/blockchain/crawler/transaction-backfill.js +6 -13
  63. package/srv/blockchain/crawler/utxo-set-import.js +2 -2
  64. package/srv/blockchain/crawler/window-plan.d.ts +31 -0
  65. package/srv/blockchain/crawler/window-plan.js +59 -0
  66. package/srv/blockchain/ledger-state.d.ts +2 -2
  67. package/srv/blockchain/ledger-state.js +139 -37
  68. package/srv/blockchain/signing/external-signer.js +5 -5
  69. package/srv/blockchain/signing/failed-recheck.d.ts +17 -0
  70. package/srv/blockchain/signing/failed-recheck.js +135 -0
  71. package/srv/blockchain/signing/landing-proof.d.ts +60 -0
  72. package/srv/blockchain/signing/landing-proof.js +224 -0
  73. package/srv/blockchain/signing/signature-verifier.js +10 -13
  74. package/srv/blockchain/signing/submission-finalizer.d.ts +17 -3
  75. package/srv/blockchain/signing/submission-finalizer.js +90 -29
  76. package/srv/blockchain/stored-chain.d.ts +1 -2
  77. package/srv/blockchain/stored-chain.js +36 -15
  78. package/srv/blockchain/transaction-building/buildooor-tx.js +16 -10
  79. package/srv/blockchain/transaction-presence.d.ts +8 -1
  80. package/srv/blockchain/transaction-presence.js +12 -12
  81. package/srv/blockchain/wallet-worker/build-request.d.ts +6 -6
  82. package/srv/blockchain/wallet-worker/build-request.js +35 -365
  83. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +23 -2
  84. package/srv/blockchain/wallet-worker/confirmation-tracker.js +140 -23
  85. package/srv/blockchain/wallet-worker/invalidation.d.ts +35 -0
  86. package/srv/blockchain/wallet-worker/invalidation.js +128 -0
  87. package/srv/blockchain/wallet-worker/job-store.d.ts +28 -2
  88. package/srv/blockchain/wallet-worker/job-store.js +107 -80
  89. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +21 -2
  90. package/srv/blockchain/wallet-worker/wallet-worker.js +241 -57
  91. package/srv/cardano-agent-service.cds +1 -1
  92. package/srv/cardano-agent-service.js +8 -0
  93. package/srv/cardano-backend-service.cds +4 -1
  94. package/srv/cardano-backend-service.js +26 -9
  95. package/srv/cardano-indexer-service.cds +448 -387
  96. package/srv/cardano-indexer-service.js +226 -281
  97. package/srv/cardano-service.cds +7 -5
  98. package/srv/cardano-service.js +404 -69
  99. package/srv/cardano-sign-service.cds +11 -1
  100. package/srv/cardano-sign-service.js +161 -108
  101. package/srv/cardano-tx-service.cds +23 -12
  102. package/srv/cardano-tx-service.js +105 -604
  103. package/srv/cardano-worker-service.cds +25 -2
  104. package/srv/cardano-worker-service.js +56 -4
  105. package/srv/config.d.ts +4 -0
  106. package/srv/config.js +10 -0
  107. package/srv/server.js +5 -7
  108. package/srv/utils/agent-access.d.ts +4 -2
  109. package/srv/utils/agent-access.js +26 -7
  110. package/srv/utils/agent-grants.d.ts +1 -1
  111. package/srv/utils/agent-grants.js +7 -8
  112. package/srv/utils/agent-token-auth.js +45 -5
  113. package/srv/utils/build-request.d.ts +52 -0
  114. package/srv/utils/build-request.js +487 -0
  115. package/srv/utils/collections.d.ts +1 -0
  116. package/srv/utils/collections.js +11 -0
  117. package/srv/utils/const.d.ts +10 -2
  118. package/srv/utils/const.js +13 -6
  119. package/srv/utils/crypto.js +5 -4
  120. package/srv/utils/db-indexes.d.ts +5 -1
  121. package/srv/utils/db-indexes.js +79 -14
  122. package/srv/utils/db-kind.d.ts +23 -0
  123. package/srv/utils/db-kind.js +42 -0
  124. package/srv/utils/detached-run.d.ts +41 -0
  125. package/srv/utils/detached-run.js +101 -0
  126. package/srv/utils/epoch-slots.d.ts +1 -0
  127. package/srv/utils/epoch-slots.js +7 -0
  128. package/srv/utils/error-codes.d.ts +4 -0
  129. package/srv/utils/error-codes.js +4 -0
  130. package/srv/utils/errors.d.ts +10 -1
  131. package/srv/utils/errors.js +51 -9
  132. package/srv/utils/lease.d.ts +20 -0
  133. package/srv/utils/lease.js +62 -0
  134. package/srv/utils/mappers.d.ts +9 -0
  135. package/srv/utils/mappers.js +57 -67
  136. package/srv/utils/navigation.d.ts +17 -0
  137. package/srv/utils/navigation.js +52 -0
  138. package/srv/utils/network-context.d.ts +0 -1
  139. package/srv/utils/network-context.js +8 -3
  140. package/srv/utils/pg-inline-json.js +3 -3
  141. package/srv/utils/pg-order-nulls.js +3 -3
  142. package/srv/utils/resolution.d.ts +13 -0
  143. package/srv/utils/resolution.js +47 -0
  144. package/srv/utils/row-values.d.ts +7 -0
  145. package/srv/utils/row-values.js +27 -0
  146. package/srv/utils/tx-build-helper.d.ts +15 -0
  147. package/srv/utils/tx-build-helper.js +28 -13
  148. package/srv/utils/types.d.ts +36 -44
  149. package/srv/utils/types.js +1 -17
  150. package/srv/utils/validators.d.ts +2 -2
  151. package/srv/utils/validators.js +14 -25
@@ -1,387 +1,448 @@
1
- using { UtxoSetImportSource, AssetRegistrySource } from '../db/types';
2
- using {odatano.cardano as db} from '../db/schema';
3
-
4
- // Crawler control and status. The service itself is 'any': CAP checks the service before the
5
- // operation, so anything stricter would 401 the anonymous probes. Each element carries its own requirement.
6
- @requires: 'any'
7
- service CardanoIndexerService @(impl: './cardano-indexer-service') {
8
-
9
- @readonly
10
- @requires : 'Read'
11
- @title : 'Sync State'
12
- @description: 'Singleton crawl cursor: pre-sync progress, tip lag, status, errors'
13
- entity SyncState as projection on db.CardanoSyncState;
14
-
15
- @readonly
16
- @requires : 'Read'
17
- @title : 'Reorg Log'
18
- @description: 'Audit trail of chain rollbacks handled by the crawler'
19
- entity ReorgLog as projection on db.CardanoReorgLog;
20
-
21
- @title : 'Crawler Status'
22
- @description: 'Live crawler status summary (numeric fields as strings, CAP-10 aligned)'
23
- type CrawlerStatus {
24
- running : Boolean;
25
- syncStatus : String;
26
- // chain-sync or pagination for the crawler in this process, null when another instance crawls.
27
- // Pagination is about 50x slower but still advances the cursor, so only this field shows it.
28
- source : String;
29
- lastSlot : String;
30
- lastHeight : String;
31
- tipHeight : String;
32
- syncProgress : String;
33
- consecutiveErrors : Integer;
34
- lastIndexedAt : Timestamp; // when the last block was committed
35
- // true: the crawler holds its lease but committed no block for 10 minutes
36
- stalled : Boolean;
37
- // crawler-fed ledger state (crawler.utxoSet): snapshot anchor + validity
38
- utxoSet : UtxoSetStatus;
39
- // one-off certificate/withdrawal backfill over already crawled blocks (this process)
40
- certificateBackfill : CertificateBackfillStatus;
41
- // one-off input/redeemer/datum backfill over already crawled blocks (this process)
42
- transactionBackfill : TransactionBackfillStatus;
43
- // one-off payment-credential fill of UTxO-shaped rows (this process)
44
- credentialBackfill : CredentialBackfillStatus;
45
- // one-off CIP-68 decimals fill of the asset catalogue (this process)
46
- decimalsBackfill : DecimalsBackfillStatus;
47
- // one-off CIP-26 registry fill of the asset catalogue (this process)
48
- registryBackfill : RegistryBackfillStatus;
49
- // one-off repair of output datums (this process)
50
- datumBackfill : DatumBackfillStatus;
51
- // one-off chain-position fill of metadata rows (this process)
52
- metadataBackfill : MetadataBackfillStatus;
53
- // rebuild of epoch rows from the crawled blocks (this process)
54
- epochBackfill : EpochBackfillStatus;
55
- // walk that moves inputs from asset copies to their output (this process)
56
- copyPrune : InputCopyPruneStatus;
57
- // walk that moves inputs back to asset copies (this process)
58
- copyRestore : InputCopyRestoreStatus;
59
- // per-epoch pool/DRep/pot snapshots (crawler.epochSnapshots)
60
- epochSnapshots : EpochSnapshotStatus;
61
- }
62
-
63
- @title : 'Epoch Snapshot Status'
64
- @description: 'Latest epoch snapshot and the source this process would use for the next one'
65
- type EpochSnapshotStatus {
66
- enabled : Boolean; // crawler.epochSnapshots configured
67
- source : String; // ogmios | koios | null (no usable backend)
68
- lastEpoch : Integer; // newest snapshotted epoch; null before the first
69
- lastSource: String; // source of that snapshot
70
- lastSlot : String; // block it was taken at
71
- accounts : Boolean; // crawler.accountSnapshots configured
72
- lastAccountEpoch : Integer; // newest epoch with an account snapshot; null before the first
73
- lastAccountCount : Integer; // accounts in that snapshot
74
- }
75
-
76
- @title : 'Certificate Backfill Status'
77
- @description: 'Progress of the certificate/withdrawal backfill started with backfillCertificates; process-local, none after a restart'
78
- type CertificateBackfillStatus {
79
- status : String; // none | running | done | failed
80
- fromSlot : String;
81
- toSlot : String;
82
- atSlot : String; // last slot handled
83
- blocks : Integer64;
84
- certificates : Integer64;
85
- withdrawals : Integer64;
86
- removed : Integer64; // stored rows removed for transactions whose script phase failed
87
- startedAt : Timestamp;
88
- finishedAt : Timestamp;
89
- error : String;
90
- }
91
-
92
- @title : 'Transaction Backfill Status'
93
- @description: 'Progress of the backfill started with backfillTransactions; process-local, none after a restart'
94
- type TransactionBackfillStatus {
95
- status : String; // none | running | done | failed
96
- fromSlot : String;
97
- toSlot : String;
98
- atSlot : String; // last slot handled
99
- blocks : Integer64;
100
- transactions : Integer64;
101
- inputs : Integer64; // input rows that got at least one field
102
- outputs : Integer64; // output rows that got a datum or reference-script field
103
- redeemers : Integer64;
104
- datums : Integer64;
105
- rewritten : Integer64; // transactions whose stored rows differed in order or extent from the ledger view, now rewritten
106
- skipped : Integer64; // transactions whose stored inputs differ from the stream
107
- startedAt : Timestamp;
108
- finishedAt : Timestamp;
109
- error : String;
110
- }
111
-
112
- @title : 'Credential Backfill Status'
113
- @description: 'Progress of the payment-credential fill started with backfillPaymentCredentials; process-local, none after a restart'
114
- type CredentialBackfillStatus {
115
- status : String; // none | running | done | failed
116
- table : String; // table being walked: TransactionOutputs | TransactionInputs | LedgerUTxOs; null when finished
117
- outputs : Integer64; // rows that received a credential
118
- inputs : Integer64;
119
- ledgerUtxos : Integer64;
120
- startedAt : Timestamp;
121
- finishedAt : Timestamp;
122
- error : String;
123
- }
124
-
125
- @title : 'Decimals Backfill Status'
126
- @description: 'Progress of the CIP-68 decimals fill started with backfillAssetDecimals; process-local, none after a restart'
127
- type DecimalsBackfillStatus {
128
- status : String; // none | running | done | failed
129
- scanned : Integer64; // catalogue rows read
130
- candidates : Integer64; // units with label 333 or 444
131
- filled : Integer64; // units that received a decimals value
132
- startedAt : Timestamp;
133
- finishedAt : Timestamp;
134
- error : String;
135
- }
136
-
137
- @title : 'Registry Backfill Status'
138
- @description: 'Progress of the CIP-26 registry fill started with backfillAssetRegistry; process-local, none after a restart'
139
- type RegistryBackfillStatus {
140
- status : String; // none | running | done | failed
141
- units : Integer64; // units with a registry entry
142
- processed : Integer64; // units handled so far
143
- filled : Integer64; // units whose rows received the registry values
144
- failed : Integer64; // units the backend did not resolve, or entry files that could not be read
145
- absent : Integer64; // source file: registry units without an Assets row
146
- skipped : Integer64; // source file: entries that describe no native asset
147
- startedAt : Timestamp;
148
- finishedAt : Timestamp;
149
- error : String;
150
- }
151
-
152
- @title : 'Datum Backfill Status'
153
- @description: 'Progress of the output datum repair started with backfillOutputDatums; process-local, none after a restart'
154
- type DatumBackfillStatus {
155
- status : String; // none | running | done | failed
156
- scanned : Integer64; // stored outputs read
157
- candidates : Integer64; // outputs with a datum hash and no inline datum
158
- transactions : Integer64; // transactions read again from the backend
159
- missing : Integer64; // candidate transactions the backend did not return
160
- outputs : Integer64; // output rows that got a field
161
- inputs : Integer64; // input rows that spent such an output and got the field
162
- ledgerUtxos : Integer64; // UTxO set rows that got the field
163
- startedAt : Timestamp;
164
- finishedAt : Timestamp;
165
- error : String;
166
- }
167
-
168
- @title : 'Epoch Backfill Status'
169
- @description: 'Progress of the walk started with backfillEpochs; process-local, none after a restart'
170
- type EpochBackfillStatus {
171
- status : String; // none | running | done | failed
172
- atEpoch : Integer; // epoch the walk has reached
173
- toEpoch : Integer; // epoch of the crawler cursor
174
- updated : Integer; // rows whose totals were written
175
- created : Integer; // rows that did not exist
176
- startedAt : Timestamp;
177
- finishedAt : Timestamp;
178
- error : String;
179
- }
180
-
181
- @title : 'Input Copy Prune Status'
182
- @description: 'Progress of the walk started with pruneInputAssetCopies; process-local, none after a restart'
183
- type InputCopyPruneStatus {
184
- status : String; // none | running | done | failed
185
- atSlot : String; // slot the walk has reached
186
- toSlot : String; // last slot of the walk
187
- referenced : Integer64; // inputs that read from their output now
188
- kept : Integer64; // inputs of the walked slots left without a reference
189
- deleted : Integer64; // copy rows deleted
190
- startedAt : Timestamp;
191
- finishedAt : Timestamp;
192
- error : String;
193
- }
194
-
195
- @title : 'Input Copy Restore Status'
196
- @description: 'Progress of the walk started with restoreInputAssetCopies; process-local, none after a restart'
197
- type InputCopyRestoreStatus {
198
- status : String; // none | running | done | failed
199
- atSlot : String; // slot the walk has reached
200
- toSlot : String; // last slot of the walk
201
- restored : Integer64; // inputs that read from a copy again
202
- rows : Integer64; // copy rows written
203
- startedAt : Timestamp;
204
- finishedAt : Timestamp;
205
- error : String;
206
- }
207
-
208
- @title : 'Metadata Backfill Status'
209
- @description: 'Progress of the chain-position fill started with backfillMetadataPositions; process-local, none after a restart'
210
- type MetadataBackfillStatus {
211
- status : String; // none | running | done | failed
212
- atSlot : String; // slot the walk has reached
213
- toSlot : String; // last slot that holds a stored transaction
214
- rows : Integer64; // metadata rows that received their position
215
- startedAt : Timestamp;
216
- finishedAt : Timestamp;
217
- error : String;
218
- }
219
-
220
- @title : 'Backfill Result'
221
- type BackfillResult {
222
- accepted : Boolean;
223
- message : String;
224
- }
225
-
226
- @title : 'Certificate Backfill Result'
227
- type CertificateBackfillResult {
228
- accepted : Boolean;
229
- fromSlot : String;
230
- toSlot : String;
231
- message : String;
232
- }
233
-
234
- @title : 'UTxO Set Status'
235
- @description: 'State of the crawler-maintained UTxO set (crawler.utxoSet)'
236
- type UtxoSetStatus {
237
- enabled : Boolean; // crawler.utxoSet configured
238
- status : String; // none | importing | active | invalid
239
- anchorSlot : String; // null until imported
240
- anchorHash : String;
241
- importedAt : Timestamp;
242
- error : String; // why invalid
243
- }
244
-
245
- @title : 'UTxO Set Import Result'
246
- type UtxoSetImportResult {
247
- accepted : Boolean;
248
- anchorSlot : String;
249
- anchorHash : String;
250
- message : String;
251
- }
252
-
253
- @title : 'Get Crawler Status'
254
- @description: 'Return the current crawler run state and sync progress'
255
- /** Emitted after each block is committed. In plugin mode subscribing needs no messaging service. */
256
- event blockIndexed {
257
- hash : String(64);
258
- slot : Integer64;
259
- height : Integer64;
260
- txHashes : many String(64);
261
- tipSlot : Integer64;
262
- tipHeight: Integer64;
263
- }
264
-
265
- /** Emitted AFTER a rollback is committed. Everything above `forkSlot` was removed. */
266
- event reorg {
267
- forkSlot : Integer64;
268
- forkHeight : Integer64;
269
- blocksRolledBack : Integer;
270
- }
271
-
272
- @requires : 'Read'
273
- @odatano.agent: 'read'
274
- function getStatus() returns CrawlerStatus;
275
-
276
- @title : 'Liveness'
277
- type Liveness {
278
- status : String; // 'alive'
279
- timestamp : Timestamp;
280
- uptime : Integer; // seconds since process start
281
- version : String; // @odatano/core version
282
- network : String; // configured network
283
- }
284
-
285
- // Anonymous on purpose, since a liveness probe carries no credentials.
286
- // It probes no backend or DB and reveals no secrets.
287
- @title : 'Get Liveness'
288
- @description: 'Unauthenticated liveness probe: 200 while the process answers. The Docker HEALTHCHECK uses this.'
289
- @requires : 'any'
290
- @odatano.agent: 'read'
291
- function getLiveness() returns Liveness;
292
-
293
- @title : 'Readiness'
294
- type Readiness {
295
- status : String; // 'ready' | 'not_ready'
296
- timestamp : Timestamp;
297
- context : Boolean; // client, indexer and transaction builder exist
298
- database : Boolean; // the database answers and holds the schema
299
- hsm : Boolean; // null = no HSM configured; the HSM session is connected
300
- }
301
-
302
- // Anonymous like getLiveness. The body names the missing part and no configuration detail.
303
- @title : 'Get Readiness'
304
- @description: 'Unauthenticated readiness probe: 200 when this instance can serve requests, 503 with the same body while the app context, the database or a configured HSM is missing. Load balancers and upstream gateways use this to decide whether to route requests here.'
305
- @requires : 'any'
306
- @odatano.agent: 'read'
307
- function getReadiness() returns Readiness;
308
-
309
- @title : 'Pause Crawler'
310
- @description: 'Stop the crawler (closes the chain-sync stream). Resume continues from the cursor.'
311
- @requires : 'Admin'
312
- @odatano.agent: 'operator'
313
- action pauseCrawler() returns Boolean;
314
-
315
- @title : 'Resume Crawler'
316
- @description: 'Start/restart the crawler from the persisted cursor using the configured source.'
317
- @requires : 'Admin'
318
- @odatano.agent: 'operator'
319
- action resumeCrawler() returns Boolean;
320
-
321
- @title : 'Import UTxO Set'
322
- @description: 'One-off import of the UTxO set that anchors crawler.utxoSet. Pause the crawler first. source=ogmios acquires the set at the crawler cursor (crawl must be at the tip); source=file loads a cardano-cli query utxo --whole-utxo dump (.json, or .ndjson from jq -c to_entries[]) taken at anchorSlot/anchorHash. source=aggregates rebuilds only the sums (LedgerAddresses, LedgerAddressAssets, LedgerAccounts) from the rows an earlier import left, e.g. after its aggregate phase failed; a cursor past the anchor is set back to it. source=scripts fills the reference-script columns (utxo_referenceScriptHash, utxo_referenceScriptSize, utxo_referenceScriptType) of rows an earlier import left empty: from the same dump (filePath), or without filePath from Ogmios for the unspent rows that hold a hash but no size; the set stays active. Runs in the background; progress via getStatus().utxoSet and the log.'
323
- @requires : 'Admin'
324
- @odatano.agent: 'operator'
325
- action importUtxoSet(@assert.range source: UtxoSetImportSource, filePath: String,
326
- @assert.range: [0, _] anchorSlot: Integer64, anchorHash: String) returns UtxoSetImportResult;
327
-
328
- @title : 'Backfill Certificates'
329
- @description: 'Fill TransactionCertificates and TransactionWithdrawals for blocks the crawl already holds, from a second chain-sync stream (Ogmios), and remove the rows stored for a transaction whose script phase failed. fromSlot defaults to the crawl start, toSlot to the cursor. Writes only those two tables; the crawler may keep running. Runs in the background; progress via getStatus().certificateBackfill.'
330
- @requires : 'Admin'
331
- @odatano.agent: 'operator'
332
- action backfillCertificates(@assert.range: [0, _] fromSlot: Integer64, @assert.range: [0, _] toSlot: Integer64) returns CertificateBackfillResult;
333
-
334
- @title : 'Backfill Transactions'
335
- @description: 'Complete transactions the crawl already holds from a second chain-sync stream (Ogmios): input outpoints, the spent output datum and reference-script hash, missing input addresses, empty datum and reference-script fields of stored outputs, TransactionRedeemers and TransactionDatums. Fills empty fields only; a transaction whose stored inputs differ from the stream is skipped. fromSlot defaults to the crawl start, toSlot to the cursor; the crawler may keep running. Runs in the background; progress via getStatus().transactionBackfill.'
336
- @requires : 'Admin'
337
- @odatano.agent: 'operator'
338
- action backfillTransactions(@assert.range: [0, _] fromSlot: Integer64, @assert.range: [0, _] toSlot: Integer64) returns CertificateBackfillResult;
339
-
340
- @title : 'Backfill Payment Credentials'
341
- @description: 'Fill utxo.paymentCredential on TransactionOutputs, TransactionInputs and LedgerUTxOs rows written before the column existed, decoded from the stored address. Walks each table once in key order; rows that carry a credential are left alone, so a second run is a no-op. No backend call; the crawler may keep running. Runs in the background; progress via getStatus().credentialBackfill.'
342
- @requires : 'Admin'
343
- @odatano.agent: 'operator'
344
- action backfillPaymentCredentials() returns BackfillResult;
345
-
346
- @title : 'Backfill Output Datums'
347
- @description: 'Repair stored outputs that hold a datum hash and no inline datum: their transactions are read again from a backend that serves transactions (Koios, Blockfrost or a remote ODATANO), and the inline datum and the reference-script fields it returns are written to the output, to the inputs that spent it and to its UTxO set row. Only empty fields change. An output whose datum is hash-only stays as it is and is read again on a repeat. With Ogmios as the only backend use backfillTransactions, which fills the same fields from the node. Runs in the background; progress via getStatus().datumBackfill.'
348
- @requires : 'Admin'
349
- @odatano.agent: 'operator'
350
- action backfillOutputDatums() returns BackfillResult;
351
-
352
- @title : 'Backfill Metadata Positions'
353
- @description: 'Write the chain position (txSeq) of its transaction to every TransactionMetadata row that lacks it, so GetMetadataByLabel returns rows stored before the column existed. Walks the stored transactions by slot window. No backend call; the crawler may keep running; a repeat changes nothing. Runs in the background; progress via getStatus().metadataBackfill.'
354
- @requires : 'Admin'
355
- @odatano.agent: 'operator'
356
- action backfillMetadataPositions() returns BackfillResult;
357
-
358
- @title : 'Backfill Epochs'
359
- @description: 'Write block count, transaction count, fees and the first and last block time of every epoch the crawl covers in full, from the stored blocks. An epoch that has no row gets one; output and active stake of an existing row stay. No backend. Runs detached; poll getStatus().epochBackfill. May be repeated.'
360
- @requires : 'Admin'
361
- @odatano.agent: 'operator'
362
- action backfillEpochs() returns BackfillResult;
363
-
364
- @title : 'Prune Input Asset Copies'
365
- @description: 'Move the transaction inputs between fromSlot and toSlot (slot of the spending transaction) from stored asset copies to the output they spent. An input moves only when that output is stored and holds exactly the assets of its copy; its copy is deleted and it reads from the output. Answers stay the same; a long range of inputs reads slower. Disk space is free once the copy table is rewritten. restoreInputAssetCopies undoes it. slotWindow: slots per transaction, default 20000. PostgreSQL and SQLite. Runs detached; poll getStatus().copyPrune.'
366
- @requires : 'Admin'
367
- @odatano.agent: 'operator'
368
- action pruneInputAssetCopies(@assert.range: [0, _] fromSlot: Integer64 not null, @assert.range: [0, _] toSlot: Integer64 not null, @assert.range: [1, 1000000] slotWindow: Integer) returns BackfillResult;
369
-
370
- @title : 'Restore Input Asset Copies'
371
- @description: 'Move the transaction inputs between fromSlot and toSlot (slot of the spending transaction) back to stored asset copies, written from the outputs they spent. slotWindow: slots per transaction, default 20000. PostgreSQL and SQLite. Runs detached; poll getStatus().copyRestore.'
372
- @requires : 'Admin'
373
- @odatano.agent: 'operator'
374
- action restoreInputAssetCopies(@assert.range: [0, _] fromSlot: Integer64 not null, @assert.range: [0, _] toSlot: Integer64 not null, @assert.range: [1, 1000000] slotWindow: Integer) returns BackfillResult;
375
-
376
- @title : 'Backfill Asset Decimals'
377
- @description: 'Fill Assets.decimals from the CIP-68 reference datum for every catalogue unit with label 333 or 444: the reference NFT is followed from its mint through the crawled transactions to the output that holds it now, and the decimals of that datum are written to every slice of the unit. No backend call; the crawler may keep running; a repeat refreshes the values. Runs in the background; progress via getStatus().decimalsBackfill.'
378
- @requires : 'Admin'
379
- @odatano.agent: 'operator'
380
- action backfillAssetDecimals() returns BackfillResult;
381
-
382
- @title : 'Backfill Asset Registry'
383
- @description: 'Fill the CIP-26 registry fields (registryName, registryTicker, registryDecimals, registryDescription, registryUrl, registryLogo) on every slice of every Assets unit the token registry lists, and decimals where it is still empty. source koios (default): each unit is read from the backend (needs Koios), rate limited. source file: path names a folder on the server with the entry files of the registry repository (mappings of cardano-token-registry, registry of metadata-registry-testnet); units without an Assets row are counted, not created; no backend. The crawler may keep running; a repeat refreshes the values. Runs in the background; progress via getStatus().registryBackfill.'
384
- @requires : 'Admin'
385
- @odatano.agent: 'operator'
386
- action backfillAssetRegistry(@assert.range source: AssetRegistrySource, path: String) returns BackfillResult;
387
- }
1
+ using { UtxoSetImportSource, AssetRegistrySource } from '../db/types';
2
+ using {odatano.cardano as db} from '../db/schema';
3
+
4
+ // Crawler control and status. The service itself is 'any': CAP checks the service before the
5
+ // operation, so anything stricter would 401 the anonymous probes. Each element carries its own requirement.
6
+ @requires: 'any'
7
+ service CardanoIndexerService @(impl: './cardano-indexer-service') {
8
+
9
+ @readonly
10
+ @requires : 'Read'
11
+ @title : 'Sync State'
12
+ @description: 'Singleton crawl cursor: pre-sync progress, tip lag, status, errors'
13
+ entity SyncState as projection on db.CardanoSyncState;
14
+
15
+ @readonly
16
+ @requires : 'Read'
17
+ @title : 'Reorg Log'
18
+ @description: 'Audit trail of chain rollbacks handled by the crawler'
19
+ entity ReorgLog as projection on db.CardanoReorgLog;
20
+
21
+ @title : 'Crawler Status'
22
+ @description: 'Live crawler status summary (numeric fields as strings, CAP-10 aligned)'
23
+ type CrawlerStatus {
24
+ running : Boolean;
25
+ syncStatus : String;
26
+ // chain-sync or pagination for the crawler in this process, null when another instance crawls.
27
+ // Pagination is about 50x slower but still advances the cursor, so only this field shows it.
28
+ source : String;
29
+ lastSlot : String;
30
+ lastHeight : String;
31
+ tipHeight : String;
32
+ syncProgress : String;
33
+ consecutiveErrors : Integer;
34
+ lastIndexedAt : Timestamp; // when the last block was committed
35
+ // true: the crawler holds its lease but committed no block for 10 minutes
36
+ stalled : Boolean;
37
+ // since when chain-sync waits for a node that is behind the cursor; null when it is not
38
+ nodeBehindSince : Timestamp;
39
+ // crawler-fed ledger state (crawler.utxoSet): snapshot anchor + validity
40
+ utxoSet : UtxoSetStatus;
41
+ // one-off certificate/withdrawal backfill over already crawled blocks (this process)
42
+ certificateBackfill : CertificateBackfillStatus;
43
+ // one-off input/redeemer/datum backfill over already crawled blocks (this process)
44
+ transactionBackfill : TransactionBackfillStatus;
45
+ // one-off payment-credential fill of UTxO-shaped rows (this process)
46
+ credentialBackfill : CredentialBackfillStatus;
47
+ // one-off CIP-68 decimals fill of the asset catalogue (this process)
48
+ decimalsBackfill : DecimalsBackfillStatus;
49
+ // one-off CIP-26 registry fill of the asset catalogue (this process)
50
+ registryBackfill : RegistryBackfillStatus;
51
+ // one-off repair of output datums (this process)
52
+ datumBackfill : DatumBackfillStatus;
53
+ // one-off chain-position fill of metadata rows (this process)
54
+ metadataBackfill : MetadataBackfillStatus;
55
+ // one-off fill of the derived columns of stored asset rows (this process)
56
+ sliceBackfill : AssetSliceBackfillStatus;
57
+ // rebuild of epoch rows from the crawled blocks (this process)
58
+ epochBackfill : EpochBackfillStatus;
59
+ // re-check of failed submissions and signing requests against the chain (this process)
60
+ failedRecheck : FailedRecheckStatus;
61
+ // walk that moves inputs from asset copies to their output (this process)
62
+ copyPrune : InputCopyPruneStatus;
63
+ // walk that moves inputs back to asset copies (this process)
64
+ copyRestore : InputCopyRestoreStatus;
65
+ // per-epoch pool/DRep/pot snapshots (crawler.epochSnapshots)
66
+ epochSnapshots : EpochSnapshotStatus;
67
+ }
68
+
69
+ @title : 'Epoch Snapshot Status'
70
+ @description: 'Latest epoch snapshot and the source this process would use for the next one'
71
+ type EpochSnapshotStatus {
72
+ enabled : Boolean; // crawler.epochSnapshots configured
73
+ source : String; // ogmios | koios | null (no usable backend)
74
+ lastEpoch : Integer; // newest snapshotted epoch; null before the first
75
+ lastSource: String; // source of that snapshot
76
+ lastSlot : String; // block it was taken at
77
+ accounts : Boolean; // crawler.accountSnapshots configured
78
+ lastAccountEpoch : Integer; // newest epoch with an account snapshot; null before the first
79
+ lastAccountCount : Integer; // accounts in that snapshot
80
+ }
81
+
82
+ @title : 'Certificate Backfill Status'
83
+ @description: 'Progress of the certificate/withdrawal backfill started with backfillCertificates; process-local, none after a restart'
84
+ type CertificateBackfillStatus {
85
+ status : String; // none | running | done | failed | cancelled
86
+ fromSlot : String;
87
+ toSlot : String;
88
+ atSlot : String; // last slot handled
89
+ blocks : Integer64;
90
+ transactions : Integer64;
91
+ certificates : Integer64;
92
+ withdrawals : Integer64;
93
+ removed : Integer64; // stored rows removed for transactions whose script phase failed
94
+ startedAt : Timestamp;
95
+ finishedAt : Timestamp;
96
+ error : String;
97
+ }
98
+
99
+ @title : 'Transaction Backfill Status'
100
+ @description: 'Progress of the backfill started with backfillTransactions; process-local, none after a restart'
101
+ type TransactionBackfillStatus {
102
+ status : String; // none | running | done | failed | cancelled
103
+ fromSlot : String;
104
+ toSlot : String;
105
+ atSlot : String; // last slot handled
106
+ blocks : Integer64;
107
+ transactions : Integer64;
108
+ inputs : Integer64; // input rows that got at least one field
109
+ outputs : Integer64; // output rows that got a datum or reference-script field
110
+ redeemers : Integer64;
111
+ datums : Integer64;
112
+ rewritten : Integer64; // transactions whose stored rows differed in order or extent from the ledger view, now rewritten
113
+ skipped : Integer64; // transactions whose stored inputs differ from the stream
114
+ startedAt : Timestamp;
115
+ finishedAt : Timestamp;
116
+ error : String;
117
+ }
118
+
119
+ @title : 'Credential Backfill Status'
120
+ @description: 'Progress of the payment-credential fill started with backfillPaymentCredentials; process-local, none after a restart'
121
+ type CredentialBackfillStatus {
122
+ status : String; // none | running | done | failed | cancelled
123
+ table : String; // table being walked: TransactionOutputs | TransactionInputs | LedgerUTxOs; null when finished
124
+ outputs : Integer64; // rows that received a credential
125
+ inputs : Integer64;
126
+ ledgerUtxos : Integer64;
127
+ startedAt : Timestamp;
128
+ finishedAt : Timestamp;
129
+ error : String;
130
+ }
131
+
132
+ @title : 'Decimals Backfill Status'
133
+ @description: 'Progress of the CIP-68 decimals fill started with backfillAssetDecimals; process-local, none after a restart'
134
+ type DecimalsBackfillStatus {
135
+ status : String; // none | running | done | failed | cancelled
136
+ scanned : Integer64; // catalogue rows read
137
+ candidates : Integer64; // units with label 333 or 444
138
+ filled : Integer64; // units that received a decimals value
139
+ startedAt : Timestamp;
140
+ finishedAt : Timestamp;
141
+ error : String;
142
+ }
143
+
144
+ @title : 'Registry Backfill Status'
145
+ @description: 'Progress of the CIP-26 registry fill started with backfillAssetRegistry; process-local, none after a restart'
146
+ type RegistryBackfillStatus {
147
+ status : String; // none | running | done | failed | cancelled
148
+ units : Integer64; // units with a registry entry
149
+ processed : Integer64; // units handled so far
150
+ filled : Integer64; // units whose rows received the registry values
151
+ failed : Integer64; // units the backend did not resolve, or entry files that could not be read
152
+ absent : Integer64; // source file: registry units without an Assets row
153
+ skipped : Integer64; // source file: entries that describe no native asset
154
+ startedAt : Timestamp;
155
+ finishedAt : Timestamp;
156
+ error : String;
157
+ }
158
+
159
+ @title : 'Datum Backfill Status'
160
+ @description: 'Progress of the output datum repair started with backfillOutputDatums; process-local, none after a restart'
161
+ type DatumBackfillStatus {
162
+ status : String; // none | running | done | failed | cancelled
163
+ scanned : Integer64; // stored outputs read
164
+ candidates : Integer64; // outputs with a datum hash and no inline datum
165
+ transactions : Integer64; // transactions read again from the backend
166
+ missing : Integer64; // candidate transactions the backend did not return
167
+ outputs : Integer64; // output rows that got a field
168
+ inputs : Integer64; // input rows that spent such an output and got the field
169
+ ledgerUtxos : Integer64; // UTxO set rows that got the field
170
+ startedAt : Timestamp;
171
+ finishedAt : Timestamp;
172
+ error : String;
173
+ }
174
+
175
+ @title : 'Epoch Backfill Status'
176
+ @description: 'Progress of the walk started with backfillEpochs; process-local, none after a restart'
177
+ type EpochBackfillStatus {
178
+ status : String; // none | running | done | failed | cancelled
179
+ atEpoch : Integer; // epoch the walk has reached
180
+ toEpoch : Integer; // epoch of the crawler cursor
181
+ updated : Integer; // rows whose totals were written
182
+ created : Integer; // rows that did not exist
183
+ startedAt : Timestamp;
184
+ finishedAt : Timestamp;
185
+ error : String;
186
+ }
187
+
188
+ @title : 'Failed Re-check Status'
189
+ @description: 'Progress of the run started with recheckFailedSubmits; process-local, none after a restart'
190
+ type FailedRecheckStatus {
191
+ status : String; // none | running | done | failed | cancelled
192
+ submissions : Integer; // failed submissions read
193
+ requests : Integer; // failed signing requests read
194
+ jobs : Integer; // wallet jobs failed as TX_DROPPED or SUBMIT_REJECTED read
195
+ restored : Integer; // rows found on chain with passing scripts and moved back to submitted
196
+ startedAt : Timestamp;
197
+ finishedAt : Timestamp;
198
+ error : String;
199
+ }
200
+
201
+ @title : 'Input Copy Prune Status'
202
+ @description: 'Progress of the walk started with pruneInputAssetCopies; process-local, none after a restart'
203
+ type InputCopyPruneStatus {
204
+ status : String; // none | running | done | failed | cancelled
205
+ atSlot : String; // slot the walk has reached
206
+ toSlot : String; // last slot of the walk
207
+ referenced : Integer64; // inputs that read from their output now
208
+ kept : Integer64; // inputs of the walked slots left without a reference
209
+ deleted : Integer64; // copy rows deleted
210
+ startedAt : Timestamp;
211
+ finishedAt : Timestamp;
212
+ error : String;
213
+ }
214
+
215
+ @title : 'Input Copy Restore Status'
216
+ @description: 'Progress of the walk started with restoreInputAssetCopies; process-local, none after a restart'
217
+ type InputCopyRestoreStatus {
218
+ status : String; // none | running | done | failed | cancelled
219
+ atSlot : String; // slot the walk has reached
220
+ toSlot : String; // last slot of the walk
221
+ restored : Integer64; // inputs that read from a copy again
222
+ rows : Integer64; // copy rows written
223
+ startedAt : Timestamp;
224
+ finishedAt : Timestamp;
225
+ error : String;
226
+ }
227
+
228
+ @title : 'Metadata Backfill Status'
229
+ @description: 'Progress of the chain-position fill started with backfillMetadataPositions; process-local, none after a restart'
230
+ type MetadataBackfillStatus {
231
+ status : String; // none | running | done | failed | cancelled
232
+ atSlot : String; // slot the walk has reached
233
+ toSlot : String; // last slot that holds a stored transaction
234
+ rows : Integer64; // metadata rows that received their position
235
+ startedAt : Timestamp;
236
+ finishedAt : Timestamp;
237
+ error : String;
238
+ }
239
+
240
+ @title : 'Asset Slice Backfill Status'
241
+ @description: 'Progress of the fill started with backfillAssetSlices; process-local, none after a restart'
242
+ type AssetSliceBackfillStatus {
243
+ status : String; // none | running | done | failed | cancelled
244
+ table : String; // table being walked; null when finished
245
+ outputs : Integer64; // TransactionOutputAssets rows written
246
+ inputs : Integer64; // TransactionInputAssetCopies rows written
247
+ ledgerUtxos : Integer64; // LedgerUTxOAssets rows written
248
+ ledgerAddresses : Integer64; // LedgerAddressAssets rows written
249
+ utxoSlices : Integer64; // UTxOAssets rows written, every cached slice
250
+ addressSlices : Integer64; // AddressAssets rows written, every cached slice
251
+ startedAt : Timestamp;
252
+ finishedAt : Timestamp;
253
+ error : String;
254
+ }
255
+
256
+ @title : 'Backfill Result'
257
+ type BackfillResult {
258
+ accepted : Boolean;
259
+ message : String;
260
+ }
261
+
262
+ @title : 'Certificate Backfill Result'
263
+ type CertificateBackfillResult {
264
+ accepted : Boolean;
265
+ fromSlot : String;
266
+ toSlot : String;
267
+ message : String;
268
+ }
269
+
270
+ @title : 'UTxO Set Status'
271
+ @description: 'State of the crawler-maintained UTxO set (crawler.utxoSet)'
272
+ type UtxoSetStatus {
273
+ enabled : Boolean; // crawler.utxoSet configured
274
+ status : String; // none | importing | active | invalid
275
+ anchorSlot : String; // null until imported
276
+ anchorHash : String;
277
+ importedAt : Timestamp;
278
+ error : String; // why invalid
279
+ }
280
+
281
+ @title : 'UTxO Set Import Result'
282
+ type UtxoSetImportResult {
283
+ accepted : Boolean;
284
+ anchorSlot : String;
285
+ anchorHash : String;
286
+ message : String;
287
+ }
288
+
289
+ @title : 'Get Crawler Status'
290
+ @description: 'Return the current crawler run state and sync progress'
291
+ /** Emitted after each block is committed. In plugin mode subscribing needs no messaging service. */
292
+ event blockIndexed {
293
+ hash : String(64);
294
+ slot : Integer64;
295
+ height : Integer64;
296
+ txHashes : many String(64);
297
+ tipSlot : Integer64;
298
+ tipHeight: Integer64;
299
+ }
300
+
301
+ /** Emitted AFTER a rollback is committed. Everything above `forkSlot` was removed. */
302
+ event reorg {
303
+ forkSlot : Integer64;
304
+ forkHeight : Integer64;
305
+ blocksRolledBack : Integer;
306
+ }
307
+
308
+ @requires : 'Read'
309
+ @odatano.agent: 'read'
310
+ function getStatus() returns CrawlerStatus;
311
+
312
+ @title : 'Liveness'
313
+ type Liveness {
314
+ status : String; // 'alive'
315
+ timestamp : Timestamp;
316
+ uptime : Integer; // seconds since process start
317
+ version : String; // @odatano/core version
318
+ network : String; // configured network
319
+ }
320
+
321
+ // Anonymous on purpose, since a liveness probe carries no credentials.
322
+ // It probes no backend or DB and reveals no secrets.
323
+ @title : 'Get Liveness'
324
+ @description: 'Unauthenticated liveness probe: 200 while the process answers. The Docker HEALTHCHECK uses this.'
325
+ @requires : 'any'
326
+ @odatano.agent: 'read'
327
+ function getLiveness() returns Liveness;
328
+
329
+ @title : 'Readiness'
330
+ type Readiness {
331
+ status : String; // 'ready' | 'not_ready'
332
+ timestamp : Timestamp;
333
+ context : Boolean; // client, indexer and transaction builder exist
334
+ database : Boolean; // the database answers and holds the schema
335
+ hsm : Boolean; // null = no HSM configured; the HSM session is connected
336
+ }
337
+
338
+ // Anonymous like getLiveness. The body names the missing part and no configuration detail.
339
+ @title : 'Get Readiness'
340
+ @description: 'Unauthenticated readiness probe: 200 when this instance can serve requests, 503 with the same body while the app context, the database or a configured HSM is missing. Load balancers and upstream gateways use this to decide whether to route requests here.'
341
+ @requires : 'any'
342
+ @odatano.agent: 'read'
343
+ function getReadiness() returns Readiness;
344
+
345
+ @title : 'Pause Crawler'
346
+ @description: 'Stop the crawler (closes the chain-sync stream). Resume continues from the cursor.'
347
+ @requires : 'Admin'
348
+ @odatano.agent: 'operator'
349
+ action pauseCrawler() returns Boolean;
350
+
351
+ @title : 'Resume Crawler'
352
+ @description: 'Start/restart the crawler from the persisted cursor using the configured source.'
353
+ @requires : 'Admin'
354
+ @odatano.agent: 'operator'
355
+ action resumeCrawler() returns Boolean;
356
+
357
+ @title : 'Import UTxO Set'
358
+ @description: 'One-off import of the UTxO set that anchors crawler.utxoSet. Pause the crawler first. source=ogmios acquires the set at the crawler cursor (crawl must be at the tip); source=file loads a cardano-cli query utxo --whole-utxo dump (.json, or .ndjson from jq -c to_entries[]) taken at anchorSlot/anchorHash. source=aggregates rebuilds only the sums (LedgerAddresses, LedgerAddressAssets, LedgerAccounts) from the rows an earlier import left, e.g. after its aggregate phase failed; a cursor past the anchor is set back to it. source=scripts fills the reference-script columns (utxo_referenceScriptHash, utxo_referenceScriptSize, utxo_referenceScriptType) of rows an earlier import left empty: from the same dump (filePath), or without filePath from Ogmios for the unspent rows that hold a hash but no size; the set stays active. Runs in the background; progress via getStatus().utxoSet and the log.'
359
+ @requires : 'Admin'
360
+ @odatano.agent: 'operator'
361
+ action importUtxoSet(@assert.range source: UtxoSetImportSource, filePath: String,
362
+ @assert.range: [0, _] anchorSlot: Integer64, anchorHash: String) returns UtxoSetImportResult;
363
+
364
+ @title : 'Backfill Certificates'
365
+ @description: 'Fill TransactionCertificates and TransactionWithdrawals for blocks the crawl already holds, from a second chain-sync stream (Ogmios), and remove the rows stored for a transaction whose script phase failed. fromSlot defaults to the crawl start, toSlot to the cursor. Writes only those two tables; the crawler may keep running. Runs in the background; progress via getStatus().certificateBackfill.'
366
+ @requires : 'Admin'
367
+ @odatano.agent: 'operator'
368
+ action backfillCertificates(@assert.range: [0, _] fromSlot: Integer64, @assert.range: [0, _] toSlot: Integer64) returns CertificateBackfillResult;
369
+
370
+ @title : 'Backfill Transactions'
371
+ @description: 'Complete transactions the crawl already holds from a second chain-sync stream (Ogmios): input outpoints, the spent output datum and reference-script hash, missing input addresses, empty datum and reference-script fields of stored outputs, TransactionRedeemers and TransactionDatums. Fills empty fields only; a transaction whose stored inputs differ from the stream is skipped. fromSlot defaults to the crawl start, toSlot to the cursor; the crawler may keep running. Runs in the background; progress via getStatus().transactionBackfill.'
372
+ @requires : 'Admin'
373
+ @odatano.agent: 'operator'
374
+ action backfillTransactions(@assert.range: [0, _] fromSlot: Integer64, @assert.range: [0, _] toSlot: Integer64) returns CertificateBackfillResult;
375
+
376
+ @title : 'Backfill Payment Credentials'
377
+ @description: 'Fill utxo.paymentCredential on TransactionOutputs, TransactionInputs and LedgerUTxOs rows written before the column existed, decoded from the stored address. Walks each table once in key order; rows that carry a credential are left alone, so a second run is a no-op. No backend call; the crawler may keep running. Runs in the background; progress via getStatus().credentialBackfill.'
378
+ @requires : 'Admin'
379
+ @odatano.agent: 'operator'
380
+ action backfillPaymentCredentials() returns BackfillResult;
381
+
382
+ @title : 'Backfill Output Datums'
383
+ @description: 'Repair stored outputs that hold a datum hash and no inline datum: their transactions are read again from a backend that serves transactions (Koios, Blockfrost or a remote ODATANO), and the inline datum and the reference-script fields it returns are written to the output, to the inputs that spent it and to its UTxO set row. Only empty fields change. An output whose datum is hash-only stays as it is and is read again on a repeat. With Ogmios as the only backend use backfillTransactions, which fills the same fields from the node. Runs in the background; progress via getStatus().datumBackfill.'
384
+ @requires : 'Admin'
385
+ @odatano.agent: 'operator'
386
+ action backfillOutputDatums() returns BackfillResult;
387
+
388
+ @title : 'Backfill Metadata Positions'
389
+ @description: 'Write the chain position (txSeq) of its transaction to every TransactionMetadata row whose position is empty or differs from it, so GetMetadataByLabel returns rows stored before the column existed. Walks the stored transactions by slot window, between fromSlot and toSlot when given. No backend call; the crawler may keep running; a repeat changes nothing. Runs in the background; progress via getStatus().metadataBackfill.'
390
+ @requires : 'Admin'
391
+ @odatano.agent: 'operator'
392
+ action backfillMetadataPositions(@assert.range: [0, _] fromSlot: Integer64, @assert.range: [0, _] toSlot: Integer64) returns BackfillResult;
393
+
394
+ @title : 'Backfill Asset Slices'
395
+ @description: 'Write policy id, asset name in hex and decoded, and CIP-14 fingerprint of every stored asset row (TransactionOutputAssets, TransactionInputAssetCopies, LedgerUTxOAssets, LedgerAddressAssets, and every slice of UTxOAssets and AddressAssets) as derived from its unit. Rows that already agree are left alone; a repeat changes nothing. No backend call; the crawler may keep running. Runs in the background; progress via getStatus().sliceBackfill.'
396
+ @requires : 'Admin'
397
+ @odatano.agent: 'operator'
398
+ action backfillAssetSlices() returns BackfillResult;
399
+
400
+ @title : 'Re-check Failed Submits'
401
+ @description: 'Read every submission, signing request and wallet job (failed as TX_DROPPED or SUBMIT_REJECTED) with status failed again against the chain. One whose transaction is on chain with passing scripts (crawled chain inside its coverage, or a backend lookup that reports the script validity) goes back to submitted, with a resolution note; a signing request without a submission record gets one, a job goes on to confirm by depth and its submission follows. A lookup without an answer, or without the script validity, leaves the row failed. Runs detached; poll getStatus().failedRecheck. May be repeated.'
402
+ @requires : 'Admin'
403
+ @odatano.agent: 'operator'
404
+ action recheckFailedSubmits() returns BackfillResult;
405
+
406
+ @title : 'Backfill Epochs'
407
+ @description: 'Write block count, transaction count, fees and the first and last block time of every epoch the crawl covers in full, from the stored blocks. An epoch that has no row gets one; output and active stake of an existing row stay. No backend. Runs detached; poll getStatus().epochBackfill. May be repeated.'
408
+ @requires : 'Admin'
409
+ @odatano.agent: 'operator'
410
+ action backfillEpochs() returns BackfillResult;
411
+
412
+ @title : 'Prune Input Asset Copies'
413
+ @description: 'Move the transaction inputs between fromSlot and toSlot (slot of the spending transaction) from stored asset copies to the output they spent. An input moves only when that output is stored and holds exactly the assets of its copy; its copy is deleted and it reads from the output. Answers stay the same; a long range of inputs reads slower. Disk space is free once the copy table is rewritten. restoreInputAssetCopies undoes it. slotWindow: slots per transaction, default 20000. PostgreSQL and SQLite. Runs detached; poll getStatus().copyPrune.'
414
+ @requires : 'Admin'
415
+ @odatano.agent: 'operator'
416
+ action pruneInputAssetCopies(@assert.range: [0, _] fromSlot: Integer64 not null, @assert.range: [0, _] toSlot: Integer64 not null, @assert.range: [1, 1000000] slotWindow: Integer) returns BackfillResult;
417
+
418
+ @title : 'Restore Input Asset Copies'
419
+ @description: 'Move the transaction inputs between fromSlot and toSlot (slot of the spending transaction) back to stored asset copies, written from the outputs they spent. slotWindow: slots per transaction, default 20000. PostgreSQL and SQLite. Runs detached; poll getStatus().copyRestore.'
420
+ @requires : 'Admin'
421
+ @odatano.agent: 'operator'
422
+ action restoreInputAssetCopies(@assert.range: [0, _] fromSlot: Integer64 not null, @assert.range: [0, _] toSlot: Integer64 not null, @assert.range: [1, 1000000] slotWindow: Integer) returns BackfillResult;
423
+
424
+ @title : 'Maintenance Run'
425
+ @description: 'A backfill or walk cancelMaintenance can stop, named as in getStatus()'
426
+ type MaintenanceRun : String enum {
427
+ certificateBackfill; transactionBackfill; credentialBackfill; decimalsBackfill; registryBackfill;
428
+ datumBackfill; metadataBackfill; epochBackfill; failedRecheck; sliceBackfill; copyPrune; copyRestore;
429
+ }
430
+
431
+ @title : 'Cancel Maintenance'
432
+ @description: 'Ask a backfill or walk running in this process to stop at its next window, page or batch. What it wrote so far stays; the status turns cancelled. accepted is false when the run is not running in this process. A new start begins again at its first slot or key.'
433
+ @requires : 'Admin'
434
+ @odatano.agent: 'operator'
435
+ action cancelMaintenance(@assert.range run: MaintenanceRun not null) returns BackfillResult;
436
+
437
+ @title : 'Backfill Asset Decimals'
438
+ @description: 'Fill Assets.decimals from the CIP-68 reference datum for every catalogue unit with label 333 or 444: the reference NFT is followed from its mint through the crawled transactions to the output that holds it now, and the decimals of that datum are written to every slice of the unit. No backend call; the crawler may keep running; a repeat refreshes the values. Runs in the background; progress via getStatus().decimalsBackfill.'
439
+ @requires : 'Admin'
440
+ @odatano.agent: 'operator'
441
+ action backfillAssetDecimals() returns BackfillResult;
442
+
443
+ @title : 'Backfill Asset Registry'
444
+ @description: 'Fill the CIP-26 registry fields (registryName, registryTicker, registryDecimals, registryDescription, registryUrl, registryLogo) on every slice of every Assets unit the token registry lists, and decimals where it is still empty. source koios (default): each unit is read from the backend (needs Koios), rate limited. source file: path names a folder on the server with the entry files of the registry repository (mappings of cardano-token-registry, registry of metadata-registry-testnet); units without an Assets row are counted, not created; no backend. The crawler may keep running; a repeat refreshes the values. Runs in the background; progress via getStatus().registryBackfill.'
445
+ @requires : 'Admin'
446
+ @odatano.agent: 'operator'
447
+ action backfillAssetRegistry(@assert.range source: AssetRegistrySource, path: String) returns BackfillResult;
448
+ }