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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/@cds-models/CardanoAgentService/index.d.ts +99 -51
  2. package/@cds-models/CardanoAgentService/index.js +15 -0
  3. package/@cds-models/CardanoBackendService/index.d.ts +347 -0
  4. package/@cds-models/CardanoBackendService/index.js +40 -0
  5. package/@cds-models/CardanoIndexerService/index.d.ts +496 -11
  6. package/@cds-models/CardanoIndexerService/index.js +64 -0
  7. package/@cds-models/CardanoODataService/index.d.ts +414 -57
  8. package/@cds-models/CardanoODataService/index.js +42 -0
  9. package/@cds-models/CardanoSignService/index.d.ts +32 -19
  10. package/@cds-models/CardanoSignService/index.js +3 -0
  11. package/@cds-models/CardanoTransactionService/index.d.ts +58 -44
  12. package/@cds-models/CardanoTransactionService/index.js +4 -0
  13. package/@cds-models/CardanoWorkerService/index.d.ts +7 -22
  14. package/@cds-models/index.d.ts +101 -1
  15. package/@cds-models/index.js +16 -1
  16. package/@cds-models/odatano/cardano/index.d.ts +437 -32
  17. package/@cds-models/odatano/cardano/index.js +48 -0
  18. package/README.md +207 -167
  19. package/db/schema.cds +2402 -1705
  20. package/db/types.cds +446 -295
  21. package/package.json +41 -16
  22. package/scripts/migrate-schema.mjs +334 -0
  23. package/scripts/migrate-slot-leader.mjs +96 -0
  24. package/src/index.d.ts +20 -21
  25. package/src/index.js +45 -31
  26. package/src/plugin.js +17 -35
  27. package/srv/blockchain/asset-decimals.d.ts +7 -0
  28. package/srv/blockchain/asset-decimals.js +91 -0
  29. package/srv/blockchain/backends/blockfrost-backend.d.ts +25 -135
  30. package/srv/blockchain/backends/blockfrost-backend.js +66 -172
  31. package/srv/blockchain/backends/cardano-backend.d.ts +94 -186
  32. package/srv/blockchain/backends/cardano-backend.js +29 -5
  33. package/srv/blockchain/backends/koios-backend.d.ts +103 -168
  34. package/srv/blockchain/backends/koios-backend.js +428 -360
  35. package/srv/blockchain/backends/odatano-backend.d.ts +54 -0
  36. package/srv/blockchain/backends/odatano-backend.js +169 -0
  37. package/srv/blockchain/backends/ogmios-backend.d.ts +123 -190
  38. package/srv/blockchain/backends/ogmios-backend.js +637 -315
  39. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +14 -0
  40. package/srv/blockchain/backends/ogmios-frame-guard.js +89 -0
  41. package/srv/blockchain/cardano-client.d.ts +61 -241
  42. package/srv/blockchain/cardano-client.js +253 -293
  43. package/srv/blockchain/cardano-indexer.d.ts +282 -281
  44. package/srv/blockchain/cardano-indexer.js +1551 -484
  45. package/srv/blockchain/cardano-tx-builder.d.ts +25 -89
  46. package/srv/blockchain/cardano-tx-builder.js +164 -140
  47. package/srv/blockchain/circuit-breaker.d.ts +1 -13
  48. package/srv/blockchain/circuit-breaker.js +5 -15
  49. package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
  50. package/srv/blockchain/crawler/account-snapshots.js +153 -0
  51. package/srv/blockchain/crawler/asset-decimals-backfill.d.ts +15 -0
  52. package/srv/blockchain/crawler/asset-decimals-backfill.js +56 -0
  53. package/srv/blockchain/crawler/asset-registry-backfill.d.ts +43 -0
  54. package/srv/blockchain/crawler/asset-registry-backfill.js +153 -0
  55. package/srv/blockchain/crawler/certificate-backfill.d.ts +52 -0
  56. package/srv/blockchain/crawler/certificate-backfill.js +162 -0
  57. package/srv/blockchain/crawler/crawler.d.ts +104 -81
  58. package/srv/blockchain/crawler/crawler.js +532 -160
  59. package/srv/blockchain/crawler/credential-backfill.d.ts +28 -0
  60. package/srv/blockchain/crawler/credential-backfill.js +124 -0
  61. package/srv/blockchain/crawler/hooks.d.ts +2 -17
  62. package/srv/blockchain/crawler/index.d.ts +1 -8
  63. package/srv/blockchain/crawler/index.js +31 -17
  64. package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
  65. package/srv/blockchain/crawler/input-asset-copies.js +171 -0
  66. package/srv/blockchain/crawler/metadata-position-backfill.d.ts +16 -0
  67. package/srv/blockchain/crawler/metadata-position-backfill.js +55 -0
  68. package/srv/blockchain/crawler/output-datum-backfill.d.ts +39 -0
  69. package/srv/blockchain/crawler/output-datum-backfill.js +110 -0
  70. package/srv/blockchain/crawler/sync-state.d.ts +27 -47
  71. package/srv/blockchain/crawler/sync-state.js +113 -63
  72. package/srv/blockchain/crawler/transaction-backfill.d.ts +44 -0
  73. package/srv/blockchain/crawler/transaction-backfill.js +278 -0
  74. package/srv/blockchain/crawler/utxo-set-import.d.ts +66 -0
  75. package/srv/blockchain/crawler/utxo-set-import.js +399 -0
  76. package/srv/blockchain/ledger-state.d.ts +62 -0
  77. package/srv/blockchain/ledger-state.js +419 -0
  78. package/srv/blockchain/pending-spends.d.ts +16 -0
  79. package/srv/blockchain/pending-spends.js +81 -0
  80. package/srv/blockchain/pool-metadata.d.ts +15 -0
  81. package/srv/blockchain/pool-metadata.js +132 -0
  82. package/srv/blockchain/request-coalescer.d.ts +2 -16
  83. package/srv/blockchain/request-coalescer.js +2 -16
  84. package/srv/blockchain/signing/cose-verifier.d.ts +3 -17
  85. package/srv/blockchain/signing/cose-verifier.js +146 -70
  86. package/srv/blockchain/signing/external-signer.d.ts +15 -115
  87. package/srv/blockchain/signing/external-signer.js +17 -126
  88. package/srv/blockchain/signing/hsm-signer.d.ts +10 -54
  89. package/srv/blockchain/signing/hsm-signer.js +28 -79
  90. package/srv/blockchain/signing/signature-verifier.d.ts +9 -47
  91. package/srv/blockchain/signing/signature-verifier.js +70 -83
  92. package/srv/blockchain/signing/submission-finalizer.d.ts +23 -45
  93. package/srv/blockchain/signing/submission-finalizer.js +219 -86
  94. package/srv/blockchain/stored-chain.d.ts +20 -0
  95. package/srv/blockchain/stored-chain.js +237 -0
  96. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +31 -229
  97. package/srv/blockchain/transaction-building/buildooor-tx.js +652 -416
  98. package/srv/blockchain/transaction-building/cardano-tx.d.ts +9 -37
  99. package/srv/blockchain/transaction-presence.d.ts +5 -0
  100. package/srv/blockchain/transaction-presence.js +29 -0
  101. package/srv/blockchain/transaction-rows.d.ts +12 -0
  102. package/srv/blockchain/transaction-rows.js +44 -0
  103. package/srv/blockchain/wallet-worker/build-request.d.ts +5 -20
  104. package/srv/blockchain/wallet-worker/build-request.js +47 -30
  105. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +5 -46
  106. package/srv/blockchain/wallet-worker/confirmation-tracker.js +25 -45
  107. package/srv/blockchain/wallet-worker/index.d.ts +1 -1
  108. package/srv/blockchain/wallet-worker/index.js +3 -11
  109. package/srv/blockchain/wallet-worker/job-store.d.ts +30 -148
  110. package/srv/blockchain/wallet-worker/job-store.js +101 -201
  111. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +2 -26
  112. package/srv/blockchain/wallet-worker/lease-heartbeat.js +6 -28
  113. package/srv/blockchain/wallet-worker/signers.d.ts +5 -24
  114. package/srv/blockchain/wallet-worker/signers.js +4 -12
  115. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +8 -80
  116. package/srv/blockchain/wallet-worker/wallet-worker.js +107 -155
  117. package/srv/cardano-agent-service.cds +122 -84
  118. package/srv/cardano-agent-service.js +4 -9
  119. package/srv/cardano-backend-service.cds +78 -0
  120. package/srv/cardano-backend-service.d.ts +2 -0
  121. package/srv/cardano-backend-service.js +242 -0
  122. package/srv/cardano-indexer-service.cds +387 -73
  123. package/srv/cardano-indexer-service.d.ts +5 -1
  124. package/srv/cardano-indexer-service.js +532 -16
  125. package/srv/cardano-service.cds +424 -269
  126. package/srv/cardano-service.js +289 -201
  127. package/srv/cardano-sign-service.cds +201 -180
  128. package/srv/cardano-sign-service.js +71 -201
  129. package/srv/cardano-tx-service.cds +451 -370
  130. package/srv/cardano-tx-service.js +271 -289
  131. package/srv/cardano-ui.cds +16 -16
  132. package/srv/cardano-worker-service.cds +118 -125
  133. package/srv/cardano-worker-service.js +52 -61
  134. package/srv/cbor/cip68.d.ts +13 -0
  135. package/srv/cbor/cip68.js +56 -0
  136. package/srv/cbor/index.d.ts +3 -1
  137. package/srv/cbor/index.js +9 -1
  138. package/srv/cbor/parse.d.ts +30 -18
  139. package/srv/cbor/parse.js +44 -9
  140. package/srv/cbor/plutus-data-json.d.ts +20 -0
  141. package/srv/cbor/plutus-data-json.js +32 -0
  142. package/srv/config.d.ts +113 -0
  143. package/srv/config.js +409 -0
  144. package/srv/server.d.ts +15 -110
  145. package/srv/server.js +84 -404
  146. package/srv/utils/agent-access.d.ts +9 -0
  147. package/srv/utils/agent-access.js +67 -0
  148. package/srv/utils/agent-grants-config.d.ts +0 -46
  149. package/srv/utils/agent-grants-config.js +17 -85
  150. package/srv/utils/agent-grants.d.ts +106 -122
  151. package/srv/utils/agent-grants.js +538 -236
  152. package/srv/utils/agent-token-auth.d.ts +4 -99
  153. package/srv/utils/agent-token-auth.js +18 -182
  154. package/srv/utils/backend-request-handler.d.ts +3 -17
  155. package/srv/utils/backend-request-handler.js +3 -18
  156. package/srv/utils/collections.d.ts +3 -10
  157. package/srv/utils/collections.js +3 -10
  158. package/srv/utils/const.d.ts +23 -74
  159. package/srv/utils/const.js +32 -79
  160. package/srv/utils/crypto.d.ts +3 -12
  161. package/srv/utils/crypto.js +6 -21
  162. package/srv/utils/db-indexes.d.ts +27 -0
  163. package/srv/utils/db-indexes.js +120 -0
  164. package/srv/utils/db-sanitize.d.ts +20 -0
  165. package/srv/utils/db-sanitize.js +80 -0
  166. package/srv/utils/deep-json.d.ts +6 -0
  167. package/srv/utils/deep-json.js +240 -0
  168. package/srv/utils/epoch-slots.d.ts +13 -0
  169. package/srv/utils/epoch-slots.js +38 -0
  170. package/srv/utils/error-codes.d.ts +22 -75
  171. package/srv/utils/error-codes.js +23 -72
  172. package/srv/utils/errors.d.ts +46 -187
  173. package/srv/utils/errors.js +114 -230
  174. package/srv/utils/liveness.d.ts +12 -0
  175. package/srv/utils/liveness.js +35 -0
  176. package/srv/utils/mappers.d.ts +102 -223
  177. package/srv/utils/mappers.js +387 -316
  178. package/srv/utils/network-context.js +2 -13
  179. package/srv/utils/paging.d.ts +31 -0
  180. package/srv/utils/paging.js +43 -0
  181. package/srv/utils/pg-inline-json.d.ts +8 -0
  182. package/srv/utils/pg-inline-json.js +58 -0
  183. package/srv/utils/pg-order-nulls.d.ts +14 -0
  184. package/srv/utils/pg-order-nulls.js +54 -0
  185. package/srv/utils/plutus-placeholders.d.ts +16 -22
  186. package/srv/utils/plutus-placeholders.js +62 -33
  187. package/srv/utils/rate-limiter.d.ts +2 -21
  188. package/srv/utils/rate-limiter.js +5 -17
  189. package/srv/utils/readiness.d.ts +12 -0
  190. package/srv/utils/readiness.js +29 -0
  191. package/srv/utils/reference-script.d.ts +19 -0
  192. package/srv/utils/reference-script.js +84 -0
  193. package/srv/utils/result-numbers.d.ts +15 -0
  194. package/srv/utils/result-numbers.js +61 -0
  195. package/srv/utils/service-events.d.ts +0 -24
  196. package/srv/utils/service-events.js +3 -25
  197. package/srv/utils/signing-helper.d.ts +3 -20
  198. package/srv/utils/signing-helper.js +35 -64
  199. package/srv/utils/tx-build-helper.d.ts +10 -105
  200. package/srv/utils/tx-build-helper.js +81 -144
  201. package/srv/utils/tx-request-parsers.d.ts +82 -33
  202. package/srv/utils/tx-request-parsers.js +401 -49
  203. package/srv/utils/tx-utils.d.ts +3 -27
  204. package/srv/utils/tx-utils.js +32 -50
  205. package/srv/utils/types.d.ts +261 -191
  206. package/srv/utils/types.js +2 -6
  207. package/srv/utils/validators.d.ts +22 -92
  208. package/srv/utils/validators.js +50 -149
@@ -12,6 +12,18 @@ 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 }})
24
+ // AccountEpochSnapshots
25
+ module.exports.AccountEpochSnapshot = createEntityProxy(['odatano.cardano', 'AccountEpochSnapshots'], { target: { is_singular: true } })
26
+ module.exports.AccountEpochSnapshots = createEntityProxy(['odatano.cardano', 'AccountEpochSnapshots'], { target: { is_singular: false }})
15
27
  // Assets
16
28
  module.exports.Asset = createEntityProxy(['odatano.cardano', 'Assets'], { target: { is_singular: true } })
17
29
  module.exports.Assets = createEntityProxy(['odatano.cardano', 'Assets'], { target: { is_singular: false }})
@@ -42,9 +54,39 @@ module.exports.Transactions = createEntityProxy(['odatano.cardano', 'Transaction
42
54
  // TransactionInputs
43
55
  module.exports.TransactionInput = createEntityProxy(['odatano.cardano', 'TransactionInputs'], { target: { is_singular: true } })
44
56
  module.exports.TransactionInputs = createEntityProxy(['odatano.cardano', 'TransactionInputs'], { target: { is_singular: false }})
57
+ // TransactionInputAssetCopies
58
+ module.exports.TransactionInputAssetCopy = createEntityProxy(['odatano.cardano', 'TransactionInputAssetCopies'], { target: { is_singular: true } })
59
+ module.exports.TransactionInputAssetCopies = createEntityProxy(['odatano.cardano', 'TransactionInputAssetCopies'], { target: { is_singular: false }})
45
60
  // TransactionInputAssets
46
61
  module.exports.TransactionInputAsset = createEntityProxy(['odatano.cardano', 'TransactionInputAssets'], { target: { is_singular: true } })
47
62
  module.exports.TransactionInputAssets = createEntityProxy(['odatano.cardano', 'TransactionInputAssets'], { target: { is_singular: false }})
63
+ // LedgerUTxOs
64
+ module.exports.LedgerUTxO = createEntityProxy(['odatano.cardano', 'LedgerUTxOs'], { target: { is_singular: true } })
65
+ module.exports.LedgerUTxOs = createEntityProxy(['odatano.cardano', 'LedgerUTxOs'], { target: { is_singular: false }})
66
+ // LedgerUTxOAssets
67
+ module.exports.LedgerUTxOAsset = createEntityProxy(['odatano.cardano', 'LedgerUTxOAssets'], { target: { is_singular: true } })
68
+ module.exports.LedgerUTxOAssets = createEntityProxy(['odatano.cardano', 'LedgerUTxOAssets'], { target: { is_singular: false }})
69
+ // LedgerAddresses
70
+ module.exports.LedgerAddress = createEntityProxy(['odatano.cardano', 'LedgerAddresses'], { target: { is_singular: true } })
71
+ module.exports.LedgerAddresses = createEntityProxy(['odatano.cardano', 'LedgerAddresses'], { target: { is_singular: false }})
72
+ // LedgerAddressAssets
73
+ module.exports.LedgerAddressAsset = createEntityProxy(['odatano.cardano', 'LedgerAddressAssets'], { target: { is_singular: true } })
74
+ module.exports.LedgerAddressAssets = createEntityProxy(['odatano.cardano', 'LedgerAddressAssets'], { target: { is_singular: false }})
75
+ // LedgerAccounts
76
+ module.exports.LedgerAccount = createEntityProxy(['odatano.cardano', 'LedgerAccounts'], { target: { is_singular: true } })
77
+ module.exports.LedgerAccounts = createEntityProxy(['odatano.cardano', 'LedgerAccounts'], { target: { is_singular: false }})
78
+ // TransactionCertificates
79
+ module.exports.TransactionCertificate = createEntityProxy(['odatano.cardano', 'TransactionCertificates'], { target: { is_singular: true } })
80
+ module.exports.TransactionCertificates = createEntityProxy(['odatano.cardano', 'TransactionCertificates'], { target: { is_singular: false }})
81
+ // TransactionWithdrawals
82
+ module.exports.TransactionWithdrawal = createEntityProxy(['odatano.cardano', 'TransactionWithdrawals'], { target: { is_singular: true } })
83
+ module.exports.TransactionWithdrawals = createEntityProxy(['odatano.cardano', 'TransactionWithdrawals'], { target: { is_singular: false }})
84
+ // TransactionRedeemers
85
+ module.exports.TransactionRedeemer = createEntityProxy(['odatano.cardano', 'TransactionRedeemers'], { target: { is_singular: true } })
86
+ module.exports.TransactionRedeemers = createEntityProxy(['odatano.cardano', 'TransactionRedeemers'], { target: { is_singular: false }})
87
+ // TransactionDatums
88
+ module.exports.TransactionDatum = createEntityProxy(['odatano.cardano', 'TransactionDatums'], { target: { is_singular: true } })
89
+ module.exports.TransactionDatums = createEntityProxy(['odatano.cardano', 'TransactionDatums'], { target: { is_singular: false }})
48
90
  // TransactionOutputs
49
91
  module.exports.TransactionOutput = createEntityProxy(['odatano.cardano', 'TransactionOutputs'], { target: { is_singular: true } })
50
92
  module.exports.TransactionOutputs = createEntityProxy(['odatano.cardano', 'TransactionOutputs'], { target: { is_singular: false }})
@@ -69,6 +111,9 @@ module.exports.TransactionBuildInputAssets = createEntityProxy(['odatano.cardano
69
111
  // TransactionBuildOutputs
70
112
  module.exports.TransactionBuildOutput = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputs'], { target: { is_singular: true } })
71
113
  module.exports.TransactionBuildOutputs = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputs'], { target: { is_singular: false }})
114
+ // TransactionBuildRedeemers
115
+ module.exports.TransactionBuildRedeemer = createEntityProxy(['odatano.cardano', 'TransactionBuildRedeemers'], { target: { is_singular: true } })
116
+ module.exports.TransactionBuildRedeemers = createEntityProxy(['odatano.cardano', 'TransactionBuildRedeemers'], { target: { is_singular: false }})
72
117
  // TransactionBuildOutputAssets
73
118
  module.exports.TransactionBuildOutputAsset = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputAssets'], { target: { is_singular: true } })
74
119
  module.exports.TransactionBuildOutputAssets = createEntityProxy(['odatano.cardano', 'TransactionBuildOutputAssets'], { target: { is_singular: false }})
@@ -108,6 +153,9 @@ module.exports.CardanoWalletJobs = createEntityProxy(['odatano.cardano', 'Cardan
108
153
  // CardanoAgentGrants
109
154
  module.exports.CardanoAgentGrant = createEntityProxy(['odatano.cardano', 'CardanoAgentGrants'], { target: { is_singular: true } })
110
155
  module.exports.CardanoAgentGrants = createEntityProxy(['odatano.cardano', 'CardanoAgentGrants'], { target: { is_singular: false }})
156
+ // CardanoAgentGrantUsage
157
+ module.exports.CardanoAgentGrantUsage = createEntityProxy(['odatano.cardano', 'CardanoAgentGrantUsage'], { target: { is_singular: true } })
158
+ module.exports.CardanoAgentGrantUsage_ = createEntityProxy(['odatano.cardano', 'CardanoAgentGrantUsage'], { target: { is_singular: false }})
111
159
  // events
112
160
  // actions
113
161
  // enums
package/README.md CHANGED
@@ -1,167 +1,207 @@
1
- ![alt text](docs/assets/odatano_logo/logo_odatano_white.png)
2
-
3
- # Enterprise OData Services for the Cardano Blockchain
4
-
5
- Funded by [Cardano Catalyst Fund 14](https://projectcatalyst.io/funds/14/sponsored-by-leftovers/sap-cardano-odata-v4-api-with-cap-and-sap-cardano-sdk) all four milestones completed and approved (April 2026).
6
-
7
- **ODATANO** is an SAP CAP–based service that exposes the Cardano blockchain via a standardized **OData V4** interface, enabling enterprise-grade read and write access with native transaction building.
8
-
9
- [![Tests](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml/badge.svg)](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml)
10
- [![Coverage](https://codecov.io/gh/ODATANO/ODATANO/branch/main/graph/badge.svg)](https://codecov.io/gh/ODATANO/ODATANO)
11
- [![npm version](https://img.shields.io/npm/v/@odatano/core?logo=npm)](https://www.npmjs.com/package/@odatano/core)
12
- [![npm downloads](https://img.shields.io/npm/dt/@odatano/core?logo=npm&label=downloads&color=blue)](https://www.npmjs.com/package/@odatano/core)
13
- [![License](https://img.shields.io/badge/license-Apache%202.0-yellow)](LICENSE)
14
-
15
-
16
- ## Quick Start
17
-
18
- ### As CAP Plugin (recommended)
19
-
20
- Add ODATANO to any existing SAP CAP project:
21
-
22
- ```bash
23
- npm install @odatano/core @cap-js/sqlite
24
- ```
25
-
26
- ```json
27
- {
28
- "cds": {
29
- "requires": {
30
- "db": { "kind": "sqlite" },
31
- "odatano-core": {
32
- "network": "preview",
33
- "backends": ["blockfrost"]
34
- }
35
- }
36
- }
37
- }
38
- ```
39
-
40
- Put your API key in a `.env` file in the project root (loaded automatically by `cds serve` / `cds watch`) — don't commit it to `package.json`:
41
-
42
- ```bash
43
- # .env
44
- BLOCKFROST_API_KEY=preview_your_api_key_here
45
- ```
46
-
47
- ```bash
48
- cds deploy --to sqlite
49
- cds serve
50
- ```
51
-
52
- > Config in `cds.requires.odatano-core` takes precedence over environment
53
- > variables; a `blockfrostApiKey` set there would override the `.env` value.
54
-
55
- > **Self-hosted Blockfrost-compatible node?** (Dolos MiniBF, Demeter Self-Hosted)
56
- > Set `blockfrostCustomBackend` to the node's base URL (e.g. `http://localhost:3010/api/v0`).
57
- > When set, `blockfrostApiKey` becomes optional. See the [Backend Configuration Guide](docs/guides/BACKEND_CONFIGURATION.md#self-hosted-blockfrost-compatible-backends).
58
-
59
- ### Standalone
60
-
61
- Run ODATANO as a self-contained service (no host CAP project needed):
62
-
63
- ```bash
64
- git clone https://github.com/ODATANO/ODATANO && cd ODATANO
65
- npm ci
66
- cp .env.example .env # set BLOCKFROST_API_KEY, NETWORK, BACKENDS
67
- cds deploy --to sqlite
68
- cds serve
69
- ```
70
-
71
- Or with Docker — this brings up a local **cardano-node + Ogmios + ODATANO** stack
72
- (Preview), with the service pre-wired to the local Ogmios backend:
73
-
74
- ```bash
75
- docker compose up -d # full stack
76
- docker compose up -d cardano-node ogmios # just the chain backend (pre-sync)
77
- docker compose logs -f ogmios # watch sync (/health: 202 syncing, 200 near tip)
78
- ```
79
-
80
- > First sync from genesis takes hours; the node DB persists in a Docker volume so
81
- > restarts resume. Until Ogmios catches up, historical queries fall back to
82
- > Blockfrost (set `BLOCKFROST_API_KEY`).
83
-
84
- Service available at `http://localhost:4004`. See the [Quick Start Guide](docs/QUICK_START.md#local-ogmios--cardano-node-docker) for the local Ogmios stack and full details.
85
-
86
- ## Dev Mode: Mocked Authentication
87
-
88
- > **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
- >
90
- > 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).
91
-
92
- ## Services
93
-
94
- | Service | Path | Purpose |
95
- |---|---|---|
96
- | CardanoODataService | `/odata/v4/cardano-odata/` | Read blockchain data (20 entities, 19 actions) |
97
- | CardanoTransactionService | `/odata/v4/cardano-transaction/` | Build & submit transactions (13 actions) |
98
- | CardanoSignService | `/odata/v4/cardano-sign/` | External signing + HSM (9 actions) |
99
- | CardanoIndexerService | `/odata/v4/cardano-indexer/` | Chain crawler / pre-sync control (v2.0, off by default) |
100
- | CardanoWorkerService | `/odata/v4/cardano-worker/` | Asynchronous wallet jobs (v2.0, off by default) |
101
- | CardanoAgentService | `/odata/v4/cardano-agent/` | Agent grants: scoped bearer tokens for agents (v2.0, off by default) |
102
-
103
- Both v2.0 services also publish **CAP events**, so a consumer can subscribe instead of polling —
104
- in-process, no broker required:
105
-
106
- ```js
107
- (await cds.connect.to('CardanoWorkerService')).on('jobConfirmed', ({ data }) => …)
108
- (await cds.connect.to('CardanoIndexerService')).on('blockIndexed', ({ data }) => …)
109
- ```
110
-
111
- ## Agent grants (v2.0, off by default)
112
-
113
- Hand an agent a **scoped, budgeted token** instead of a user. Design and rationale:
114
- [AGENT_GRANTS_DESIGN.md](AGENT_GRANTS_DESIGN.md).
115
-
116
- ```bash
117
- AGENT_GRANTS_ENABLED=true # or cds.requires.odatano-core.agentGrants.enabled
118
- AGENT_GRANTS_DELEGATE=mocked # CAP auth kind that keeps authenticating non-token requests (default: configured kind)
119
- ```
120
-
121
- 1. An **Admin** issues a grant (`POST /odata/v4/cardano-agent/CreateAgentGrant`): an allow list of
122
- actions, optionally a worker `walletId` (required for `SubmitWalletJob`/`CancelJob`), allowed job
123
- kinds, a daily budget and an expiry. The response carries the token `odat_…` **once**; the
124
- server stores only its SHA-256.
125
- 2. The agent sends `x-agent-token: odat_…` on any of the six service paths. It runs as the principal
126
- `agent:<grantId>` with the single role `agent-grant`, never as the operator: every
127
- `@requires: 'Admin'` surface (pause/resume, HSM signing, grant administration) refuses it by
128
- construction. Reads and compute-only actions are always allowed; allow-listed actions each cost
129
- one budget unit per UTC day (a build is the service an agent buys); everything else is 403.
130
- Wallet jobs are pinned to the grant's wallet and visible only to the grant that queued them.
131
- 3. `GET /odata/v4/cardano-agent/GetGrantStatus()` tells the agent what it may do and how much budget
132
- is left; `RevokeAgentGrant` turns the token into an unknown token immediately.
133
-
134
- Grantable: `Build*`, `SetCollateral`, `CreateSigningRequest`, `VerifySignature`, `Submit*`,
135
- `CheckSubmissionStatus`, `SubmitWalletJob`, `CancelJob`. Never: `SignWithHsm*`, `Pause*`/`Resume*`,
136
- `pauseCrawler`/`resumeCrawler`, grant administration.
137
-
138
- Programmatic seams for other packages (`@odatano/x402` sells grants against a 402 payment):
139
- `issueAgentGrant()`, `revokeAgentGrantById()`, `registerTransportLane()` from `@odatano/core`.
140
-
141
- ## Requirements
142
-
143
- - **Node.js >= 22.5** and **@sap/cds >= 10** (peer dependency). CAP 9 hosts cannot load `@odatano/core@2`.
144
- - Upgrading a consumer from 1.x: run **`cds deploy`**. 2.0 adds four tables (`CardanoSyncState`,
145
- `CardanoReorgLog`, `CardanoWorkerWallets`, `CardanoWalletJobs`) plus a `dedupKey` column; without
146
- the redeploy the new services answer `no such table` while the old ones keep working.
147
-
148
- ## Documentation
149
-
150
- | Guide | Description |
151
- |-------|-------------|
152
- | [Quick Start](docs/QUICK_START.md) | Get running in 5 minutes |
153
- | [User Guide](docs/guides/USER_GUIDE.md) | API usage, entities, and examples |
154
- | [Developer Guide](docs/guides/DEVELOPER_GUIDE.md) | Architecture and development |
155
- | [Transaction Workflow](docs/guides/TRANSACTION_WORKFLOW.md) | Build → Sign → Submit flow |
156
- | [Security Guide](docs/guides/SECURITY_GUIDE.md) | Authentication, signing security, HSM |
157
- | [Docker Deployment](docs/guides/DOCKER_DEPLOYMENT.md) | Container deployment |
158
-
159
- ## License
160
-
161
- Apache License 2.0 - see [LICENSE](LICENSE)
162
-
163
- ## Support
164
-
165
- - **Issues**: [GitHub Issues](https://github.com/ODATANO/ODATANO/issues)
166
- - **Project Lead**: Max Weber
167
- - **Contact**: info@odatano.dev
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>
7
+
8
+ # Enterprise OData Services for the Cardano Blockchain
9
+
10
+ Funded by [Cardano Catalyst Fund 14](https://projectcatalyst.io/funds/14/sponsored-by-leftovers/sap-cardano-odata-v4-api-with-cap-and-sap-cardano-sdk) all four milestones completed and approved (April 2026).
11
+
12
+ **ODATANO** is an SAP CAP–based service that exposes the Cardano blockchain via a standardized **OData V4** interface, enabling enterprise-grade read and write access with native transaction building.
13
+
14
+ [![Tests](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml/badge.svg)](https://github.com/ODATANO/ODATANO/actions/workflows/test.yaml)
15
+ [![Coverage](https://codecov.io/gh/ODATANO/ODATANO/branch/main/graph/badge.svg)](https://codecov.io/gh/ODATANO/ODATANO)
16
+ [![npm version](https://img.shields.io/npm/v/@odatano/core?logo=npm)](https://www.npmjs.com/package/@odatano/core)
17
+ [![npm downloads](https://img.shields.io/npm/dt/@odatano/core?logo=npm&label=downloads&color=blue)](https://www.npmjs.com/package/@odatano/core)
18
+ [![License](https://img.shields.io/badge/license-Apache%202.0-yellow)](LICENSE)
19
+
20
+
21
+ ## Quick Start
22
+
23
+ ### As CAP Plugin (recommended)
24
+
25
+ Add ODATANO to any existing SAP CAP project:
26
+
27
+ ```bash
28
+ npm install @odatano/core @cap-js/sqlite
29
+ ```
30
+
31
+ ```json
32
+ {
33
+ "cds": {
34
+ "requires": {
35
+ "db": { "kind": "sqlite" },
36
+ "auth": { "users": { "alice": { "roles": ["Read", "Transact", "Sign"] } } },
37
+ "odatano-core": {
38
+ "network": "preview",
39
+ "backends": ["koios"]
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ The services ask for the roles `Read`, `Transact` and `Sign` (`Admin` for operator actions). The `auth`
47
+ entry gives them to CAP's development user `alice`; in production your own authentication assigns them.
48
+
49
+ ```bash
50
+ cds deploy --to sqlite
51
+ cds serve
52
+ ```
53
+
54
+ Koios works without an account on its public tier. A [Koios token](https://koios.rest) is optional and raises the rate limit. Put it in a `.env` file in the project root (loaded automatically by `cds serve` / `cds watch`), not in `package.json`:
55
+
56
+ ```bash
57
+ # .env (optional)
58
+ KOIOS_API_KEY=your_koios_token
59
+ ```
60
+
61
+ > Config in `cds.requires.odatano-core` takes precedence over environment
62
+ > variables; a `koiosApiKey` set there would override the `.env` value.
63
+
64
+ Other backends are optional and can be combined, for example `["ogmios", "koios"]` with a local node, or
65
+ `blockfrost` with a Blockfrost key or a self-hosted Blockfrost-compatible node. See the
66
+ [Backend Configuration Guide](docs/guides/BACKEND_CONFIGURATION.md).
67
+
68
+ ### Standalone
69
+
70
+ Run ODATANO as a self-contained service (no host CAP project needed):
71
+
72
+ ```bash
73
+ git clone https://github.com/ODATANO/ODATANO && cd ODATANO
74
+ npm ci
75
+ cp .env.example .env # set NETWORK, BACKENDS (default koios), optional KOIOS_API_KEY
76
+ cds deploy --to sqlite
77
+ cds serve
78
+ ```
79
+
80
+ Or with Docker — this brings up a local **cardano-node + Ogmios + ODATANO** stack
81
+ (Preview), with the service pre-wired to the local Ogmios backend:
82
+
83
+ ```bash
84
+ docker compose up -d # full stack
85
+ docker compose up -d cardano-node ogmios # just the chain backend (pre-sync)
86
+ docker compose logs -f ogmios # watch sync (/health: 202 syncing, 200 near tip)
87
+ ```
88
+
89
+ > First sync from genesis takes hours; the node DB persists in a Docker volume so
90
+ > restarts resume. Until Ogmios catches up, queries fall back to Koios
91
+ > (optional `KOIOS_API_KEY`).
92
+
93
+ Service available at `http://localhost:4004`. See the [Quick Start Guide](docs/QUICK_START.md#local-ogmios--cardano-node-docker) for the local Ogmios stack and full details.
94
+
95
+ ## Dev Mode: Mocked Authentication
96
+
97
+ > **Heads-up.** `cds serve` uses CAP's mocked auth: any Basic-Auth header logs in as the named mock user and passwords are not checked. This repository gives `alice` and `bob` the roles `Read`, `Transact` and `Sign`, `carol` only `Read`, and `admin` all four (`.cdsrc.json`); any other name is logged in without a role and gets 403. Anonymous requests get 401, but anyone reaching the port can authenticate.
98
+ >
99
+ > 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).
100
+ >
101
+ > 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 `Read,Transact,Sign,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.
102
+ >
103
+ > 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.
104
+
105
+ ## Services
106
+
107
+ | Service | Path | Purpose |
108
+ |---|---|---|
109
+ | CardanoODataService | `/odata/v4/cardano/` | Read blockchain data (33 entities, 22 actions) |
110
+ | CardanoTransactionService | `/odata/v4/cardano-transaction/` | Build & submit transactions (14 actions) |
111
+ | CardanoSignService | `/odata/v4/cardano-sign/` | External signing + HSM (9 actions) |
112
+ | CardanoIndexerService | `/odata/v4/cardano-indexer/` | Chain crawler / pre-sync control (off by default) |
113
+ | CardanoWorkerService | `/odata/v4/cardano-worker/` | Asynchronous wallet jobs (off by default) |
114
+ | CardanoBackendService | `/odata/v4/cardano-backend/` | Chain data in provider shape for another ODATANO that uses this one as its `odatano` backend |
115
+ | CardanoAgentService | `/odata/v4/cardano-agent/` | Agent grants: scoped bearer tokens for agents (off by default) |
116
+
117
+ The indexer and the worker service also publish **CAP events**, so a consumer can subscribe instead of polling —
118
+ in-process, no broker required:
119
+
120
+ ```js
121
+ (await cds.connect.to('CardanoWorkerService')).on('jobConfirmed', ({ data }) => …)
122
+ (await cds.connect.to('CardanoIndexerService')).on('blockIndexed', ({ data }) => …)
123
+ ```
124
+
125
+ ## Agent grants (off by default)
126
+
127
+ Hand an agent a **scoped, budgeted token** instead of a user.
128
+
129
+ ```bash
130
+ AGENT_GRANTS_ENABLED=true # or cds.requires.odatano-core.agentGrants.enabled
131
+ AGENT_GRANTS_DELEGATE=mocked # CAP auth kind that keeps authenticating non-token requests (default: configured kind)
132
+ AGENT_GRANT_ADMIN_RATE_LIMIT=10 # grant administration calls per principal per hour (or agentGrants.adminRateLimit)
133
+ AGENT_TOKEN_CACHE_MS=10000 # a resolved token is reused this long before the row is read again; 0 = off (or agentGrants.tokenCacheMs)
134
+ AGENT_GRANT_USAGE_RETENTION_DAYS=400 # usage counters older than this are deleted once a day; 0 = keep all (or agentGrants.usageRetentionDays)
135
+ ```
136
+
137
+ 1. An **Admin** issues a grant (`POST /odata/v4/cardano-agent/CreateAgentGrant`): an allow list of
138
+ actions, a daily budget and an expiry. The response carries the token `odat_…` **once**; the
139
+ server stores only its SHA-256.
140
+ 2. The agent sends `x-agent-token: odat_…` on the service paths. It runs as the principal
141
+ `agent:<grantId>` with the single role `agent-grant`, never as the operator: every
142
+ `@requires: 'Admin'` surface (pause/resume, HSM signing, grant administration) refuses it by
143
+ construction. Reads and compute-only actions are always allowed; allow-listed actions each cost
144
+ one budget unit per UTC day (a build is the service an agent buys); everything else is 403.
145
+ An agent signs its transactions itself: the wallet worker, which signs with server-held keys,
146
+ answers every token request with 403.
147
+ 3. `GET /odata/v4/cardano-agent/GetGrantStatus()` tells the agent what it may do and how much budget
148
+ is left; `RevokeAgentGrant` turns the token into an unknown token immediately.
149
+ 4. Lifecycle (Admin; the same semantics as the gateway's peer services, so one client drives
150
+ them all): `UpdateAgentGrant` changes label, allow list, daily budget or expiry
151
+ (absent = untouched, explicit `null` = cleared; 409 `GRANT_REVOKED` on a revoked grant); `RotateAgentGrantToken` returns a fresh token once, the old
152
+ one is unknown from the next request; `GetGrantUsage(grantId, since, until)` lists admitted calls
153
+ per service and action over up to 366 days (an Admin for any grant, a token for its own). All
154
+ administration calls share the per-principal hourly rate limit above.
155
+
156
+ Grantable: `Build*`, `SetCollateral`, `CreateSigningRequest`, `VerifySignature`, `SubmitTransaction`,
157
+ `SubmitSignedTransaction`, `SubmitVerifiedTransaction`, `CheckSubmissionStatus`. Never: `SignWithHsm*`,
158
+ `SubmitWalletJob`, `CancelJob`, `Pause*`/`Resume*`, `pauseCrawler`/`resumeCrawler`, grant administration.
159
+
160
+ Programmatic seams for other packages (`@odatano/x402` sells grants against a 402 payment):
161
+ `issueAgentGrant()`, `updateAgentGrant()`, `rotateAgentGrantToken()`, `revokeAgentGrantById()`,
162
+ `getGrantUsage()`, `registerTransportLane()` from `@odatano/core`.
163
+
164
+ ## Liveness and readiness probes
165
+
166
+ `GET /odata/v4/cardano-indexer/getLiveness()` answers `200 { status: "alive", timestamp, uptime,
167
+ version, network }` **without credentials** (`@requires: 'any'`) as long as the process runs — no
168
+ backend or DB probe, no secrets. The Docker `HEALTHCHECK`, compose and upstream probes use it
169
+ instead of the service document, so a wrong operator password no longer reads as "ODATANO down".
170
+
171
+ `GET /odata/v4/cardano-indexer/getReadiness()` answers, also without credentials, whether this
172
+ instance can serve requests: `200 { status: "ready", timestamp, context, database, hsm }`, or `503`
173
+ with the same body and `status: "not_ready"` while the app context, the database or a configured
174
+ HSM is missing (`hsm` is `null` without an HSM). Point a load balancer or an upstream gateway at it.
175
+
176
+ The state of crawler, worker and backends stays authenticated: `getStatus()`, `GetWorkerStatus()`,
177
+ `GetNetworkInformation`.
178
+
179
+ ## Requirements
180
+
181
+ - **Node.js >= 22.5** and **@sap/cds 10** (peer dependency `^10`). CAP 9 hosts cannot load `@odatano/core@2`.
182
+ - Upgrading a consumer from 1.x: run **`cds deploy`**. 2.0 adds six tables (`CardanoSyncState`,
183
+ `CardanoReorgLog`, `CardanoWorkerWallets`, `CardanoWalletJobs`, `CardanoAgentGrants`,
184
+ `CardanoAgentGrantUsage`) plus a `dedupKey` column; without the redeploy the new services answer
185
+ `no such table` while the old ones keep working.
186
+
187
+ ## Documentation
188
+
189
+ | Guide | Description |
190
+ |-------|-------------|
191
+ | [Quick Start](docs/QUICK_START.md) | Get running in 5 minutes |
192
+ | [User Guide](docs/guides/USER_GUIDE.md) | API usage, entities, and examples |
193
+ | [Developer Guide](docs/guides/DEVELOPER_GUIDE.md) | Architecture and development |
194
+ | [Transaction Workflow](docs/guides/TRANSACTION_WORKFLOW.md) | Build → Sign → Submit flow |
195
+ | [Security Guide](docs/guides/SECURITY_GUIDE.md) | Authentication, signing security, HSM |
196
+ | [Docker Deployment](docs/guides/DOCKER_DEPLOYMENT.md) | Container deployment |
197
+ | [Upgrading to 2.0](docs/guides/UPGRADE_2.0.md) | What a 1.x deployment and its clients change |
198
+
199
+ ## License
200
+
201
+ Apache License 2.0 - see [LICENSE](LICENSE)
202
+
203
+ ## Support
204
+
205
+ - **Issues**: [GitHub Issues](https://github.com/ODATANO/ODATANO/issues)
206
+ - **Project Lead**: Max Weber
207
+ - **Contact**: info@odatano.dev