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

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
@@ -110,6 +110,96 @@ export class Pools extends Array<Pool> {
110
110
  $count?: number
111
111
  }
112
112
 
113
+ // entity 'PoolEpochSnapshot'
114
+ export declare function _PoolEpochSnapshotAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
115
+ new (...args: any[]): {
116
+ poolId?: __.Key<_.Bech32>
117
+ epoch?: __.Key<number>
118
+ snapshotSlot?: number | null
119
+ snapshotTime?: number | null
120
+ snapshotHash?: _.Blake2b256 | null
121
+ source?: string | null
122
+ blocksMinted?: number | null
123
+ blocksEpoch?: number | null
124
+ liveStake?: _.Lovelace | null
125
+ liveSize?: (number | string) | null
126
+ liveSaturation?: (number | string) | null
127
+ liveDelegators?: number | null
128
+ activeStake?: _.Lovelace | null
129
+ activeSize?: (number | string) | null
130
+ pledge?: _.Lovelace | null
131
+ margin?: (number | string) | null
132
+ fixedCost?: _.Lovelace | null
133
+ } & InstanceType<TBase>
134
+ readonly kind: 'entity';
135
+ readonly keys: __.KeysOf<PoolEpochSnapshot>;
136
+ readonly elements: __.ElementsOf<PoolEpochSnapshot>;
137
+ readonly actions: globalThis.Record<never, never>;
138
+ };
139
+ export class PoolEpochSnapshot extends _PoolEpochSnapshotAspect(__.Entity) {
140
+ }
141
+ export class PoolEpochSnapshots extends Array<PoolEpochSnapshot> {
142
+ $count?: number
143
+ }
144
+
145
+ // entity 'DrepEpochSnapshot'
146
+ export declare function _DrepEpochSnapshotAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
147
+ new (...args: any[]): {
148
+ drepId?: __.Key<_.Bech32>
149
+ epoch?: __.Key<number>
150
+ snapshotSlot?: number | null
151
+ snapshotTime?: number | null
152
+ snapshotHash?: _.Blake2b256 | null
153
+ source?: string | null
154
+ deposit?: _.Lovelace | null
155
+ expiresEpoch?: number | null
156
+ delegatorCount?: number | null
157
+ amount?: _.Lovelace | null
158
+ hasScript?: boolean | null
159
+ lastActiveEpoch?: number | null
160
+ retired?: boolean | null
161
+ expired?: boolean | null
162
+ } & InstanceType<TBase>
163
+ readonly kind: 'entity';
164
+ readonly keys: __.KeysOf<DrepEpochSnapshot>;
165
+ readonly elements: __.ElementsOf<DrepEpochSnapshot>;
166
+ readonly actions: globalThis.Record<never, never>;
167
+ };
168
+ export class DrepEpochSnapshot extends _DrepEpochSnapshotAspect(__.Entity) {
169
+ }
170
+ export class DrepEpochSnapshots extends Array<DrepEpochSnapshot> {
171
+ $count?: number
172
+ }
173
+
174
+ // entity 'EpochLedgerSnapshot'
175
+ export declare function _EpochLedgerSnapshotAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
176
+ new (...args: any[]): {
177
+ epoch?: __.Key<number>
178
+ snapshotSlot?: number | null
179
+ snapshotTime?: number | null
180
+ snapshotHash?: _.Blake2b256 | null
181
+ source?: string | null
182
+ treasury?: _.Lovelace | null
183
+ reserves?: _.Lovelace | null
184
+ totalSupply?: _.Lovelace | null
185
+ liveStake?: _.Lovelace | null
186
+ activeStake?: _.Lovelace | null
187
+ poolCount?: number | null
188
+ drepCount?: number | null
189
+ drepAbstainStake?: _.Lovelace | null
190
+ drepNoConfidenceStake?: _.Lovelace | null
191
+ } & InstanceType<TBase>
192
+ readonly kind: 'entity';
193
+ readonly keys: __.KeysOf<EpochLedgerSnapshot>;
194
+ readonly elements: __.ElementsOf<EpochLedgerSnapshot>;
195
+ readonly actions: globalThis.Record<never, never>;
196
+ };
197
+ export class EpochLedgerSnapshot extends _EpochLedgerSnapshotAspect(__.Entity) {
198
+ }
199
+ export class EpochLedgerSnapshots extends Array<EpochLedgerSnapshot> {
200
+ $count?: number
201
+ }
202
+
113
203
  // entity 'Asset'
114
204
  export declare function _AssetAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
115
205
  new (...args: any[]): {
@@ -225,7 +315,7 @@ export declare function _AddressAssetAspect<TBase extends new (...args: any[]) =
225
315
  address?: __.Key<__.Association.to<Address>>
226
316
  address_address?: __.Key<_.Bech32>
227
317
  unit?: __.Key<_.AssetUnit>
228
- asset_quantity?: _.Lovelace | null
318
+ asset_quantity?: _.AssetAmount | null
229
319
  asset_policyId?: _.Blake2b224 | null
230
320
  asset_assetNameHex?: _.HexBytes | null
231
321
  asset_assetName?: string | null
@@ -333,6 +423,7 @@ export class Accounts extends Array<Account> {
333
423
  export declare function _TransactionAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
334
424
  new (...args: any[]): {
335
425
  hash?: __.Key<_.Blake2b256>
426
+ txSeq?: number | null
336
427
  blockHash?: _.Blake2b256 | null
337
428
  blockHeight?: number | null
338
429
  blockTime?: number | null
@@ -344,6 +435,8 @@ export declare function _TransactionAspect<TBase extends new (...args: any[]) =>
344
435
  metadata?: __.Composition.of.many<TransactionMetadata_>
345
436
  inputs?: __.Composition.of.many<TransactionInputs>
346
437
  outputs?: __.Composition.of.many<TransactionOutputs>
438
+ certificates?: __.Composition.of.many<TransactionCertificates>
439
+ withdrawals?: __.Composition.of.many<TransactionWithdrawals>
347
440
  hasMetadata?: boolean | null
348
441
  hasInputs?: boolean | null
349
442
  hasOutputs?: boolean | null
@@ -362,14 +455,16 @@ export class Transactions extends Array<Transaction> {
362
455
  // entity 'TransactionInput'
363
456
  export declare function _TransactionInputAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
364
457
  new (...args: any[]): {
365
- tx?: __.Key<__.Association.to<Transaction>>
366
- tx_hash?: __.Key<_.Blake2b256>
458
+ txSeq?: __.Key<number>
459
+ tx?: __.Association.to<Transaction> | null
367
460
  inputIndex?: __.Key<number>
368
461
  address?: __.Association.to<Address> | null
369
462
  address_address?: _.Bech32 | null
370
463
  utxoData_dataHash?: _.Blake2b256 | null
371
464
  utxoData_inlineDatum?: string | null
372
465
  utxoData_referenceScriptHash?: _.Blake2b256 | null
466
+ spentTxHash?: _.Blake2b256 | null
467
+ spentOutputIndex?: number | null
373
468
  isCollateral?: boolean | null
374
469
  isReference?: boolean | null
375
470
  assets?: __.Composition.of.many<TransactionInputAssets>
@@ -391,8 +486,8 @@ export class TransactionInputs extends Array<TransactionInput> {
391
486
  export declare function _TransactionInputAssetAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
392
487
  new (...args: any[]): {
393
488
  input?: __.Key<__.Association.to<TransactionInput>>
489
+ input_txSeq?: __.Key<number>
394
490
  input_inputIndex?: __.Key<number>
395
- input_tx_hash?: __.Key<_.Blake2b256>
396
491
  unit?: __.Key<_.AssetUnit>
397
492
  asset_quantity?: _.Lovelace | null
398
493
  asset_policyId?: _.Blake2b224 | null
@@ -411,11 +506,203 @@ export class TransactionInputAssets extends Array<TransactionInputAsset> {
411
506
  $count?: number
412
507
  }
413
508
 
414
- // entity 'TransactionOutput'
415
- export declare function _TransactionOutputAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
509
+ // entity 'LedgerUTxO'
510
+ export declare function _LedgerUTxOAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
511
+ new (...args: any[]): {
512
+ txHash?: __.Key<_.Blake2b256>
513
+ outputIndex?: __.Key<number>
514
+ address?: _.Bech32 | null
515
+ stakeAddress?: _.Bech32 | null
516
+ addressType?: string | null
517
+ isScript?: boolean | null
518
+ lovelace?: _.Lovelace | null
519
+ createdSlot?: number | null
520
+ spentTxHash?: _.Blake2b256 | null
521
+ spentSlot?: number | null
522
+ utxo_dataHash?: _.Blake2b256 | null
523
+ utxo_inlineDatum?: string | null
524
+ utxo_referenceScriptHash?: _.Blake2b256 | null
525
+ hasAssets?: boolean | null
526
+ assets?: __.Composition.of.many<LedgerUTxOAssets>
527
+ } & InstanceType<TBase>
528
+ readonly kind: 'entity';
529
+ readonly keys: __.KeysOf<LedgerUTxO>;
530
+ readonly elements: __.ElementsOf<LedgerUTxO>;
531
+ readonly actions: globalThis.Record<never, never>;
532
+ };
533
+ export class LedgerUTxO extends _LedgerUTxOAspect(__.Entity) {
534
+ }
535
+ export class LedgerUTxOs extends Array<LedgerUTxO> {
536
+ $count?: number
537
+ }
538
+
539
+ // entity 'LedgerUTxOAsset'
540
+ export declare function _LedgerUTxOAssetAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
541
+ new (...args: any[]): {
542
+ utxo?: __.Key<__.Association.to<LedgerUTxO>>
543
+ utxo_txHash?: __.Key<_.Blake2b256>
544
+ utxo_outputIndex?: __.Key<number>
545
+ unit?: __.Key<_.AssetUnit>
546
+ asset_quantity?: _.Lovelace | null
547
+ asset_policyId?: _.Blake2b224 | null
548
+ asset_assetNameHex?: _.HexBytes | null
549
+ asset_assetName?: string | null
550
+ asset_fingerprint?: string | null
551
+ } & InstanceType<TBase>
552
+ readonly kind: 'entity';
553
+ readonly keys: __.KeysOf<LedgerUTxOAsset>;
554
+ readonly elements: __.ElementsOf<LedgerUTxOAsset>;
555
+ readonly actions: globalThis.Record<never, never>;
556
+ };
557
+ export class LedgerUTxOAsset extends _LedgerUTxOAssetAspect(__.Entity) {
558
+ }
559
+ export class LedgerUTxOAssets extends Array<LedgerUTxOAsset> {
560
+ $count?: number
561
+ }
562
+
563
+ // entity 'LedgerAddress'
564
+ export declare function _LedgerAddressAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
565
+ new (...args: any[]): {
566
+ address?: __.Key<_.Bech32>
567
+ stakeAddress?: _.Bech32 | null
568
+ paymentCredential?: string | null
569
+ addressType?: string | null
570
+ isScript?: boolean | null
571
+ totalLovelace?: _.Lovelace | null
572
+ utxoCount?: number | null
573
+ firstSeenSlot?: number | null
574
+ lastActiveSlot?: number | null
575
+ assets?: __.Composition.of.many<LedgerAddressAssets>
576
+ utxos?: __.Association.to.many<LedgerUTxOs>
577
+ } & InstanceType<TBase>
578
+ readonly kind: 'entity';
579
+ readonly keys: __.KeysOf<LedgerAddress>;
580
+ readonly elements: __.ElementsOf<LedgerAddress>;
581
+ readonly actions: globalThis.Record<never, never>;
582
+ };
583
+ export class LedgerAddress extends _LedgerAddressAspect(__.Entity) {
584
+ }
585
+ export class LedgerAddresses extends Array<LedgerAddress> {
586
+ $count?: number
587
+ }
588
+
589
+ // entity 'LedgerAddressAsset'
590
+ export declare function _LedgerAddressAssetAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
591
+ new (...args: any[]): {
592
+ address?: __.Key<__.Association.to<LedgerAddress>>
593
+ address_address?: __.Key<_.Bech32>
594
+ unit?: __.Key<_.AssetUnit>
595
+ asset_quantity?: _.AssetAmount | null
596
+ asset_policyId?: _.Blake2b224 | null
597
+ asset_assetNameHex?: _.HexBytes | null
598
+ asset_assetName?: string | null
599
+ asset_fingerprint?: string | null
600
+ } & InstanceType<TBase>
601
+ readonly kind: 'entity';
602
+ readonly keys: __.KeysOf<LedgerAddressAsset>;
603
+ readonly elements: __.ElementsOf<LedgerAddressAsset>;
604
+ readonly actions: globalThis.Record<never, never>;
605
+ };
606
+ export class LedgerAddressAsset extends _LedgerAddressAssetAspect(__.Entity) {
607
+ }
608
+ export class LedgerAddressAssets extends Array<LedgerAddressAsset> {
609
+ $count?: number
610
+ }
611
+
612
+ // entity 'LedgerAccount'
613
+ export declare function _LedgerAccountAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
614
+ new (...args: any[]): {
615
+ stakeAddress?: __.Key<_.Bech32>
616
+ controlledAmount?: _.Lovelace | null
617
+ addressCount?: number | null
618
+ utxoCount?: number | null
619
+ lastActiveSlot?: number | null
620
+ addresses?: __.Association.to.many<LedgerAddresses>
621
+ } & InstanceType<TBase>
622
+ readonly kind: 'entity';
623
+ readonly keys: __.KeysOf<LedgerAccount>;
624
+ readonly elements: __.ElementsOf<LedgerAccount>;
625
+ readonly actions: globalThis.Record<never, never>;
626
+ };
627
+ export class LedgerAccount extends _LedgerAccountAspect(__.Entity) {
628
+ }
629
+ export class LedgerAccounts extends Array<LedgerAccount> {
630
+ $count?: number
631
+ }
632
+
633
+ // entity 'TransactionCertificate'
634
+ export declare function _TransactionCertificateAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
416
635
  new (...args: any[]): {
417
636
  tx?: __.Key<__.Association.to<Transaction>>
418
637
  tx_hash?: __.Key<_.Blake2b256>
638
+ certIndex?: __.Key<number>
639
+ kind?: __.Key<string>
640
+ stakeAddress?: _.Bech32 | null
641
+ poolId?: _.Bech32 | null
642
+ drepId?: _.Bech32 | null
643
+ deposit?: _.Lovelace | null
644
+ epoch?: number | null
645
+ } & InstanceType<TBase>
646
+ readonly kind: 'entity';
647
+ readonly keys: __.KeysOf<TransactionCertificate>;
648
+ readonly elements: __.ElementsOf<TransactionCertificate>;
649
+ readonly actions: globalThis.Record<never, never>;
650
+ };
651
+ export class TransactionCertificate extends _TransactionCertificateAspect(__.Entity) {
652
+ }
653
+ export class TransactionCertificates extends Array<TransactionCertificate> {
654
+ $count?: number
655
+ }
656
+
657
+ // entity 'TransactionWithdrawal'
658
+ export declare function _TransactionWithdrawalAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
659
+ new (...args: any[]): {
660
+ tx?: __.Key<__.Association.to<Transaction>>
661
+ tx_hash?: __.Key<_.Blake2b256>
662
+ stakeAddress?: __.Key<_.Bech32>
663
+ lovelace?: _.Lovelace | null
664
+ } & InstanceType<TBase>
665
+ readonly kind: 'entity';
666
+ readonly keys: __.KeysOf<TransactionWithdrawal>;
667
+ readonly elements: __.ElementsOf<TransactionWithdrawal>;
668
+ readonly actions: globalThis.Record<never, never>;
669
+ };
670
+ export class TransactionWithdrawal extends _TransactionWithdrawalAspect(__.Entity) {
671
+ }
672
+ export class TransactionWithdrawals extends Array<TransactionWithdrawal> {
673
+ $count?: number
674
+ }
675
+
676
+ // entity 'TransactionRedeemer'
677
+ export declare function _TransactionRedeemerAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
678
+ new (...args: any[]): {
679
+ tx?: __.Key<__.Association.to<Transaction>>
680
+ tx_hash?: __.Key<_.Blake2b256>
681
+ purpose?: __.Key<string>
682
+ redeemerIndex?: __.Key<number>
683
+ data?: string | null
684
+ mem?: number | null
685
+ steps?: number | null
686
+ spentTxHash?: _.Blake2b256 | null
687
+ spentOutputIndex?: number | null
688
+ policyId?: _.Blake2b224 | null
689
+ } & InstanceType<TBase>
690
+ readonly kind: 'entity';
691
+ readonly keys: __.KeysOf<TransactionRedeemer>;
692
+ readonly elements: __.ElementsOf<TransactionRedeemer>;
693
+ readonly actions: globalThis.Record<never, never>;
694
+ };
695
+ export class TransactionRedeemer extends _TransactionRedeemerAspect(__.Entity) {
696
+ }
697
+ export class TransactionRedeemers extends Array<TransactionRedeemer> {
698
+ $count?: number
699
+ }
700
+
701
+ // entity 'TransactionOutput'
702
+ export declare function _TransactionOutputAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
703
+ new (...args: any[]): {
704
+ txSeq?: __.Key<number>
705
+ tx?: __.Association.to<Transaction> | null
419
706
  outputIndex?: __.Key<number>
420
707
  address?: __.Association.to<Address> | null
421
708
  address_address?: _.Bech32 | null
@@ -441,8 +728,8 @@ export class TransactionOutputs extends Array<TransactionOutput> {
441
728
  export declare function _TransactionOutputAssetAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
442
729
  new (...args: any[]): {
443
730
  output?: __.Key<__.Association.to<TransactionOutput>>
731
+ output_txSeq?: __.Key<number>
444
732
  output_outputIndex?: __.Key<number>
445
- output_tx_hash?: __.Key<_.Blake2b256>
446
733
  unit?: __.Key<_.AssetUnit>
447
734
  asset_quantity?: _.Lovelace | null
448
735
  asset_policyId?: _.Blake2b224 | null
@@ -548,6 +835,7 @@ export declare function _TransactionBuildAspect<TBase extends new (...args: any[
548
835
  createdAt?: number | null
549
836
  inputs?: __.Composition.of.many<TransactionBuildInputs>
550
837
  outputs?: __.Composition.of.many<TransactionBuildOutputs>
838
+ redeemers?: __.Composition.of.many<TransactionBuildRedeemers>
551
839
  submission?: __.Association.to<TransactionSubmission> | null
552
840
  hasInputs?: boolean | null
553
841
  hasOutputs?: boolean | null
@@ -642,6 +930,27 @@ export class TransactionBuildOutputs extends Array<TransactionBuildOutput> {
642
930
  $count?: number
643
931
  }
644
932
 
933
+ // entity 'TransactionBuildRedeemer'
934
+ export declare function _TransactionBuildRedeemerAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
935
+ new (...args: any[]): {
936
+ build?: __.Key<__.Association.to<TransactionBuild>>
937
+ build_id?: __.Key<string>
938
+ tag?: __.Key<string>
939
+ redeemerIndex?: __.Key<number>
940
+ mem?: number | null
941
+ steps?: number | null
942
+ } & InstanceType<TBase>
943
+ readonly kind: 'entity';
944
+ readonly keys: __.KeysOf<TransactionBuildRedeemer>;
945
+ readonly elements: __.ElementsOf<TransactionBuildRedeemer>;
946
+ readonly actions: globalThis.Record<never, never>;
947
+ };
948
+ export class TransactionBuildRedeemer extends _TransactionBuildRedeemerAspect(__.Entity) {
949
+ }
950
+ export class TransactionBuildRedeemers extends Array<TransactionBuildRedeemer> {
951
+ $count?: number
952
+ }
953
+
645
954
  // entity 'TransactionBuildOutputAsset'
646
955
  export declare function _TransactionBuildOutputAssetAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
647
956
  new (...args: any[]): {
@@ -859,6 +1168,12 @@ export declare function _CardanoSyncStateAspect<TBase extends new (...args: any[
859
1168
  consecutiveErrors?: number | null
860
1169
  desiredRunning?: boolean | null
861
1170
  leaseOwner?: string | null
1171
+ utxoSetStatus?: string | null
1172
+ utxoAnchorSlot?: number | null
1173
+ utxoAnchorHash?: _.Blake2b256 | null
1174
+ utxoSetImportedAt?: __.CdsTimestamp | null
1175
+ utxoAppliedSlot?: number | null
1176
+ utxoSetError?: string | null
862
1177
  leaseUntil?: __.CdsTimestamp | null
863
1178
  } & InstanceType<TBase>
864
1179
  readonly kind: 'entity';
@@ -958,3 +1273,89 @@ export class CardanoWalletJob extends _CardanoWalletJobAspect(__.Entity) {
958
1273
  export class CardanoWalletJobs extends Array<CardanoWalletJob> {
959
1274
  $count?: number
960
1275
  }
1276
+
1277
+ // entity 'CardanoAgentGrant'
1278
+ export declare function _CardanoAgentGrantAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
1279
+ new (...args: any[]): {
1280
+ ID?: __.Key<string>
1281
+ userId?: string
1282
+ agentLabel?: string | null
1283
+ tokenHash?: string
1284
+ allowedActions?: string
1285
+ walletId?: string | null
1286
+ allowedJobKinds?: string | null
1287
+ maxJobsPerDay?: number | null
1288
+ jobsUsedToday?: number | null
1289
+ budgetWindow?: string | null
1290
+ validUntil?: __.CdsTimestamp | null
1291
+ isActive?: boolean | null
1292
+ revokedAt?: __.CdsTimestamp | null
1293
+ createdAt?: __.CdsTimestamp | null
1294
+ lastUsedAt?: __.CdsTimestamp | null
1295
+ } & InstanceType<TBase>
1296
+ readonly kind: 'entity';
1297
+ readonly keys: __.KeysOf<CardanoAgentGrant>;
1298
+ readonly elements: __.ElementsOf<CardanoAgentGrant>;
1299
+ readonly actions: globalThis.Record<never, never>;
1300
+ };
1301
+ /**
1302
+ * Agent grants (v2.0): scoped bearer capabilities an Admin hands to an agent
1303
+ * instead of a full user. The token is a capability, not an identity — it is
1304
+ * stored as SHA-256 only, and a request carrying it runs as the principal
1305
+ * `agent:<ID>` with the role `agent-grant`, never as the operator. Enforcement
1306
+ * (allow list, wallet pinning, daily budget) lives in srv/utils/agent-grants.ts;
1307
+ * the transport lane that admits `x-agent-token` in srv/utils/agent-token-auth.ts.
1308
+ * Admin-only table: creation and revocation happen through CardanoAgentService
1309
+ * actions, a token request may read its own row only.
1310
+ */
1311
+ export class CardanoAgentGrant extends _CardanoAgentGrantAspect(__.Entity) {
1312
+ }
1313
+ /**
1314
+ * Agent grants (v2.0): scoped bearer capabilities an Admin hands to an agent
1315
+ * instead of a full user. The token is a capability, not an identity — it is
1316
+ * stored as SHA-256 only, and a request carrying it runs as the principal
1317
+ * `agent:<ID>` with the role `agent-grant`, never as the operator. Enforcement
1318
+ * (allow list, wallet pinning, daily budget) lives in srv/utils/agent-grants.ts;
1319
+ * the transport lane that admits `x-agent-token` in srv/utils/agent-token-auth.ts.
1320
+ * Admin-only table: creation and revocation happen through CardanoAgentService
1321
+ * actions, a token request may read its own row only.
1322
+ */
1323
+ export class CardanoAgentGrants extends Array<CardanoAgentGrant> {
1324
+ $count?: number
1325
+ }
1326
+
1327
+ // entity 'CardanoAgentGrantUsage'
1328
+ export declare function _CardanoAgentGrantUsageAspect<TBase extends new (...args: any[]) => object>(Base: TBase): {
1329
+ new (...args: any[]): {
1330
+ grant?: __.Key<__.Association.to<CardanoAgentGrant>>
1331
+ grant_ID?: __.Key<string>
1332
+ day?: __.Key<string>
1333
+ service?: __.Key<string>
1334
+ action?: __.Key<string>
1335
+ calls?: number | null
1336
+ refunded?: number | null
1337
+ } & InstanceType<TBase>
1338
+ readonly kind: 'entity';
1339
+ readonly keys: __.KeysOf<CardanoAgentGrantUsage>;
1340
+ readonly elements: __.ElementsOf<CardanoAgentGrantUsage>;
1341
+ readonly actions: globalThis.Record<never, never>;
1342
+ };
1343
+ /**
1344
+ * Daily per-action counters of admitted calls under a grant (feeds
1345
+ * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
1346
+ * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
1347
+ * handler then refuses its input. Not exposed as an entity — the function is
1348
+ * the contract. A few dozen rows per grant and day at most; no retention job yet.
1349
+ */
1350
+ export class CardanoAgentGrantUsage extends _CardanoAgentGrantUsageAspect(__.Entity) {
1351
+ }
1352
+ /**
1353
+ * Daily per-action counters of admitted calls under a grant (feeds
1354
+ * CardanoAgentService.GetGrantUsage). Written by the enforcement hook next to
1355
+ * the daily budget: `calls + 1` when a call is admitted, `refunded + 1` when the
1356
+ * handler then refuses its input. Not exposed as an entity — the function is
1357
+ * the contract. A few dozen rows per grant and day at most; no retention job yet.
1358
+ */
1359
+ export class CardanoAgentGrantUsage_ extends Array<CardanoAgentGrantUsage> {
1360
+ $count?: number
1361
+ }
@@ -12,6 +12,15 @@ module.exports.Epochs = createEntityProxy(['odatano.cardano', 'Epochs'], { targe
12
12
  // Pools
13
13
  module.exports.Pool = createEntityProxy(['odatano.cardano', 'Pools'], { target: { is_singular: true } })
14
14
  module.exports.Pools = createEntityProxy(['odatano.cardano', 'Pools'], { target: { is_singular: false }})
15
+ // PoolEpochSnapshots
16
+ module.exports.PoolEpochSnapshot = createEntityProxy(['odatano.cardano', 'PoolEpochSnapshots'], { target: { is_singular: true } })
17
+ module.exports.PoolEpochSnapshots = createEntityProxy(['odatano.cardano', 'PoolEpochSnapshots'], { target: { is_singular: false }})
18
+ // DrepEpochSnapshots
19
+ module.exports.DrepEpochSnapshot = createEntityProxy(['odatano.cardano', 'DrepEpochSnapshots'], { target: { is_singular: true } })
20
+ module.exports.DrepEpochSnapshots = createEntityProxy(['odatano.cardano', 'DrepEpochSnapshots'], { target: { is_singular: false }})
21
+ // EpochLedgerSnapshots
22
+ module.exports.EpochLedgerSnapshot = createEntityProxy(['odatano.cardano', 'EpochLedgerSnapshots'], { target: { is_singular: true } })
23
+ module.exports.EpochLedgerSnapshots = createEntityProxy(['odatano.cardano', 'EpochLedgerSnapshots'], { target: { is_singular: false }})
15
24
  // Assets
16
25
  module.exports.Asset = createEntityProxy(['odatano.cardano', 'Assets'], { target: { is_singular: true } })
17
26
  module.exports.Assets = createEntityProxy(['odatano.cardano', 'Assets'], { target: { is_singular: false }})
@@ -45,6 +54,30 @@ module.exports.TransactionInputs = createEntityProxy(['odatano.cardano', 'Transa
45
54
  // TransactionInputAssets
46
55
  module.exports.TransactionInputAsset = createEntityProxy(['odatano.cardano', 'TransactionInputAssets'], { target: { is_singular: true } })
47
56
  module.exports.TransactionInputAssets = createEntityProxy(['odatano.cardano', 'TransactionInputAssets'], { target: { is_singular: false }})
57
+ // LedgerUTxOs
58
+ module.exports.LedgerUTxO = createEntityProxy(['odatano.cardano', 'LedgerUTxOs'], { target: { is_singular: true } })
59
+ module.exports.LedgerUTxOs = createEntityProxy(['odatano.cardano', 'LedgerUTxOs'], { target: { is_singular: false }})
60
+ // LedgerUTxOAssets
61
+ module.exports.LedgerUTxOAsset = createEntityProxy(['odatano.cardano', 'LedgerUTxOAssets'], { target: { is_singular: true } })
62
+ module.exports.LedgerUTxOAssets = createEntityProxy(['odatano.cardano', 'LedgerUTxOAssets'], { target: { is_singular: false }})
63
+ // LedgerAddresses
64
+ module.exports.LedgerAddress = createEntityProxy(['odatano.cardano', 'LedgerAddresses'], { target: { is_singular: true } })
65
+ module.exports.LedgerAddresses = createEntityProxy(['odatano.cardano', 'LedgerAddresses'], { target: { is_singular: false }})
66
+ // LedgerAddressAssets
67
+ module.exports.LedgerAddressAsset = createEntityProxy(['odatano.cardano', 'LedgerAddressAssets'], { target: { is_singular: true } })
68
+ module.exports.LedgerAddressAssets = createEntityProxy(['odatano.cardano', 'LedgerAddressAssets'], { target: { is_singular: false }})
69
+ // LedgerAccounts
70
+ module.exports.LedgerAccount = createEntityProxy(['odatano.cardano', 'LedgerAccounts'], { target: { is_singular: true } })
71
+ module.exports.LedgerAccounts = createEntityProxy(['odatano.cardano', 'LedgerAccounts'], { target: { is_singular: false }})
72
+ // TransactionCertificates
73
+ module.exports.TransactionCertificate = createEntityProxy(['odatano.cardano', 'TransactionCertificates'], { target: { is_singular: true } })
74
+ module.exports.TransactionCertificates = createEntityProxy(['odatano.cardano', 'TransactionCertificates'], { target: { is_singular: false }})
75
+ // TransactionWithdrawals
76
+ module.exports.TransactionWithdrawal = createEntityProxy(['odatano.cardano', 'TransactionWithdrawals'], { target: { is_singular: true } })
77
+ module.exports.TransactionWithdrawals = createEntityProxy(['odatano.cardano', 'TransactionWithdrawals'], { target: { is_singular: false }})
78
+ // TransactionRedeemers
79
+ module.exports.TransactionRedeemer = createEntityProxy(['odatano.cardano', 'TransactionRedeemers'], { target: { is_singular: true } })
80
+ module.exports.TransactionRedeemers = createEntityProxy(['odatano.cardano', 'TransactionRedeemers'], { target: { is_singular: false }})
48
81
  // TransactionOutputs
49
82
  module.exports.TransactionOutput = createEntityProxy(['odatano.cardano', 'TransactionOutputs'], { target: { is_singular: true } })
50
83
  module.exports.TransactionOutputs = createEntityProxy(['odatano.cardano', 'TransactionOutputs'], { target: { is_singular: false }})
@@ -69,6 +102,9 @@ module.exports.TransactionBuildInputAssets = createEntityProxy(['odatano.cardano
69
102
  // TransactionBuildOutputs
70
103
  module.exports.TransactionBuildOutput = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputs'], { target: { is_singular: true } })
71
104
  module.exports.TransactionBuildOutputs = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputs'], { target: { is_singular: false }})
105
+ // TransactionBuildRedeemers
106
+ module.exports.TransactionBuildRedeemer = createEntityProxy(['odatano.cardano', 'TransactionBuildRedeemers'], { target: { is_singular: true } })
107
+ module.exports.TransactionBuildRedeemers = createEntityProxy(['odatano.cardano', 'TransactionBuildRedeemers'], { target: { is_singular: false }})
72
108
  // TransactionBuildOutputAssets
73
109
  module.exports.TransactionBuildOutputAsset = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputAssets'], { target: { is_singular: true } })
74
110
  module.exports.TransactionBuildOutputAssets = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputAssets'], { target: { is_singular: false }})
@@ -105,6 +141,12 @@ module.exports.CardanoWorkerWallets = createEntityProxy(['odatano.cardano', 'Car
105
141
  // CardanoWalletJobs
106
142
  module.exports.CardanoWalletJob = createEntityProxy(['odatano.cardano', 'CardanoWalletJobs'], { target: { is_singular: true } })
107
143
  module.exports.CardanoWalletJobs = createEntityProxy(['odatano.cardano', 'CardanoWalletJobs'], { target: { is_singular: false }})
144
+ // CardanoAgentGrants
145
+ module.exports.CardanoAgentGrant = createEntityProxy(['odatano.cardano', 'CardanoAgentGrants'], { target: { is_singular: true } })
146
+ module.exports.CardanoAgentGrants = createEntityProxy(['odatano.cardano', 'CardanoAgentGrants'], { target: { is_singular: false }})
147
+ // CardanoAgentGrantUsage
148
+ module.exports.CardanoAgentGrantUsage = createEntityProxy(['odatano.cardano', 'CardanoAgentGrantUsage'], { target: { is_singular: true } })
149
+ module.exports.CardanoAgentGrantUsage_ = createEntityProxy(['odatano.cardano', 'CardanoAgentGrantUsage'], { target: { is_singular: false }})
108
150
  // events
109
151
  // actions
110
152
  // enums
package/README.md CHANGED
@@ -1,4 +1,9 @@
1
- ![alt text](docs/assets/odatano_logo/logo_odatano_white.png)
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/odatano-core-logo-on-dark.svg">
4
+ <img src="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/odatano-core-logo.svg" alt="ODATANO CORE" height="84">
5
+ </picture>
6
+ </p>
2
7
 
3
8
  # Enterprise OData Services for the Cardano Blockchain
4
9
 
@@ -88,16 +93,21 @@ Service available at `http://localhost:4004`. See the [Quick Start Guide](docs/Q
88
93
  > **Heads-up.** `cds serve` uses CAP's mocked auth: `@requires: 'authenticated-user'` accepts any Basic-Auth header against a mock user (`alice`, `bob`, …) — passwords are not checked. Anonymous requests get 401, but anyone reaching the port can authenticate.
89
94
  >
90
95
  > Production needs the `[production]` profile (`NODE_ENV=production`), which switches to `auth: xsuaa`. Don't expose a dev-mode instance. See the [Security Guide](docs/guides/SECURITY_GUIDE.md#authentication-xsuaa).
96
+ >
97
+ > The Docker image runs `NODE_ENV=production` with HTTP basic auth via `@odatano/cap-auth` (`ODATANO_HTTP_PASSWORD` required, user `ODATANO_HTTP_USER` default `odatano`, roles `ODATANO_HTTP_ROLES` default `Admin`; 20 failed attempts per 15 min per client address and user, then 429). `ODATANO_AUTH=dummy` disables authentication for local testing only. `getLiveness()` and `VerifyDataSignature` stay anonymous.
98
+ >
99
+ > Database of the image: `ODATANO_DB_URL=postgres://user:pw@host:5432/db` selects PostgreSQL (schema deployed on every boot); otherwise SQLite at `ODATANO_DB_PATH` (default `/data/db.sqlite`). `docker compose run --rm --no-deps odatano migrate --from /data/db.sqlite` copies an existing SQLite file into a freshly deployed PostgreSQL.
91
100
 
92
101
  ## Services
93
102
 
94
103
  | Service | Path | Purpose |
95
104
  |---|---|---|
96
- | CardanoODataService | `/odata/v4/cardano-odata/` | Read blockchain data (20 entities, 19 actions) |
105
+ | CardanoODataService | `/odata/v4/cardano/` | Read blockchain data (29 entities, 19 actions) |
97
106
  | CardanoTransactionService | `/odata/v4/cardano-transaction/` | Build & submit transactions (13 actions) |
98
107
  | CardanoSignService | `/odata/v4/cardano-sign/` | External signing + HSM (9 actions) |
99
108
  | CardanoIndexerService | `/odata/v4/cardano-indexer/` | Chain crawler / pre-sync control (v2.0, off by default) |
100
109
  | CardanoWorkerService | `/odata/v4/cardano-worker/` | Asynchronous wallet jobs (v2.0, off by default) |
110
+ | CardanoAgentService | `/odata/v4/cardano-agent/` | Agent grants: scoped bearer tokens for agents (v2.0, off by default) |
101
111
 
102
112
  Both v2.0 services also publish **CAP events**, so a consumer can subscribe instead of polling —
103
113
  in-process, no broker required:
@@ -107,12 +117,61 @@ in-process, no broker required:
107
117
  (await cds.connect.to('CardanoIndexerService')).on('blockIndexed', ({ data }) => …)
108
118
  ```
109
119
 
120
+ ## Agent grants (v2.0, off by default)
121
+
122
+ Hand an agent a **scoped, budgeted token** instead of a user.
123
+
124
+ ```bash
125
+ AGENT_GRANTS_ENABLED=true # or cds.requires.odatano-core.agentGrants.enabled
126
+ AGENT_GRANTS_DELEGATE=mocked # CAP auth kind that keeps authenticating non-token requests (default: configured kind)
127
+ AGENT_GRANT_ADMIN_RATE_LIMIT=10 # grant administration calls per principal per hour (or agentGrants.adminRateLimit)
128
+ AGENT_TOKEN_CACHE_MS=10000 # a resolved token is reused this long before the row is read again; 0 = off (or agentGrants.tokenCacheMs)
129
+ ```
130
+
131
+ 1. An **Admin** issues a grant (`POST /odata/v4/cardano-agent/CreateAgentGrant`): an allow list of
132
+ actions, optionally a worker `walletId` (required for `SubmitWalletJob`/`CancelJob`), allowed job
133
+ kinds, a daily budget and an expiry. The response carries the token `odat_…` **once**; the
134
+ server stores only its SHA-256.
135
+ 2. The agent sends `x-agent-token: odat_…` on any of the six service paths. It runs as the principal
136
+ `agent:<grantId>` with the single role `agent-grant`, never as the operator: every
137
+ `@requires: 'Admin'` surface (pause/resume, HSM signing, grant administration) refuses it by
138
+ construction. Reads and compute-only actions are always allowed; allow-listed actions each cost
139
+ one budget unit per UTC day (a build is the service an agent buys); everything else is 403.
140
+ Wallet jobs are pinned to the grant's wallet and visible only to the grant that queued them.
141
+ 3. `GET /odata/v4/cardano-agent/GetGrantStatus()` tells the agent what it may do and how much budget
142
+ is left; `RevokeAgentGrant` turns the token into an unknown token immediately.
143
+ 4. Lifecycle (Admin; the same semantics as the gateway's peer services, so one client drives
144
+ them all): `UpdateAgentGrant` changes label, allow list, job kinds, daily budget or expiry
145
+ (absent = untouched, explicit `null` = cleared; the wallet binding is immutable, 409
146
+ `GRANT_REVOKED` on a revoked grant); `RotateAgentGrantToken` returns a fresh token once, the old
147
+ one is unknown from the next request; `GetGrantUsage(grantId, since, until)` lists admitted calls
148
+ per service and action over up to 366 days (an Admin for any grant, a token for its own). All
149
+ administration calls share the per-principal hourly rate limit above.
150
+
151
+ Grantable: `Build*`, `SetCollateral`, `CreateSigningRequest`, `VerifySignature`, `Submit*`,
152
+ `CheckSubmissionStatus`, `SubmitWalletJob`, `CancelJob`. Never: `SignWithHsm*`, `Pause*`/`Resume*`,
153
+ `pauseCrawler`/`resumeCrawler`, grant administration.
154
+
155
+ Programmatic seams for other packages (`@odatano/x402` sells grants against a 402 payment):
156
+ `issueAgentGrant()`, `updateAgentGrant()`, `rotateAgentGrantToken()`, `revokeAgentGrantById()`,
157
+ `getGrantUsage()`, `registerTransportLane()` from `@odatano/core`.
158
+
159
+ ## Liveness probe
160
+
161
+ `GET /odata/v4/cardano-indexer/getLiveness()` answers `200 { status: "alive", timestamp, uptime,
162
+ version, network }` **without credentials** (`@requires: 'any'`) as long as the process runs — no
163
+ backend or DB probe, no secrets. The Docker `HEALTHCHECK`, compose and upstream probes use it
164
+ instead of the service document, so a wrong operator password no longer reads as "ODATANO down".
165
+ Readiness (crawler, worker, backends) stays authenticated: `getStatus()`, `GetWorkerStatus()`,
166
+ `GetNetworkInformation`.
167
+
110
168
  ## Requirements
111
169
 
112
170
  - **Node.js >= 22.5** and **@sap/cds >= 10** (peer dependency). CAP 9 hosts cannot load `@odatano/core@2`.
113
- - Upgrading a consumer from 1.x: run **`cds deploy`**. 2.0 adds four tables (`CardanoSyncState`,
114
- `CardanoReorgLog`, `CardanoWorkerWallets`, `CardanoWalletJobs`) plus a `dedupKey` column; without
115
- the redeploy the new services answer `no such table` while the old ones keep working.
171
+ - Upgrading a consumer from 1.x: run **`cds deploy`**. 2.0 adds six tables (`CardanoSyncState`,
172
+ `CardanoReorgLog`, `CardanoWorkerWallets`, `CardanoWalletJobs`, `CardanoAgentGrants`,
173
+ `CardanoAgentGrantUsage`) plus a `dedupKey` column; without the redeploy the new services answer
174
+ `no such table` while the old ones keep working.
116
175
 
117
176
  ## Documentation
118
177