@odatano/core 2.0.0-rc.10 → 2.0.0-rc.12

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 (32) hide show
  1. package/@cds-models/CardanoODataService/index.d.ts +54 -0
  2. package/@cds-models/CardanoODataService/index.js +6 -0
  3. package/@cds-models/odatano/cardano/index.d.ts +54 -0
  4. package/@cds-models/odatano/cardano/index.js +6 -0
  5. package/db/schema.cds +1844 -1738
  6. package/package.json +1 -1
  7. package/srv/blockchain/backends/blockfrost-backend.js +7 -2
  8. package/srv/blockchain/backends/cardano-backend.d.ts +22 -0
  9. package/srv/blockchain/backends/cardano-backend.js +9 -0
  10. package/srv/blockchain/backends/koios-backend.d.ts +34 -2
  11. package/srv/blockchain/backends/koios-backend.js +133 -39
  12. package/srv/blockchain/backends/ogmios-backend.d.ts +6 -1
  13. package/srv/blockchain/backends/ogmios-backend.js +27 -2
  14. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +77 -0
  15. package/srv/blockchain/backends/ogmios-frame-guard.js +181 -0
  16. package/srv/blockchain/cardano-client.d.ts +8 -1
  17. package/srv/blockchain/cardano-client.js +14 -0
  18. package/srv/blockchain/cardano-indexer.d.ts +127 -0
  19. package/srv/blockchain/cardano-indexer.js +345 -3
  20. package/srv/blockchain/crawler/crawler.d.ts +88 -0
  21. package/srv/blockchain/crawler/crawler.js +180 -2
  22. package/srv/cardano-service.cds +10 -0
  23. package/srv/server.js +26 -1
  24. package/srv/utils/const.d.ts +1 -1
  25. package/srv/utils/const.js +1 -1
  26. package/srv/utils/errors.d.ts +18 -0
  27. package/srv/utils/errors.js +24 -1
  28. package/srv/utils/mappers.d.ts +54 -1
  29. package/srv/utils/mappers.js +111 -0
  30. package/srv/utils/types.d.ts +27 -0
  31. package/srv/utils/validators.d.ts +1 -1
  32. package/srv/utils/validators.js +2 -2
@@ -58,8 +58,35 @@ export interface Transaction {
58
58
  blockHeight: number;
59
59
  slot: number;
60
60
  index: number;
61
+ /**
62
+ * What the ledger charged. For an ordinary transaction that is the fee declared in the
63
+ * body; for a phase-2 failure (`spendsCollaterals`) it is the collateral consumed, which
64
+ * is what the sender actually paid — the declared fee was never collected.
65
+ */
61
66
  fee: Lovelace | string;
62
67
  deposit: Lovelace | string;
68
+ /**
69
+ * Phase-2 validity as the ledger applied it. True when the script phase failed: the
70
+ * declared inputs and outputs were not applied, the collateral inputs were consumed and
71
+ * only the collateral return was produced. Reported by the Ogmios chain-sync path
72
+ * (`spends`) and by Blockfrost (`valid_contract`); Koios leaves it undefined.
73
+ */
74
+ spendsCollaterals?: boolean;
75
+ /**
76
+ * `total_collateral` from the transaction body, when it declares one. The ledger requires
77
+ * it to equal the collateral actually consumed, so it is the exact value for `fee` on a
78
+ * phase-2 failure without resolving a single input. Null when the body omits it — the
79
+ * charge then has to be derived from the resolved collateral inputs minus the return.
80
+ */
81
+ totalCollateral?: Lovelace | string | null;
82
+ /**
83
+ * Net mint/burn per asset unit as the ledger applied it, signed — a negative quantity is a
84
+ * burn. Ogmios (`mint`) and Koios (`assets_minted`) report it natively; Blockfrost has no
85
+ * such field and leaves it undefined, so the indexer derives the delta from the transaction's
86
+ * (fully resolved) input and output assets instead — which needs `isReference`/`isCollateral`
87
+ * and `spendsCollaterals` to be set on that path too. Never carries `lovelace`.
88
+ */
89
+ mint?: Amount[];
63
90
  /** Tx size in bytes; null when the source cannot provide it (Ogmios chain-sync). */
64
91
  size: number | null;
65
92
  blockTime: number;
@@ -20,7 +20,7 @@ export declare function validateJsonWithLimits(jsonString: string, fieldName: st
20
20
  */
21
21
  export declare function isTxHash(s: unknown): s is string;
22
22
  /**
23
- * Asset unit: concatenation of policy ID (56 hex chars) + asset name (0-128 hex chars)
23
+ * Asset unit: concatenation of policy ID (56 hex chars) + asset name (0-64 hex chars)
24
24
  * @param s - The raw value to validate against asset unit format
25
25
  * @returns { boolean } true if v is a valid asset unit false otherwise
26
26
  */
@@ -139,7 +139,7 @@ function isTxHash(s) {
139
139
  return typeof s === "string" && const_1.TX_HASH_REGEX.test(s);
140
140
  }
141
141
  /**
142
- * Asset unit: concatenation of policy ID (56 hex chars) + asset name (0-128 hex chars)
142
+ * Asset unit: concatenation of policy ID (56 hex chars) + asset name (0-64 hex chars)
143
143
  * @param s - The raw value to validate against asset unit format
144
144
  * @returns { boolean } true if v is a valid asset unit false otherwise
145
145
  */
@@ -147,7 +147,7 @@ function isAssetUnit(s) {
147
147
  if (typeof s !== "string")
148
148
  return false;
149
149
  const t = s.trim();
150
- // Regex ensures: 56-192 hex chars, even length, valid hex
150
+ // Regex ensures: 56-120 hex chars, even length, valid hex
151
151
  return const_1.ASSET_UNIT_REGEX.test(t);
152
152
  }
153
153
  /**