@odatano/core 2.0.0-rc.2 → 2.0.0-rc.20

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 (132) 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/CardanoIndexerService/index.d.ts +139 -2
  4. package/@cds-models/CardanoIndexerService/index.js +18 -0
  5. package/@cds-models/CardanoODataService/index.d.ts +224 -0
  6. package/@cds-models/CardanoODataService/index.js +27 -0
  7. package/@cds-models/CardanoSignService/index.d.ts +5 -2
  8. package/@cds-models/CardanoTransactionService/index.d.ts +9 -9
  9. package/@cds-models/odatano/cardano/index.d.ts +316 -0
  10. package/@cds-models/odatano/cardano/index.js +33 -0
  11. package/README.md +195 -136
  12. package/db/schema.cds +2121 -1633
  13. package/package.json +179 -173
  14. package/src/index.d.ts +10 -10
  15. package/src/index.js +24 -14
  16. package/src/plugin.js +39 -52
  17. package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
  18. package/srv/blockchain/backends/blockfrost-backend.js +45 -158
  19. package/srv/blockchain/backends/cardano-backend.d.ts +78 -158
  20. package/srv/blockchain/backends/cardano-backend.js +14 -5
  21. package/srv/blockchain/backends/koios-backend.d.ts +126 -60
  22. package/srv/blockchain/backends/koios-backend.js +292 -202
  23. package/srv/blockchain/backends/ogmios-backend.d.ts +59 -96
  24. package/srv/blockchain/backends/ogmios-backend.js +241 -153
  25. package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
  26. package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
  27. package/srv/blockchain/cardano-client.d.ts +50 -205
  28. package/srv/blockchain/cardano-client.js +80 -224
  29. package/srv/blockchain/cardano-indexer.d.ts +146 -244
  30. package/srv/blockchain/cardano-indexer.js +442 -285
  31. package/srv/blockchain/cardano-tx-builder.d.ts +19 -84
  32. package/srv/blockchain/cardano-tx-builder.js +21 -107
  33. package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
  34. package/srv/blockchain/crawler/certificate-backfill.js +150 -0
  35. package/srv/blockchain/crawler/crawler.d.ts +121 -53
  36. package/srv/blockchain/crawler/crawler.js +402 -82
  37. package/srv/blockchain/crawler/hooks.d.ts +3 -14
  38. package/srv/blockchain/crawler/index.d.ts +5 -0
  39. package/srv/blockchain/crawler/index.js +35 -7
  40. package/srv/blockchain/crawler/sync-state.d.ts +44 -28
  41. package/srv/blockchain/crawler/sync-state.js +115 -43
  42. package/srv/blockchain/crawler/utxo-set-import.d.ts +69 -0
  43. package/srv/blockchain/crawler/utxo-set-import.js +269 -0
  44. package/srv/blockchain/ledger-state.d.ts +80 -0
  45. package/srv/blockchain/ledger-state.js +383 -0
  46. package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
  47. package/srv/blockchain/signing/cose-verifier.js +6 -12
  48. package/srv/blockchain/signing/external-signer.d.ts +16 -113
  49. package/srv/blockchain/signing/external-signer.js +19 -122
  50. package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
  51. package/srv/blockchain/signing/hsm-signer.js +23 -63
  52. package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
  53. package/srv/blockchain/signing/signature-verifier.js +13 -54
  54. package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
  55. package/srv/blockchain/signing/submission-finalizer.js +16 -48
  56. package/srv/blockchain/transaction-building/buildooor-tx.d.ts +71 -160
  57. package/srv/blockchain/transaction-building/buildooor-tx.js +185 -260
  58. package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
  59. package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
  60. package/srv/blockchain/wallet-worker/build-request.js +39 -23
  61. package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
  62. package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
  63. package/srv/blockchain/wallet-worker/index.js +2 -8
  64. package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
  65. package/srv/blockchain/wallet-worker/job-store.js +0 -0
  66. package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
  67. package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
  68. package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
  69. package/srv/blockchain/wallet-worker/signers.js +3 -8
  70. package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
  71. package/srv/blockchain/wallet-worker/wallet-worker.js +34 -90
  72. package/srv/cardano-agent-service.cds +146 -0
  73. package/srv/cardano-agent-service.d.ts +2 -0
  74. package/srv/cardano-agent-service.js +12 -0
  75. package/srv/cardano-indexer-service.cds +164 -73
  76. package/srv/cardano-indexer-service.js +156 -11
  77. package/srv/cardano-service.cds +45 -0
  78. package/srv/cardano-service.js +38 -96
  79. package/srv/cardano-sign-service.cds +200 -180
  80. package/srv/cardano-sign-service.js +55 -173
  81. package/srv/cardano-tx-service.cds +32 -26
  82. package/srv/cardano-tx-service.js +133 -195
  83. package/srv/cardano-worker-service.js +7 -15
  84. package/srv/server.d.ts +28 -86
  85. package/srv/server.js +95 -128
  86. package/srv/utils/agent-grants-config.d.ts +37 -0
  87. package/srv/utils/agent-grants-config.js +138 -0
  88. package/srv/utils/agent-grants.d.ts +262 -0
  89. package/srv/utils/agent-grants.js +914 -0
  90. package/srv/utils/agent-token-auth.d.ts +16 -0
  91. package/srv/utils/agent-token-auth.js +78 -0
  92. package/srv/utils/backend-request-handler.d.ts +2 -16
  93. package/srv/utils/backend-request-handler.js +3 -18
  94. package/srv/utils/collections.d.ts +4 -8
  95. package/srv/utils/collections.js +4 -8
  96. package/srv/utils/const.d.ts +19 -68
  97. package/srv/utils/const.js +20 -69
  98. package/srv/utils/crypto.d.ts +3 -12
  99. package/srv/utils/crypto.js +5 -18
  100. package/srv/utils/db-indexes.d.ts +25 -0
  101. package/srv/utils/db-indexes.js +89 -0
  102. package/srv/utils/db-sanitize.d.ts +27 -0
  103. package/srv/utils/db-sanitize.js +85 -0
  104. package/srv/utils/error-codes.d.ts +18 -73
  105. package/srv/utils/error-codes.js +17 -70
  106. package/srv/utils/errors.d.ts +34 -178
  107. package/srv/utils/errors.js +55 -217
  108. package/srv/utils/liveness.d.ts +16 -0
  109. package/srv/utils/liveness.js +41 -0
  110. package/srv/utils/mappers.d.ts +82 -210
  111. package/srv/utils/mappers.js +272 -293
  112. package/srv/utils/network-context.js +2 -11
  113. package/srv/utils/pg-order-nulls.d.ts +14 -0
  114. package/srv/utils/pg-order-nulls.js +57 -0
  115. package/srv/utils/plutus-placeholders.d.ts +6 -18
  116. package/srv/utils/plutus-placeholders.js +6 -20
  117. package/srv/utils/rate-limiter.d.ts +46 -0
  118. package/srv/utils/rate-limiter.js +116 -0
  119. package/srv/utils/service-events.d.ts +2 -22
  120. package/srv/utils/service-events.js +3 -23
  121. package/srv/utils/signing-helper.d.ts +3 -18
  122. package/srv/utils/signing-helper.js +10 -32
  123. package/srv/utils/tx-build-helper.d.ts +18 -92
  124. package/srv/utils/tx-build-helper.js +32 -123
  125. package/srv/utils/tx-request-parsers.d.ts +14 -20
  126. package/srv/utils/tx-request-parsers.js +33 -20
  127. package/srv/utils/tx-utils.d.ts +4 -23
  128. package/srv/utils/tx-utils.js +12 -41
  129. package/srv/utils/types.d.ts +112 -169
  130. package/srv/utils/types.js +2 -6
  131. package/srv/utils/validators.d.ts +19 -89
  132. package/srv/utils/validators.js +31 -138
@@ -10,29 +10,20 @@ const cds_1 = __importDefault(require("@sap/cds"));
10
10
  const errors_1 = require("./errors");
11
11
  const error_codes_1 = require("./error-codes");
12
12
  /**
13
- * Transaction utilities shared by the sign-service and the background workers.
14
- *
15
- * Context: @cap-js/sqlite runs on a SINGLE pooled connection. A request
16
- * transaction begins lazily on its first CQL statement and holds that
17
- * connection until the request commits. Any code that then needs a NEW ROOT
18
- * transaction (detached committed bookkeeping) waits on the pool — forever,
19
- * if the waiter is awaited by the very request holding the connection
20
- * (docs/KNOWN_ISSUES.md issue 11).
13
+ * Transaction helpers for the sign-service and background workers. @cap-js/sqlite has a single pooled
14
+ * connection held by the request tx, so a new root tx awaited by that request would wait forever.
21
15
  */
22
16
  const logger = cds_1.default.log('tx-utils');
23
17
  /** Default acquire budget for detached bookkeeping transactions. */
24
18
  exports.DETACHED_TX_TIMEOUT_MS = 10_000;
25
- /** Effective timeout: env override (ODATANO_DETACHED_TX_TIMEOUT_MS) > default. Read per call so tests can tune it. */
19
+ /** ODATANO_DETACHED_TX_TIMEOUT_MS override, else the default; read per call. */
26
20
  function effectiveTimeoutMs() {
27
21
  const fromEnv = Number(process.env.ODATANO_DETACHED_TX_TIMEOUT_MS);
28
22
  return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : exports.DETACHED_TX_TIMEOUT_MS;
29
23
  }
30
24
  /**
31
- * Run `fn` with `cds.context` cleared, so any `db.run(...)` inside it gets a
32
- * fresh short-lived transaction instead of joining a long-lived ambient one.
33
- * Under @cap-js/sqlite (pool.max=1) this is what keeps the single pooled
34
- * connection free during long awaits (NIGHTGATE lesson 2; used by the
35
- * wallet-worker job loops).
25
+ * Run `fn` with `cds.context` cleared so inner `db.run` calls get short-lived transactions instead of
26
+ * joining a long-lived ambient one; keeps the single sqlite connection free during long awaits.
36
27
  */
37
28
  function runWithoutAmbientTx(fn) {
38
29
  return cds_1.default._with(undefined, fn);
@@ -45,34 +36,16 @@ class DetachedTxAbortedError extends Error {
45
36
  }
46
37
  }
47
38
  /**
48
- * `cds.tx(fn)` with a deadlock guard: a NEW ROOT transaction that fails fast
49
- * instead of hanging forever when no pooled connection becomes available.
50
- *
51
- * Why: the sign-service must commit its submit bookkeeping (claim, finalize,
52
- * failure marker) independently of the caller's request transaction. When an
53
- * in-process consumer awaits the action while its own request transaction
54
- * holds the single pooled sqlite connection, the acquire can never succeed —
55
- * without this guard that is a silent, zero-CPU, infinite hang.
56
- *
57
- * Guarantees:
58
- * - On timeout, throws `BackendError` 503 `ODATANO_NESTED_TX_TIMEOUT` with a
59
- * diagnosis pointing at KNOWN_ISSUES #11.
60
- * - A late connection grant (after the timeout already fired) performs NO
61
- * work: the callback forces the acquire via an explicit `begin()` and
62
- * checks the abort flag right after it, so it rolls back immediately and
63
- * the caller never observes an error for work that then silently happened
64
- * anyway. (A flag check at callback ENTRY would run long before the lazy
65
- * acquire and miss the timeout.)
39
+ * `cds.tx(fn)` as a new root transaction with a deadlock guard: throws BackendError 503
40
+ * `ODATANO_NESTED_TX_TIMEOUT` when no pooled connection arrives in time, and a late grant does no work.
66
41
  */
67
42
  async function detachedTx(label, fn, timeoutMs) {
68
43
  const effectiveTimeout = timeoutMs ?? effectiveTimeoutMs();
69
44
  let timedOut = false;
70
45
  let timer;
71
46
  const work = cds_1.default.tx(async (db) => {
72
- // cds.tx() starts this callback immediately; the pooled connection is only
73
- // acquired lazily by the first statement. Force the acquire NOW, then check
74
- // the abort flag — a late grant (after the caller already received the
75
- // timeout error) must roll back before doing any work.
47
+ // The connection is acquired lazily by the first statement: force it now, then check the abort
48
+ // flag so a grant after the timeout rolls back before doing any work.
76
49
  await db.begin();
77
50
  if (timedOut)
78
51
  throw new DetachedTxAbortedError(label);
@@ -84,8 +57,8 @@ async function detachedTx(label, fn, timeoutMs) {
84
57
  reject(new errors_1.BackendError(`${label}: could not begin a detached DB transaction within ${effectiveTimeout}ms. ` +
85
58
  `Most likely the calling request still holds the pooled DB connection open ` +
86
59
  `(in-process nested call — do not await this action while your request ` +
87
- `transaction is open; detach your reads into a committed cds.tx first, ` +
88
- `see docs/KNOWN_ISSUES.md issue 11). Alternatively the connection pool is exhausted.`, 503, error_codes_1.ERROR_CODES.NESTED_TX_TIMEOUT));
60
+ `transaction is open; detach your reads into a committed cds.tx first). ` +
61
+ `Alternatively the connection pool is exhausted.`, 503, error_codes_1.ERROR_CODES.NESTED_TX_TIMEOUT));
89
62
  }, effectiveTimeout);
90
63
  });
91
64
  try {
@@ -95,9 +68,7 @@ async function detachedTx(label, fn, timeoutMs) {
95
68
  if (timer)
96
69
  clearTimeout(timer);
97
70
  if (timedOut) {
98
- // The orphaned acquire may still be granted later; its callback aborts
99
- // itself via the flag. Observe the rejection so it never surfaces as an
100
- // unhandled promise rejection.
71
+ // The orphaned acquire may still be granted; observe its rejection so it is never unhandled.
101
72
  work.catch((e) => {
102
73
  if (!(e instanceof DetachedTxAbortedError)) {
103
74
  logger.warn(`Orphaned detached tx '${label}' failed after timeout: ${e instanceof Error ? e.message : String(e)}`);
@@ -1,30 +1,18 @@
1
1
  import { LedgerProtocolParameter } from "#cds-models/odatano/cardano";
2
- /**
3
- * Hex-encoded string (lower/upper-case depending on source)
4
- */
2
+ /** Hex-encoded string (case depends on source) */
5
3
  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
- */
4
+ /** Lovelace amount; a string preserves precision above Number.MAX_SAFE_INTEGER (max supply is 4.5e16). */
11
5
  export type Lovelace = number | string;
12
- /**
13
- * JSON Value Type - Represents any valid JSON value
14
- */
6
+ /** Any valid JSON value */
15
7
  export type JSONValue = string | number | boolean | {
16
8
  [key: string]: JSONValue;
17
9
  } | JSONValue[] | null;
18
- /**
19
- * Amount Data Structure Type - Multi-asset amount line as returned by common Cardano APIs
20
- */
10
+ /** Multi-asset amount line as returned by common Cardano APIs */
21
11
  export interface Amount {
22
12
  unit: string;
23
13
  quantity: string;
24
14
  }
25
- /**
26
- * Transaction Input Data Structure Type
27
- */
15
+ /** Transaction input */
28
16
  export interface TxInputLine {
29
17
  address: string;
30
18
  amount: Amount[];
@@ -36,9 +24,7 @@ export interface TxInputLine {
36
24
  isCollateral?: boolean;
37
25
  isReference?: boolean;
38
26
  }
39
- /**
40
- * Transaction Output Data Structure Type
41
- */
27
+ /** Transaction output */
42
28
  export interface TxOutputLine {
43
29
  address: string;
44
30
  amount: Amount[];
@@ -50,16 +36,57 @@ export interface TxOutputLine {
50
36
  referenceScriptHash?: Hex | null;
51
37
  }
52
38
  /**
53
- * Transaction Data Structure Type - Normalized transaction structure
54
- */
39
+ * Normalized certificate kinds; unknown types pass through as the raw source string. A Conway
40
+ * stake+vote delegation is split into `pool_delegation` + `vote_delegation` sharing one `certIndex`.
41
+ */
42
+ 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 & {});
43
+ /** One certificate of a transaction (crawler ledger-state coverage). */
44
+ export interface TxCertificate {
45
+ /** Position in the transaction's certificate list as the source reports it. */
46
+ certIndex: number;
47
+ kind: CertificateKind;
48
+ /** Reward account (bech32) the certificate concerns, when it has one. */
49
+ stakeAddress?: string | null;
50
+ /** Stake pool (bech32) for delegation / registration / retirement. */
51
+ poolId?: string | null;
52
+ /** DRep (CIP-129 bech32), or `drep_always_abstain` / `drep_always_no_confidence`. */
53
+ drepId?: string | null;
54
+ /** Deposit paid or refunded, lovelace as string. */
55
+ deposit?: Lovelace | string | null;
56
+ /** Retirement epoch of a pool retirement. */
57
+ epoch?: number | null;
58
+ }
59
+ /** One reward-account withdrawal of a transaction. */
60
+ export interface TxWithdrawal {
61
+ stakeAddress: string;
62
+ /** Lovelace as string. */
63
+ amount: Lovelace | string;
64
+ }
65
+ /** Normalized transaction */
55
66
  export interface Transaction {
56
67
  hash: Hex;
57
68
  blockHash: Hex;
58
69
  blockHeight: number;
59
70
  slot: number;
60
71
  index: number;
72
+ /** What the ledger charged: the declared fee, or on a phase-2 failure the collateral consumed. */
61
73
  fee: Lovelace | string;
62
74
  deposit: Lovelace | string;
75
+ /**
76
+ * True when phase-2 failed: inputs/outputs not applied, collateral consumed, only the collateral
77
+ * return produced. Ogmios (`spends`) and Blockfrost (`valid_contract`) report it; Koios leaves it undefined.
78
+ */
79
+ spendsCollaterals?: boolean;
80
+ /**
81
+ * `total_collateral` from the body when declared; equals the collateral consumed on a phase-2 failure.
82
+ * Null when omitted, the charge is then derived from the resolved collateral inputs minus the return.
83
+ */
84
+ totalCollateral?: Lovelace | string | null;
85
+ /**
86
+ * Signed net mint/burn per unit (negative = burn), never `lovelace`. Ogmios and Koios report it;
87
+ * Blockfrost leaves it undefined and the indexer derives it from resolved input/output assets.
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;
@@ -67,10 +94,12 @@ export interface Transaction {
67
94
  inputs: TxInputLine[];
68
95
  outputs: TxOutputLine[];
69
96
  metadata?: MetadataLabelTx[];
97
+ /** Certificates; `[]` when the tx has none, undefined when the source does not report them (Blockfrost). */
98
+ certificates?: TxCertificate[];
99
+ /** Reward-account withdrawals; same `[]` vs undefined convention as `certificates`. */
100
+ withdrawals?: TxWithdrawal[];
70
101
  }
71
- /**
72
- * Address Data Structure Type - Address view, including current value and known UTxOs
73
- */
102
+ /** Address view with current value and known UTxOs */
74
103
  export interface Address {
75
104
  address: string;
76
105
  stakeAddress: string | null;
@@ -80,9 +109,7 @@ export interface Address {
80
109
  utxos: UTxO[];
81
110
  transactions?: Transaction[];
82
111
  }
83
- /**
84
- * UTxO Data Structure Type - Unspent transaction outputs (UTxOs)
85
- */
112
+ /** Unspent transaction output */
86
113
  export interface UTxO {
87
114
  txHash: Hex;
88
115
  outputIndex: number;
@@ -93,9 +120,7 @@ export interface UTxO {
93
120
  scriptRef?: Hex | null;
94
121
  inlineDatum?: string | null;
95
122
  }
96
- /**
97
- * Block Data Structure Type - Basic block information structure
98
- */
123
+ /** Basic block information */
99
124
  export interface BlockData {
100
125
  time: number;
101
126
  height: number | null;
@@ -108,9 +133,7 @@ export interface BlockData {
108
133
  txCount: number;
109
134
  fees?: string | null;
110
135
  }
111
- /**
112
- * Supply Data Structure Type - Network supply information
113
- */
136
+ /** Network supply */
114
137
  export interface Supply {
115
138
  max: string;
116
139
  total: string;
@@ -119,23 +142,17 @@ export interface Supply {
119
142
  treasury: string;
120
143
  reserves: string;
121
144
  }
122
- /**
123
- * Stake Data Structure Type - Network stake information
124
- */
145
+ /** Network stake */
125
146
  export interface Stake {
126
147
  live: string;
127
148
  active: string;
128
149
  }
129
- /**
130
- * Network Information Data Structure Type - Network supply and stake information
131
- */
150
+ /** Network supply and stake */
132
151
  export interface NetworkInformation {
133
152
  supply: Supply;
134
153
  stake: Stake;
135
154
  }
136
- /**
137
- * Epoch Data Structure Type - Epoch information
138
- */
155
+ /** Epoch information */
139
156
  export interface EpochData {
140
157
  epoch: number;
141
158
  start_time: number;
@@ -148,17 +165,13 @@ export interface EpochData {
148
165
  fees: string;
149
166
  active_stake: string | null;
150
167
  }
151
- /**
152
- * Metadata Label Transaction Data Structure Type - Transaction metadata under a specific label
153
- */
168
+ /** Transaction metadata under one label */
154
169
  export interface MetadataLabelTx {
155
170
  txHash: Hex;
156
171
  label: number | string;
157
172
  json?: JSONValue;
158
173
  }
159
- /**
160
- * Account Data Structure Type - Stake account information
161
- */
174
+ /** Stake account information */
162
175
  export interface AccountData {
163
176
  stakeaddress: string;
164
177
  active: boolean;
@@ -173,16 +186,16 @@ export interface AccountData {
173
186
  drepId: string | null;
174
187
  addresses: Address[];
175
188
  }
176
- /**
177
- * Pool Data Structure Type - Pool information
178
- */
189
+ /** Pool information */
179
190
  export interface PoolData {
180
191
  poolId: string;
181
192
  vrfKeyHash: string;
182
193
  blocksMinted: number;
183
- blocksEpoch: number;
194
+ /** Blocks minted in the current epoch; null when the backend has no such figure (Koios). */
195
+ blocksEpoch: number | null;
184
196
  liveStake: string;
185
197
  liveSize: number;
198
+ /** Fraction of the ideal (saturated) pool size, NOT percent: 0.7542 = 75.42 %. */
186
199
  liveSaturation: number;
187
200
  liveDelegators: number;
188
201
  activeStake: string;
@@ -192,9 +205,7 @@ export interface PoolData {
192
205
  fixedCost: string;
193
206
  rewardAccount: string;
194
207
  }
195
- /**
196
- * Drep Data Structure Type - Drep information
197
- */
208
+ /** DRep information */
198
209
  export interface DrepData {
199
210
  drepId: string;
200
211
  hex: string;
@@ -204,11 +215,7 @@ export interface DrepData {
204
215
  retired: boolean;
205
216
  expired: boolean;
206
217
  }
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
- */
218
+ /** Normalized native-asset metadata and supply; fields a backend does not expose are null. */
212
219
  export interface AssetInfo {
213
220
  unit: string;
214
221
  policyId: string;
@@ -227,10 +234,7 @@ export interface AssetInfo {
227
234
  registryUrl: string | null;
228
235
  registryLogo: string | null;
229
236
  }
230
- /**
231
- * Asset History Entry - single mint or burn event.
232
- * `quantity` is always the ABSOLUTE amount; sign info lives in `action`.
233
- */
237
+ /** One mint or burn event; `quantity` is absolute, the sign lives in `action`. */
234
238
  export interface AssetHistoryEntry {
235
239
  unit: string;
236
240
  txHash: string;
@@ -239,9 +243,7 @@ export interface AssetHistoryEntry {
239
243
  blockTime: number | null;
240
244
  blockHeight: number | null;
241
245
  }
242
- /**
243
- * Ledger Protocol Parameters Data Structure Type - Current protocol parameters
244
- */
246
+ /** Current protocol parameters */
245
247
  export type LedgerProtocolParameters = {
246
248
  network: string;
247
249
  epoch: number;
@@ -278,20 +280,26 @@ export type LedgerProtocolParameters = {
278
280
  fetchedAt: string;
279
281
  source: string;
280
282
  };
281
- /**
282
- * Mint/Burn Asset Action Type
283
- */
283
+ /** Mint/burn action */
284
284
  export type MintAction = {
285
285
  /** Asset unit to mint/burn (policyId + assetName) */
286
286
  assetUnit: string;
287
- /** Quantity to mint (positive) or burn (negative) */
287
+ /** Positive to mint, negative to burn */
288
288
  quantity: bigint;
289
- /** Optional redeemer data (integer). Defaults to 0 if not specified. */
289
+ /** Optional integer redeemer, default 0 */
290
290
  redeemer?: number;
291
+ /**
292
+ * Per-action minting policy (CBOR hex, applied as-is) for multi-policy transactions; overrides the
293
+ * top-level mintingPolicyScript. The assetUnit must carry this script's policyId.
294
+ */
295
+ mintingPolicyScript?: string;
296
+ /**
297
+ * Per-action redeemer (parsed PlutusData JSON), only with mintingPolicyScript; falls back to mintRedeemer.
298
+ * Actions on the same policy must agree (one redeemer per policy in the ledger).
299
+ */
300
+ redeemerJson?: JSONValue;
291
301
  };
292
- /**
293
- * Plutus Script Execution Type - For spending from script addresses
294
- */
302
+ /** Plutus script execution for spending from a script address */
295
303
  export type PlutusScriptExecution = {
296
304
  /** Validator script (CBOR hex) */
297
305
  validatorScript: string;
@@ -302,12 +310,10 @@ export type PlutusScriptExecution = {
302
310
  };
303
311
  /** Redeemer data (JSON value that will be converted to PlutusData) */
304
312
  redeemer: JSONValue;
305
- /** Datum data (JSON value, optional - required for hash-based datums) */
313
+ /** Datum (JSON value), required for hash-based datums */
306
314
  datum?: JSONValue;
307
315
  };
308
- /**
309
- * Transaction Build Request Type - Parameters for building a transaction, including optional minting and Plutus execution details
310
- */
316
+ /** Parameters for building a transaction, with optional minting and Plutus execution */
311
317
  export type TxBuildRequest = {
312
318
  network: 'mainnet' | 'preprod' | 'preview';
313
319
  senderAddress: string;
@@ -327,7 +333,7 @@ export type TxBuildRequest = {
327
333
  outputDatum?: JSONValue;
328
334
  /** Required signers - Ed25519 key hashes (hex, 28 bytes each) */
329
335
  requiredSigners?: string[];
330
- /** Script parameters — PlutusData JSON array applied to script before building */
336
+ /** Script parameters (PlutusData JSON array) applied to the script before building */
331
337
  scriptParams?: JSONValue[];
332
338
  /** Optional inline datum for minted token output (PlutusData JSON, parsed) */
333
339
  inlineDatum?: JSONValue;
@@ -336,29 +342,19 @@ export type TxBuildRequest = {
336
342
  /** When true, route output to enterprise script address derived from applied script hash */
337
343
  lockOnScript?: boolean;
338
344
  /**
339
- * Optional UTxOs that MUST be consumed as inputs. Resolved and added to the TxBuilder
340
- * BEFORE coin selection runs. Coin selection then only covers the remaining shortfall.
341
- * Deduplicated against plutusScriptExecution.scriptUtxo in spend transactions.
342
- * Primary use case: one-shot minting seeds (policy parameterized with a specific TxOutRef).
345
+ * UTxOs that must be consumed, added before coin selection (one-shot minting seeds);
346
+ * deduplicated against plutusScriptExecution.scriptUtxo.
343
347
  */
344
348
  forceInputs?: Array<{
345
349
  txHash: string;
346
350
  outputIndex: number;
347
351
  }>;
348
- /**
349
- * Optional CIP-31 reference inputs (read-only, not consumed). Resolved to full UTxOs
350
- * and passed as readonlyRefInputs to Buildooor. The validator can read these UTxOs'
351
- * datums/values without consuming them (e.g., oracle feeds, shared config).
352
- */
352
+ /** CIP-31 reference inputs (read-only, not consumed), passed as readonlyRefInputs to Buildooor. */
353
353
  referenceInputs?: Array<{
354
354
  txHash: string;
355
355
  outputIndex: number;
356
356
  }>;
357
- /**
358
- * Optional additional outputs appended after the primary recipient output, before change.
359
- * Each extra output is independently min-ADA checked. Used for multi-output state-machine
360
- * transitions (e.g. counter update + batch NFT outputs in a single transaction).
361
- */
357
+ /** Additional outputs after the primary recipient output, before change; each min-ADA checked. */
362
358
  extraOutputs?: Array<{
363
359
  address: string;
364
360
  lovelaceAmount: string;
@@ -369,52 +365,28 @@ export type TxBuildRequest = {
369
365
  inlineDatum?: JSONValue;
370
366
  referenceScript?: string;
371
367
  }>;
372
- /**
373
- * Optional Plutus V3 validator CBOR hex to attach as a referenceScript on the primary
374
- * recipient output (CIP-33). Adding a ref script significantly increases the output's
375
- * min-ADA — consumers must provide enough lovelaceAmount to cover it.
376
- */
368
+ /** Plutus V3 validator CBOR hex attached as CIP-33 reference script on the recipient output; raises its min-ADA. */
377
369
  referenceScript?: string;
378
- /**
379
- * Optional validity-interval start in Posix milliseconds. Sets `invalidBefore`
380
- * on the built transaction so that Plutus validators checking
381
- * `expect Finite(lower) = tx.validity_range.lower_bound.bound_type` see a finite bound.
382
- * Defaults inside the builder to `Date.now() - 120_000` (script builds only).
383
- */
370
+ /** Validity start in Posix ms (`invalidBefore`); builder default `now - 120_000` for script builds. */
384
371
  validityStartMs?: string;
385
- /**
386
- * Optional validity-interval end in Posix milliseconds. Sets `invalidAfter` (ledger TTL).
387
- * Defaults inside the builder to `Date.now() + 3_600_000` (script builds only).
388
- */
372
+ /** Validity end in Posix ms (`invalidAfter`, ledger TTL); builder default `now + 3_600_000` for script builds. */
389
373
  validityEndMs?: string;
390
374
  };
391
- /**
392
- * Transaction Build Request for Mint/Burn operations - requires mintActions and mintingPolicyScript
393
- */
375
+ /** Mint/burn build request: mintActions and mintingPolicyScript required */
394
376
  export type TxBuildMintRequest = TxBuildRequest & {
395
377
  mintActions: MintAction[];
396
378
  mintingPolicyScript: string;
397
379
  };
398
- /**
399
- * Transaction Build Request for Plutus spending - requires plutusScriptExecution
400
- */
380
+ /** Plutus spend build request: plutusScriptExecution required */
401
381
  export type TxBuildPlutusSpendRequest = TxBuildRequest & {
402
382
  plutusScriptExecution: PlutusScriptExecution;
403
383
  };
404
- /**
405
- * Execution Budget for Plutus scripts
406
- */
384
+ /** Execution budget for Plutus scripts */
407
385
  export type ExecutionBudget = {
408
386
  memory: number;
409
387
  cpu: number;
410
388
  };
411
- /**
412
- * Script evaluation result from Ogmios
413
- */
414
- /**
415
- * Ogmios validator descriptor — `purpose:index` (e.g., "spend:0", "mint:1")
416
- * or a structured object with purpose + index fields depending on Ogmios version.
417
- */
389
+ /** Ogmios validator descriptor: `purpose:index` (e.g. "spend:0") or `{ purpose, index }` depending on version */
418
390
  export type ScriptValidator = string | {
419
391
  purpose: string;
420
392
  index: number;
@@ -423,13 +395,9 @@ export type ScriptEvaluationResult = {
423
395
  validator: ScriptValidator;
424
396
  budget: ExecutionBudget;
425
397
  };
426
- /**
427
- * Transaction evaluator function type - evaluates script execution units
428
- */
398
+ /** Evaluates script execution units of an unsigned tx */
429
399
  export type TxEvaluator = (unsignedTxCbor: string) => Promise<ScriptEvaluationResult[]>;
430
- /**
431
- * Transaction Build Context Type - Context for building a transaction
432
- */
400
+ /** Context for building a transaction */
433
401
  export type TxBuildContext = {
434
402
  utxos: UTxO[];
435
403
  protocolParameters: LedgerProtocolParameter;
@@ -438,9 +406,7 @@ export type TxBuildContext = {
438
406
  /** CIP-31 reference input UTxOs (read-only, not consumed). Resolved from referenceInputs refs. */
439
407
  referenceInputUtxos?: UTxO[];
440
408
  };
441
- /**
442
- * Transaction Build Result Type
443
- */
409
+ /** Transaction build result */
444
410
  export type TxBuildResult = {
445
411
  senderAddress?: string;
446
412
  network?: 'mainnet' | 'preprod' | 'preview';
@@ -475,9 +441,7 @@ export type TxBuildResult = {
475
441
  /** Number of CIP-31 reference inputs included in the built transaction (0 if referenceInputs was not used). */
476
442
  referenceInputsUsed?: number;
477
443
  };
478
- /**
479
- * Supported external signer types
480
- */
444
+ /** Supported external signer types */
481
445
  export declare enum ExternalSignerType {
482
446
  /** Cardano CLI - Reference implementation for signing */
483
447
  CARDANO_CLI = "cardano-cli",
@@ -490,9 +454,7 @@ export declare enum ExternalSignerType {
490
454
  /** Hardware Security Module (server-side PKCS#11) */
491
455
  HSM = "hsm"
492
456
  }
493
- /**
494
- * Signing request status
495
- */
457
+ /** Signing request status */
496
458
  export declare enum SigningStatus {
497
459
  /** Request created, awaiting signing */
498
460
  PENDING = "pending",
@@ -507,9 +469,7 @@ export declare enum SigningStatus {
507
469
  /** Request expired (not signed within TTL) */
508
470
  EXPIRED = "expired"
509
471
  }
510
- /**
511
- * Instructions for external signers
512
- */
472
+ /** Instructions for external signers */
513
473
  export interface SigningInstructions {
514
474
  /** Signer type hint (which tool/wallet to use) */
515
475
  signerTypeHint: ExternalSignerType;
@@ -527,12 +487,7 @@ export interface SigningInstructions {
527
487
  /** Copy-pasteable cardano-cli signing recipe (for CLI/hardware signers) */
528
488
  cardanoCliCommand?: string;
529
489
  }
530
- /**
531
- * Unsigned transaction export payload for external signers
532
- *
533
- * This is the standardized format returned by BuildTransaction actions.
534
- * External signers use this payload to sign the transaction.
535
- */
490
+ /** Unsigned transaction payload returned by the Build actions for external signers */
536
491
  export interface UnsignedTxExportPayload {
537
492
  /** Unique identifier for this signing request */
538
493
  signingRequestId: string;
@@ -553,9 +508,7 @@ export interface UnsignedTxExportPayload {
553
508
  /** Signing instructions for the external signer */
554
509
  signingInstructions: SigningInstructions;
555
510
  }
556
- /**
557
- * Signed transaction submission payload
558
- */
511
+ /** Signed transaction submission payload */
559
512
  export interface SignedTxPayload {
560
513
  /** Original signing request ID */
561
514
  signingRequestId: string;
@@ -568,9 +521,7 @@ export interface SignedTxPayload {
568
521
  /** Optional: Signer identification (wallet name, etc.) */
569
522
  signerInfo?: string;
570
523
  }
571
- /**
572
- * Signing workflow state
573
- */
524
+ /** Signing workflow state */
574
525
  export interface SigningWorkflowState {
575
526
  /** Current status of the signing workflow */
576
527
  status: SigningStatus;
@@ -593,9 +544,7 @@ export interface SigningWorkflowState {
593
544
  failed?: string;
594
545
  };
595
546
  }
596
- /**
597
- * Result of signature verification
598
- */
547
+ /** Result of signature verification */
599
548
  export interface SignatureVerificationResult {
600
549
  /** Whether the signature is valid */
601
550
  isValid: boolean;
@@ -610,9 +559,7 @@ export interface SignatureVerificationResult {
610
559
  /** Error message if verification failed */
611
560
  errorMessage?: string;
612
561
  }
613
- /**
614
- * Options for signature verification
615
- */
562
+ /** Options for signature verification */
616
563
  export interface VerificationOptions {
617
564
  /** Expected transaction body hash (from the build) */
618
565
  expectedTxBodyHash?: string;
@@ -621,9 +568,7 @@ export interface VerificationOptions {
621
568
  /** List of required signer key hashes (public key hashes) */
622
569
  requiredSigners?: string[];
623
570
  }
624
- /**
625
- * HSM Configuration for PKCS#11 integration
626
- */
571
+ /** HSM configuration for PKCS#11 integration */
627
572
  export interface HsmConfig {
628
573
  /** Whether HSM signing is enabled */
629
574
  enabled: boolean;
@@ -637,12 +582,10 @@ export interface HsmConfig {
637
582
  keyId?: string;
638
583
  /** Key label for CKA_LABEL lookup */
639
584
  keyLabel?: string;
640
- /** Optional CDS role required for HSM actions (SignWithHsm, SignAndSubmitWithHsm, GetHsmStatus). When set, only users with this role can invoke HSM operations. */
585
+ /** CDS role required for the HSM actions (SignWithHsm, SignAndSubmitWithHsm, GetHsmStatus) */
641
586
  requiresRole?: string;
642
587
  }
643
- /**
644
- * HSM signing result
645
- */
588
+ /** HSM signing result */
646
589
  export interface HsmSignResult {
647
590
  /** Ed25519 signature (64 bytes, hex) */
648
591
  signatureHex: string;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SigningStatus = exports.ExternalSignerType = void 0;
4
- /**
5
- * Supported external signer types
6
- */
4
+ /** Supported external signer types */
7
5
  var ExternalSignerType;
8
6
  (function (ExternalSignerType) {
9
7
  /** Cardano CLI - Reference implementation for signing */
@@ -17,9 +15,7 @@ var ExternalSignerType;
17
15
  /** Hardware Security Module (server-side PKCS#11) */
18
16
  ExternalSignerType["HSM"] = "hsm";
19
17
  })(ExternalSignerType || (exports.ExternalSignerType = ExternalSignerType = {}));
20
- /**
21
- * Signing request status
22
- */
18
+ /** Signing request status */
23
19
  var SigningStatus;
24
20
  (function (SigningStatus) {
25
21
  /** Request created, awaiting signing */