@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
@@ -1,44 +1,35 @@
1
1
  import { LedgerProtocolParameter } from "#cds-models/odatano/cardano";
2
- /**
3
- * Hex-encoded string (lower/upper-case depending on source)
4
- */
2
+ import type { ReferenceScriptType } from "./reference-script";
3
+ export type { ReferenceScriptType };
4
+ /** Hex-encoded string (case depends on source) */
5
5
  export type Hex = string;
6
- /**
7
- * Lovelace amount (integer) - represented as string to preserve precision for values > Number.MAX_SAFE_INTEGER.
8
- * Cardano max supply = 45B ADA = 45,000,000,000,000,000 lovelace (exceeds MAX_SAFE_INTEGER).
9
- * Provider APIs (Blockfrost, Koios) return lovelace as strings. Harmonic Labs uses bigint internally.
10
- */
6
+ /** Lovelace amount; a string preserves precision above Number.MAX_SAFE_INTEGER (max supply is 4.5e16). */
11
7
  export type Lovelace = number | string;
12
- /**
13
- * JSON Value Type - Represents any valid JSON value
14
- */
15
- export type JSONValue = string | number | boolean | {
8
+ /** Any JSON value; an integer literal too long for a double is read as bigint */
9
+ export type JSONValue = string | number | bigint | boolean | {
16
10
  [key: string]: JSONValue;
17
11
  } | JSONValue[] | null;
18
- /**
19
- * Amount Data Structure Type - Multi-asset amount line as returned by common Cardano APIs
20
- */
12
+ /** Multi-asset amount line as returned by common Cardano APIs */
21
13
  export interface Amount {
22
14
  unit: string;
23
15
  quantity: string;
24
16
  }
25
- /**
26
- * Transaction Input Data Structure Type
27
- */
17
+ /** Transaction input */
28
18
  export interface TxInputLine {
29
19
  address: string;
30
20
  amount: Amount[];
31
21
  txHash: Hex;
32
22
  outputIndex: number;
23
+ spentTxSeq?: number | null;
33
24
  dataHash?: Hex | null;
34
25
  inlineDatum?: string | null;
35
26
  referenceScriptHash?: Hex | null;
27
+ referenceScriptSize?: number | null;
28
+ referenceScriptType?: ReferenceScriptType | null;
36
29
  isCollateral?: boolean;
37
30
  isReference?: boolean;
38
31
  }
39
- /**
40
- * Transaction Output Data Structure Type
41
- */
32
+ /** Transaction output */
42
33
  export interface TxOutputLine {
43
34
  address: string;
44
35
  amount: Amount[];
@@ -48,18 +39,72 @@ export interface TxOutputLine {
48
39
  inlineDatum: string | null;
49
40
  isCollateral: boolean;
50
41
  referenceScriptHash?: Hex | null;
42
+ referenceScriptSize?: number | null;
43
+ referenceScriptType?: ReferenceScriptType | null;
51
44
  }
52
- /**
53
- * Transaction Data Structure Type - Normalized transaction structure
54
- */
45
+ export type CertificateKind = 'stake_registration' | 'stake_deregistration' | 'pool_delegation' | 'vote_delegation' | 'pool_registration' | 'pool_retirement' | 'drep_registration' | 'drep_update' | 'drep_retirement' | 'committee_hot_auth' | 'committee_resign' | 'genesis_delegation' | 'treasury_mir' | 'reserve_mir' | 'pot_transfer' | 'param_proposal' | (string & {});
46
+ /** One certificate of a transaction (crawler ledger-state coverage). */
47
+ export interface TxCertificate {
48
+ /** Position in the transaction's certificate list as the source reports it. */
49
+ certIndex: number;
50
+ kind: CertificateKind;
51
+ /** Reward account (bech32) the certificate concerns, when it has one. */
52
+ stakeAddress?: string | null;
53
+ /** Stake pool (bech32) for delegation / registration / retirement. */
54
+ poolId?: string | null;
55
+ /** DRep (CIP-129 bech32), or `drep_always_abstain` / `drep_always_no_confidence`. */
56
+ drepId?: string | null;
57
+ /** Deposit paid or refunded, lovelace as string. */
58
+ deposit?: Lovelace | string | null;
59
+ /** Retirement epoch of a pool retirement. */
60
+ epoch?: number | null;
61
+ }
62
+ /** One reward-account withdrawal of a transaction. */
63
+ export interface TxWithdrawal {
64
+ stakeAddress: string;
65
+ /** Lovelace as string. */
66
+ amount: Lovelace | string;
67
+ }
68
+ /** One redeemer of a transaction. */
69
+ export interface TxRedeemer {
70
+ /** spend | mint | publish | withdraw | vote | propose */
71
+ purpose: string;
72
+ /** Index within its purpose, as the ledger counts it. */
73
+ index: number;
74
+ /** PlutusData CBOR hex. */
75
+ data: string;
76
+ mem: string;
77
+ steps: string;
78
+ /** spend: the redeemed input. */
79
+ txHash?: Hex | null;
80
+ outputIndex?: number | null;
81
+ /** mint: the policy. */
82
+ policyId?: Hex | null;
83
+ }
84
+ /** One datum of a transaction witness set. */
85
+ export interface TxDatum {
86
+ /** Blake2b-256 of the datum bytes. */
87
+ hash: Hex;
88
+ /** PlutusData CBOR hex, the original bytes. */
89
+ cbor: string;
90
+ }
91
+ /** Normalized transaction */
55
92
  export interface Transaction {
56
93
  hash: Hex;
57
94
  blockHash: Hex;
58
95
  blockHeight: number;
59
96
  slot: number;
60
97
  index: number;
98
+ /** What the ledger charged: the declared fee, or on a phase-2 failure the collateral consumed. */
61
99
  fee: Lovelace | string;
62
- deposit: Lovelace | string;
100
+ /** Deposits locked minus deposits refunded; null while the source could not tell. */
101
+ deposit: Lovelace | string | null;
102
+ /** Lovelace donated to the treasury; only set by sources that report it. */
103
+ treasuryDonation?: string | null;
104
+ /** True when phase 2 failed and only collateral was consumed. Undefined when the source does not report it. */
105
+ spendsCollaterals?: boolean;
106
+ totalCollateral?: Lovelace | string | null;
107
+ mint?: Amount[];
63
108
  /** Tx size in bytes; null when the source cannot provide it (Ogmios chain-sync). */
64
109
  size: number | null;
65
110
  blockTime: number;
@@ -67,10 +112,16 @@ export interface Transaction {
67
112
  inputs: TxInputLine[];
68
113
  outputs: TxOutputLine[];
69
114
  metadata?: MetadataLabelTx[];
115
+ /** Certificates; `[]` when the tx has none, undefined when the source does not report them (Blockfrost). */
116
+ certificates?: TxCertificate[];
117
+ /** Reward-account withdrawals; same `[]` vs undefined convention as `certificates`. */
118
+ withdrawals?: TxWithdrawal[];
119
+ /** Redeemers; `[]` when the tx has none, undefined when the source does not report them (Blockfrost, Koios). */
120
+ redeemers?: TxRedeemer[];
121
+ /** Witness-set datums; same `[]` vs undefined convention as `redeemers`. */
122
+ datums?: TxDatum[];
70
123
  }
71
- /**
72
- * Address Data Structure Type - Address view, including current value and known UTxOs
73
- */
124
+ /** Address view with current value and known UTxOs */
74
125
  export interface Address {
75
126
  address: string;
76
127
  stakeAddress: string | null;
@@ -80,9 +131,7 @@ export interface Address {
80
131
  utxos: UTxO[];
81
132
  transactions?: Transaction[];
82
133
  }
83
- /**
84
- * UTxO Data Structure Type - Unspent transaction outputs (UTxOs)
85
- */
134
+ /** Unspent transaction output */
86
135
  export interface UTxO {
87
136
  txHash: Hex;
88
137
  outputIndex: number;
@@ -91,11 +140,14 @@ export interface UTxO {
91
140
  blockHash?: Hex;
92
141
  datumHash?: Hex | null;
93
142
  scriptRef?: Hex | null;
143
+ /** Full CBOR of the reference script (Plutus) when the source delivers it; builder use only. */
144
+ scriptRefCbor?: Hex | null;
145
+ /** Bytes the ledger charges for the reference script; null when the source reports the hash only. */
146
+ scriptRefSize?: number | null;
147
+ scriptRefType?: ReferenceScriptType | null;
94
148
  inlineDatum?: string | null;
95
149
  }
96
- /**
97
- * Block Data Structure Type - Basic block information structure
98
- */
150
+ /** Basic block information */
99
151
  export interface BlockData {
100
152
  time: number;
101
153
  height: number | null;
@@ -107,10 +159,10 @@ export interface BlockData {
107
159
  size: number;
108
160
  txCount: number;
109
161
  fees?: string | null;
162
+ /** Header fields only (ledger tip): size, txCount, fees and slotLeader are placeholders, not block data. */
163
+ headerOnly?: boolean;
110
164
  }
111
- /**
112
- * Supply Data Structure Type - Network supply information
113
- */
165
+ /** Network supply */
114
166
  export interface Supply {
115
167
  max: string;
116
168
  total: string;
@@ -119,23 +171,17 @@ export interface Supply {
119
171
  treasury: string;
120
172
  reserves: string;
121
173
  }
122
- /**
123
- * Stake Data Structure Type - Network stake information
124
- */
174
+ /** Network stake */
125
175
  export interface Stake {
126
176
  live: string;
127
177
  active: string;
128
178
  }
129
- /**
130
- * Network Information Data Structure Type - Network supply and stake information
131
- */
179
+ /** Network supply and stake */
132
180
  export interface NetworkInformation {
133
181
  supply: Supply;
134
182
  stake: Stake;
135
183
  }
136
- /**
137
- * Epoch Data Structure Type - Epoch information
138
- */
184
+ /** Epoch information */
139
185
  export interface EpochData {
140
186
  epoch: number;
141
187
  start_time: number;
@@ -148,53 +194,58 @@ export interface EpochData {
148
194
  fees: string;
149
195
  active_stake: string | null;
150
196
  }
151
- /**
152
- * Metadata Label Transaction Data Structure Type - Transaction metadata under a specific label
153
- */
197
+ /** Transaction metadata under one label */
154
198
  export interface MetadataLabelTx {
155
199
  txHash: Hex;
156
200
  label: number | string;
157
201
  json?: JSONValue;
158
202
  }
159
- /**
160
- * Account Data Structure Type - Stake account information
161
- */
203
+ /** Stake account information */
162
204
  export interface AccountData {
163
205
  stakeaddress: string;
164
206
  active: boolean;
165
207
  activeEpoch: number;
166
208
  controlledAmount: string;
167
- rewardsSum: string;
209
+ rewardsSum: string | null;
168
210
  withdrawalsSum: string;
169
211
  reservesSum: string;
170
212
  treasurySum: string;
171
- withdrawableAmount: string;
213
+ withdrawableAmount: string | null;
172
214
  poolId: string | null;
173
215
  drepId: string | null;
174
216
  addresses: Address[];
175
217
  }
176
- /**
177
- * Pool Data Structure Type - Pool information
178
- */
218
+ /** Pool information */
179
219
  export interface PoolData {
180
220
  poolId: string;
181
221
  vrfKeyHash: string;
182
222
  blocksMinted: number;
183
- blocksEpoch: number;
223
+ /** Blocks minted in the current epoch; null when the backend has no such figure (Koios). */
224
+ blocksEpoch: number | null;
184
225
  liveStake: string;
185
- liveSize: number;
226
+ /** Share of the total live stake; null when the backend has no such figure (Koios). */
227
+ liveSize: number | null;
228
+ /** Fraction of the ideal (saturated) pool size, NOT percent: 0.7542 = 75.42 %. */
186
229
  liveSaturation: number;
187
- liveDelegators: number;
230
+ /** Null when the source cannot count delegators (Ogmios ledger state). */
231
+ liveDelegators: number | null;
188
232
  activeStake: string;
189
233
  activeSize: number;
190
234
  pledge: string;
191
235
  margin: number;
192
236
  fixedCost: string;
193
237
  rewardAccount: string;
238
+ /** URL of the metadata file as registered; null without one. */
239
+ metadataUrl?: string | null;
240
+ /** hex; blake2b-256 the registration names for that file */
241
+ metadataHash?: string | null;
242
+ /** From the metadata file; null while it is unknown or failed its checks. */
243
+ name?: string | null;
244
+ ticker?: string | null;
245
+ homepage?: string | null;
246
+ description?: string | null;
194
247
  }
195
- /**
196
- * Drep Data Structure Type - Drep information
197
- */
248
+ /** DRep information */
198
249
  export interface DrepData {
199
250
  drepId: string;
200
251
  hex: string;
@@ -203,12 +254,14 @@ export interface DrepData {
203
254
  lastActiveEpoch: number;
204
255
  retired: boolean;
205
256
  expired: boolean;
257
+ /** Registration deposit (lovelace); only set by sources that report it. */
258
+ deposit?: string | null;
259
+ /** Epoch the mandate runs out; only set by sources that report it. */
260
+ expiresEpoch?: number | null;
261
+ /** Stake credentials delegated to the DRep; only set by sources that report it. */
262
+ delegatorCount?: number | null;
206
263
  }
207
- /**
208
- * Asset Info Data Structure Type - Normalized native-asset metadata + supply.
209
- * Backends provide overlapping but non-identical fields; the mapper produces
210
- * this canonical shape. Fields that one backend doesn't expose are null.
211
- */
264
+ /** Normalized native-asset metadata and supply; fields a backend does not expose are null. */
212
265
  export interface AssetInfo {
213
266
  unit: string;
214
267
  policyId: string;
@@ -227,10 +280,7 @@ export interface AssetInfo {
227
280
  registryUrl: string | null;
228
281
  registryLogo: string | null;
229
282
  }
230
- /**
231
- * Asset History Entry - single mint or burn event.
232
- * `quantity` is always the ABSOLUTE amount; sign info lives in `action`.
233
- */
283
+ /** One mint or burn event; `quantity` is absolute, the sign lives in `action`. */
234
284
  export interface AssetHistoryEntry {
235
285
  unit: string;
236
286
  txHash: string;
@@ -239,9 +289,7 @@ export interface AssetHistoryEntry {
239
289
  blockTime: number | null;
240
290
  blockHeight: number | null;
241
291
  }
242
- /**
243
- * Ledger Protocol Parameters Data Structure Type - Current protocol parameters
244
- */
292
+ /** Current protocol parameters */
245
293
  export type LedgerProtocolParameters = {
246
294
  network: string;
247
295
  epoch: number;
@@ -275,38 +323,27 @@ export type LedgerProtocolParameters = {
275
323
  collateralPercent: number | null;
276
324
  maxCollateralInputs: number | null;
277
325
  coinsPerUtxoSize: string | null;
326
+ minFeeRefScriptCostPerByte: number | null;
278
327
  fetchedAt: string;
279
328
  source: string;
280
329
  };
281
- /**
282
- * Mint/Burn Asset Action Type
283
- */
330
+ /** Mint/burn action */
284
331
  export type MintAction = {
285
332
  /** Asset unit to mint/burn (policyId + assetName) */
286
333
  assetUnit: string;
287
- /** Quantity to mint (positive) or burn (negative) */
334
+ /** Positive to mint, negative to burn */
288
335
  quantity: bigint;
289
- /** Optional redeemer data (integer). Defaults to 0 if not specified. */
336
+ /** Optional integer redeemer, default 0 */
290
337
  redeemer?: number;
291
- /**
292
- * Optional PER-ACTION minting policy (CBOR hex). When set, this action
293
- * mints under THIS script instead of the request's top-level
294
- * mintingPolicyScript, enabling multiple policies in one transaction.
295
- * Passed as-is (a parameterized script must be pre-applied); the action's
296
- * assetUnit must carry this script's policyId.
297
- */
298
338
  mintingPolicyScript?: string;
299
- /**
300
- * Optional PER-ACTION redeemer (parsed PlutusData JSON). Only valid
301
- * together with mintingPolicyScript; falls back to the request's
302
- * mintRedeemer when absent. Actions resolving to the SAME policy must
303
- * agree on their redeemer (the ledger carries one redeemer per policy).
304
- */
339
+ /** BuildPlutusTransaction only: UTxO that carries the policy as reference script; exclusive with mintingPolicyScript. */
340
+ referenceScript?: {
341
+ txHash: string;
342
+ outputIndex: number;
343
+ };
305
344
  redeemerJson?: JSONValue;
306
345
  };
307
- /**
308
- * Plutus Script Execution Type - For spending from script addresses
309
- */
346
+ /** Plutus script execution for spending from a script address */
310
347
  export type PlutusScriptExecution = {
311
348
  /** Validator script (CBOR hex) */
312
349
  validatorScript: string;
@@ -317,12 +354,10 @@ export type PlutusScriptExecution = {
317
354
  };
318
355
  /** Redeemer data (JSON value that will be converted to PlutusData) */
319
356
  redeemer: JSONValue;
320
- /** Datum data (JSON value, optional - required for hash-based datums) */
357
+ /** Datum (JSON value), required for hash-based datums */
321
358
  datum?: JSONValue;
322
359
  };
323
- /**
324
- * Transaction Build Request Type - Parameters for building a transaction, including optional minting and Plutus execution details
325
- */
360
+ /** Parameters for building a transaction, with optional minting and Plutus execution */
326
361
  export type TxBuildRequest = {
327
362
  network: 'mainnet' | 'preprod' | 'preview';
328
363
  senderAddress: string;
@@ -340,9 +375,13 @@ export type TxBuildRequest = {
340
375
  plutusScriptExecution?: PlutusScriptExecution;
341
376
  /** Inline datum to attach to the recipient output (optional) - for locking at script addresses */
342
377
  outputDatum?: JSONValue;
378
+ /** PlutusData CBOR hex; optional; inline datum on the recipient output, written byte for byte. Excludes outputDatum. */
379
+ outputDatumCbor?: string;
380
+ /** Raise lovelaceAmount to the recipient output's min-ADA instead of rejecting the request. */
381
+ ensureMinAda?: boolean;
343
382
  /** Required signers - Ed25519 key hashes (hex, 28 bytes each) */
344
383
  requiredSigners?: string[];
345
- /** Script parameters — PlutusData JSON array applied to script before building */
384
+ /** Script parameters (PlutusData JSON array) applied to the script before building */
346
385
  scriptParams?: JSONValue[];
347
386
  /** Optional inline datum for minted token output (PlutusData JSON, parsed) */
348
387
  inlineDatum?: JSONValue;
@@ -350,30 +389,22 @@ export type TxBuildRequest = {
350
389
  mintRedeemer?: JSONValue;
351
390
  /** When true, route output to enterprise script address derived from applied script hash */
352
391
  lockOnScript?: boolean;
353
- /**
354
- * Optional UTxOs that MUST be consumed as inputs. Resolved and added to the TxBuilder
355
- * BEFORE coin selection runs. Coin selection then only covers the remaining shortfall.
356
- * Deduplicated against plutusScriptExecution.scriptUtxo in spend transactions.
357
- * Primary use case: one-shot minting seeds (policy parameterized with a specific TxOutRef).
358
- */
392
+ /** UTxOs that must be spent, such as one-shot minting seeds. Added before coin selection. */
359
393
  forceInputs?: Array<{
360
394
  txHash: string;
361
395
  outputIndex: number;
362
396
  }>;
363
- /**
364
- * Optional CIP-31 reference inputs (read-only, not consumed). Resolved to full UTxOs
365
- * and passed as readonlyRefInputs to Buildooor. The validator can read these UTxOs'
366
- * datums/values without consuming them (e.g., oracle feeds, shared config).
367
- */
397
+ /** UTxOs the build must never spend: left out of coin selection and collateral. */
398
+ protectInputs?: Array<{
399
+ txHash: string;
400
+ outputIndex: number;
401
+ }>;
402
+ /** CIP-31 reference inputs (read-only, not consumed), passed as readonlyRefInputs to Buildooor. */
368
403
  referenceInputs?: Array<{
369
404
  txHash: string;
370
405
  outputIndex: number;
371
406
  }>;
372
- /**
373
- * Optional additional outputs appended after the primary recipient output, before change.
374
- * Each extra output is independently min-ADA checked. Used for multi-output state-machine
375
- * transitions (e.g. counter update + batch NFT outputs in a single transaction).
376
- */
407
+ /** Additional outputs after the primary recipient output, before change; each min-ADA checked. */
377
408
  extraOutputs?: Array<{
378
409
  address: string;
379
410
  lovelaceAmount: string;
@@ -384,52 +415,95 @@ export type TxBuildRequest = {
384
415
  inlineDatum?: JSONValue;
385
416
  referenceScript?: string;
386
417
  }>;
387
- /**
388
- * Optional Plutus V3 validator CBOR hex to attach as a referenceScript on the primary
389
- * recipient output (CIP-33). Adding a ref script significantly increases the output's
390
- * min-ADA — consumers must provide enough lovelaceAmount to cover it.
391
- */
418
+ /** Plutus V3 validator CBOR hex attached as CIP-33 reference script on the recipient output; raises its min-ADA. */
392
419
  referenceScript?: string;
393
- /**
394
- * Optional validity-interval start in Posix milliseconds. Sets `invalidBefore`
395
- * on the built transaction so that Plutus validators checking
396
- * `expect Finite(lower) = tx.validity_range.lower_bound.bound_type` see a finite bound.
397
- * Defaults inside the builder to `Date.now() - 120_000` (script builds only).
398
- */
420
+ /** Validity start in Posix ms (`invalidBefore`); builder default `now - 120_000` for script builds. */
399
421
  validityStartMs?: string;
400
- /**
401
- * Optional validity-interval end in Posix milliseconds. Sets `invalidAfter` (ledger TTL).
402
- * Defaults inside the builder to `Date.now() + 3_600_000` (script builds only).
403
- */
422
+ /** Validity end in Posix ms (`invalidAfter`, ledger TTL); builder default `now + 3_600_000` for script builds. */
404
423
  validityEndMs?: string;
405
424
  };
406
- /**
407
- * Transaction Build Request for Mint/Burn operations - requires mintActions and mintingPolicyScript
408
- */
425
+ /** Mint/burn build request: mintActions and mintingPolicyScript required */
409
426
  export type TxBuildMintRequest = TxBuildRequest & {
410
427
  mintActions: MintAction[];
411
428
  mintingPolicyScript: string;
412
429
  };
413
- /**
414
- * Transaction Build Request for Plutus spending - requires plutusScriptExecution
415
- */
430
+ /** Plutus spend build request: plutusScriptExecution required */
416
431
  export type TxBuildPlutusSpendRequest = TxBuildRequest & {
417
432
  plutusScriptExecution: PlutusScriptExecution;
418
433
  };
419
- /**
420
- * Execution Budget for Plutus scripts
421
- */
434
+ /** One script UTxO spent by a BuildPlutusTransaction: an inline validator or a UTxO carrying the script. */
435
+ export type ScriptInput = {
436
+ txHash: string;
437
+ outputIndex: number;
438
+ /** Validator CBOR hex (script params already applied); exclusive with referenceScript. */
439
+ validatorScript?: string;
440
+ /** UTxO that carries the validator as reference script; added as reference input. */
441
+ referenceScript?: {
442
+ txHash: string;
443
+ outputIndex: number;
444
+ };
445
+ /** Redeemer (PlutusData JSON); `__INPUT_IDX__` placeholders resolve against the final inputs. */
446
+ redeemer: JSONValue;
447
+ /** Redeemer as PlutusData CBOR hex; wins over `redeemer`, no placeholders. */
448
+ redeemerCbor?: string;
449
+ /** Datum preimage (PlutusData JSON) for a hash-datum UTxO; inline datums are read from the UTxO. */
450
+ datum?: JSONValue;
451
+ /** Datum preimage as PlutusData CBOR hex; wins over `datum`. */
452
+ datumCbor?: string;
453
+ };
454
+ /** Output of a BuildPlutusTransaction, kept in the given order. */
455
+ export type PlutusTxOutput = NonNullable<TxBuildRequest['extraOutputs']>[number] & {
456
+ /** Datum hash to lock the output with (hex); exclusive with inlineDatum. */
457
+ datumHash?: string;
458
+ /** Inline datum as PlutusData CBOR hex, taken byte for byte; exclusive with inlineDatum. */
459
+ inlineDatumCbor?: string;
460
+ };
461
+ export type WithdrawalInput = {
462
+ /** Bech32 reward account (stake address). */
463
+ rewardAddress: string;
464
+ /** Withdrawn lovelace; 0 for the withdraw-zero pattern. */
465
+ lovelace: string;
466
+ /** Staking script CBOR hex (script params already applied); exclusive with referenceScript. */
467
+ stakingScript?: string;
468
+ /** UTxO that carries the staking script as reference script; added as reference input. */
469
+ referenceScript?: {
470
+ txHash: string;
471
+ outputIndex: number;
472
+ };
473
+ /** Redeemer (PlutusData JSON); `__INPUT_IDX__` placeholders resolve against the final inputs. */
474
+ redeemer?: JSONValue;
475
+ /** Redeemer as PlutusData CBOR hex; wins over `redeemer`, no placeholders. */
476
+ redeemerCbor?: string;
477
+ };
478
+ export type CertificateInput = {
479
+ type: 'registerStake' | 'deregisterStake';
480
+ /** Bech32 stake address of the credential. */
481
+ stakeAddress: string;
482
+ /** Explicit deposit (lovelace) for the Conway forms; defaults to the protocol's stake deposit. */
483
+ deposit?: string;
484
+ stakingScript?: string;
485
+ referenceScript?: {
486
+ txHash: string;
487
+ outputIndex: number;
488
+ };
489
+ redeemer?: JSONValue;
490
+ redeemerCbor?: string;
491
+ };
492
+ /** BuildPlutusTransaction: several script inputs, the outputs as given, change after them. */
493
+ export type TxBuildPlutusRequest = Pick<TxBuildRequest, 'network' | 'senderAddress' | 'changeAddress' | 'requiredSigners' | 'forceInputs' | 'protectInputs' | 'referenceInputs' | 'mintActions' | 'validityStartMs' | 'validityEndMs'> & {
494
+ scriptInputs: ScriptInput[];
495
+ outputs: PlutusTxOutput[];
496
+ /** Reward-account withdrawals, with or without a staking script. */
497
+ withdrawals?: WithdrawalInput[];
498
+ /** Stake-credential registrations and deregistrations. */
499
+ certificates?: CertificateInput[];
500
+ };
501
+ /** Execution budget for Plutus scripts */
422
502
  export type ExecutionBudget = {
423
503
  memory: number;
424
504
  cpu: number;
425
505
  };
426
- /**
427
- * Script evaluation result from Ogmios
428
- */
429
- /**
430
- * Ogmios validator descriptor — `purpose:index` (e.g., "spend:0", "mint:1")
431
- * or a structured object with purpose + index fields depending on Ogmios version.
432
- */
506
+ /** Ogmios validator descriptor: `purpose:index` (e.g. "spend:0") or `{ purpose, index }` depending on version */
433
507
  export type ScriptValidator = string | {
434
508
  purpose: string;
435
509
  index: number;
@@ -438,13 +512,9 @@ export type ScriptEvaluationResult = {
438
512
  validator: ScriptValidator;
439
513
  budget: ExecutionBudget;
440
514
  };
441
- /**
442
- * Transaction evaluator function type - evaluates script execution units
443
- */
515
+ /** Evaluates script execution units of an unsigned tx */
444
516
  export type TxEvaluator = (unsignedTxCbor: string) => Promise<ScriptEvaluationResult[]>;
445
- /**
446
- * Transaction Build Context Type - Context for building a transaction
447
- */
517
+ /** Context for building a transaction */
448
518
  export type TxBuildContext = {
449
519
  utxos: UTxO[];
450
520
  protocolParameters: LedgerProtocolParameter;
@@ -453,9 +523,7 @@ export type TxBuildContext = {
453
523
  /** CIP-31 reference input UTxOs (read-only, not consumed). Resolved from referenceInputs refs. */
454
524
  referenceInputUtxos?: UTxO[];
455
525
  };
456
- /**
457
- * Transaction Build Result Type
458
- */
526
+ /** Transaction build result */
459
527
  export type TxBuildResult = {
460
528
  senderAddress?: string;
461
529
  network?: 'mainnet' | 'preprod' | 'preview';
@@ -489,10 +557,15 @@ export type TxBuildResult = {
489
557
  forcedInputsUsed?: number;
490
558
  /** Number of CIP-31 reference inputs included in the built transaction (0 if referenceInputs was not used). */
491
559
  referenceInputsUsed?: number;
560
+ /** Execution units stamped on each redeemer (script builds). */
561
+ redeemers?: Array<{
562
+ tag: string;
563
+ index: number;
564
+ mem: string;
565
+ steps: string;
566
+ }>;
492
567
  };
493
- /**
494
- * Supported external signer types
495
- */
568
+ /** Supported external signer types */
496
569
  export declare enum ExternalSignerType {
497
570
  /** Cardano CLI - Reference implementation for signing */
498
571
  CARDANO_CLI = "cardano-cli",
@@ -505,9 +578,7 @@ export declare enum ExternalSignerType {
505
578
  /** Hardware Security Module (server-side PKCS#11) */
506
579
  HSM = "hsm"
507
580
  }
508
- /**
509
- * Signing request status
510
- */
581
+ /** Signing request status */
511
582
  export declare enum SigningStatus {
512
583
  /** Request created, awaiting signing */
513
584
  PENDING = "pending",
@@ -522,9 +593,7 @@ export declare enum SigningStatus {
522
593
  /** Request expired (not signed within TTL) */
523
594
  EXPIRED = "expired"
524
595
  }
525
- /**
526
- * Instructions for external signers
527
- */
596
+ /** Instructions for external signers */
528
597
  export interface SigningInstructions {
529
598
  /** Signer type hint (which tool/wallet to use) */
530
599
  signerTypeHint: ExternalSignerType;
@@ -542,12 +611,7 @@ export interface SigningInstructions {
542
611
  /** Copy-pasteable cardano-cli signing recipe (for CLI/hardware signers) */
543
612
  cardanoCliCommand?: string;
544
613
  }
545
- /**
546
- * Unsigned transaction export payload for external signers
547
- *
548
- * This is the standardized format returned by BuildTransaction actions.
549
- * External signers use this payload to sign the transaction.
550
- */
614
+ /** Unsigned transaction payload returned by the Build actions for external signers */
551
615
  export interface UnsignedTxExportPayload {
552
616
  /** Unique identifier for this signing request */
553
617
  signingRequestId: string;
@@ -568,9 +632,7 @@ export interface UnsignedTxExportPayload {
568
632
  /** Signing instructions for the external signer */
569
633
  signingInstructions: SigningInstructions;
570
634
  }
571
- /**
572
- * Signed transaction submission payload
573
- */
635
+ /** Signed transaction submission payload */
574
636
  export interface SignedTxPayload {
575
637
  /** Original signing request ID */
576
638
  signingRequestId: string;
@@ -583,9 +645,7 @@ export interface SignedTxPayload {
583
645
  /** Optional: Signer identification (wallet name, etc.) */
584
646
  signerInfo?: string;
585
647
  }
586
- /**
587
- * Signing workflow state
588
- */
648
+ /** Signing workflow state */
589
649
  export interface SigningWorkflowState {
590
650
  /** Current status of the signing workflow */
591
651
  status: SigningStatus;
@@ -608,9 +668,25 @@ export interface SigningWorkflowState {
608
668
  failed?: string;
609
669
  };
610
670
  }
611
- /**
612
- * Result of signature verification
613
- */
671
+ /** Depth of a transaction in the chain. Depth 1 means it sits in the tip block. */
672
+ export interface TransactionConfirmations {
673
+ txHash: string;
674
+ /** null while the tx is not on chain. */
675
+ blockHeight: number | null;
676
+ tipHeight: number | null;
677
+ /** 0 while the tx is not on chain. */
678
+ confirmations: number;
679
+ }
680
+ /** Result of verifyTxWitnesses: every vkey signature checked against the body hash. */
681
+ export interface TxWitnessVerification {
682
+ valid: boolean;
683
+ /** null when the CBOR could not be read. */
684
+ txBodyHash: string | null;
685
+ /** blake2b-224 of each vkey whose signature verifies. */
686
+ signerKeyHashes: string[];
687
+ errors: string[];
688
+ }
689
+ /** Result of signature verification */
614
690
  export interface SignatureVerificationResult {
615
691
  /** Whether the signature is valid */
616
692
  isValid: boolean;
@@ -625,9 +701,7 @@ export interface SignatureVerificationResult {
625
701
  /** Error message if verification failed */
626
702
  errorMessage?: string;
627
703
  }
628
- /**
629
- * Options for signature verification
630
- */
704
+ /** Options for signature verification */
631
705
  export interface VerificationOptions {
632
706
  /** Expected transaction body hash (from the build) */
633
707
  expectedTxBodyHash?: string;
@@ -636,9 +710,7 @@ export interface VerificationOptions {
636
710
  /** List of required signer key hashes (public key hashes) */
637
711
  requiredSigners?: string[];
638
712
  }
639
- /**
640
- * HSM Configuration for PKCS#11 integration
641
- */
713
+ /** HSM configuration for PKCS#11 integration */
642
714
  export interface HsmConfig {
643
715
  /** Whether HSM signing is enabled */
644
716
  enabled: boolean;
@@ -652,12 +724,10 @@ export interface HsmConfig {
652
724
  keyId?: string;
653
725
  /** Key label for CKA_LABEL lookup */
654
726
  keyLabel?: string;
655
- /** Optional CDS role required for HSM actions (SignWithHsm, SignAndSubmitWithHsm, GetHsmStatus). When set, only users with this role can invoke HSM operations. */
727
+ /** CDS role required for the HSM actions (SignWithHsm, SignAndSubmitWithHsm, GetHsmStatus) */
656
728
  requiresRole?: string;
657
729
  }
658
- /**
659
- * HSM signing result
660
- */
730
+ /** HSM signing result */
661
731
  export interface HsmSignResult {
662
732
  /** Ed25519 signature (64 bytes, hex) */
663
733
  signatureHex: string;