@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
@@ -1,9 +1,7 @@
1
1
  import type { CardanoTxBuilder } from "./cardano-tx";
2
2
  import type { TxBuildRequest, TxBuildMintRequest, TxBuildPlutusSpendRequest, TxBuildContext, TxBuildResult, LedgerProtocolParameters } from "../../utils/types";
3
3
  import { CardanoClient } from "../cardano-client";
4
- /**
5
- * BuildooorTxBuilder - Implementation of CardanoTxBuilder using Buildooor library
6
- */
4
+ /** CardanoTxBuilder implementation on top of Buildooor. */
7
5
  export declare class BuildooorTxBuilder implements CardanoTxBuilder {
8
6
  readonly name = "BuildooorTxBuilder";
9
7
  private txBuilder;
@@ -11,40 +9,28 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
11
9
  private genesisInfos;
12
10
  private paramsFingerprint;
13
11
  /**
14
- * Chain cost-model arrays kept verbatim for language-view hashing. Maintained by
15
- * _mapCostModels (in lockstep with the named-key models the TxBuilder is built
16
- * with); consumed by _languageViewCostModels. Empty when the current parameters
17
- * carry no usable cost models (library defaults in effect).
12
+ * Chain cost-model arrays kept verbatim for language-view hashing; set by _mapCostModels,
13
+ * empty when the current parameters carry no usable cost models.
18
14
  */
19
15
  private rawCostModelArrays;
20
16
  /**
21
- * Initialize the builder
22
- * @param client - The CardanoClient instance
23
- * @param protocolParams - Optional protocol parameters (if not provided, fetched from backend)
17
+ * Initialize the builder.
18
+ * @param protocolParams - optional; fetched from the backend when omitted
24
19
  */
25
20
  init(client: CardanoClient, protocolParams?: LedgerProtocolParameters): Promise<void>;
26
21
  /**
27
- * Rebuild the TxBuilder when the per-request protocol parameters differ from
28
- * the ones the current TxBuilder was constructed with. Buildooor's TxBuilder
29
- * has no setter for protocol params, but its constructor is cheap, so we
30
- * rebuild on change (effectively once per epoch) instead of staying frozen
31
- * at init-time parameters for the process lifetime.
22
+ * Rebuild the TxBuilder when the per-request protocol parameters differ from the current
23
+ * ones; the TxBuilder has no setter but its constructor is cheap (effectively once per epoch).
32
24
  */
33
25
  private _ensureCurrentProtocolParameters;
34
26
  private _applyProtocolParameters;
35
- /**
36
- * Build unsigned transfer transaction (ADA-only or with native assets).
37
- */
27
+ /** Build an unsigned transfer transaction (ADA-only or with native assets). */
38
28
  buildUnsignedTransfer(req: TxBuildRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
39
- /**
40
- * Build unsigned transfer transaction with attached metadata.
41
- */
29
+ /** Build an unsigned transfer transaction with attached metadata. */
42
30
  buildUnsignedTransactionWithMetadata(req: TxBuildRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
43
31
  /**
44
- * Shared non-script transfer build. The two public entry points only differ in
45
- * the optional pieces of the request they carry (assets/outputDatum on the
46
- * plain-transfer path, metadataJson on the metadata path) — all handled here
47
- * conditionally on the field being present, so behaviour matches both.
32
+ * Shared non-script transfer build; assets, outputDatum and metadataJson are each
33
+ * handled only when present in the request.
48
34
  */
49
35
  private _buildSimpleTransfer;
50
36
  buildUnsignedMintTransaction(req: TxBuildMintRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
@@ -54,47 +40,25 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
54
40
  /** Build the standard TxBuildResult object */
55
41
  private _buildResult;
56
42
  /**
57
- * Build a script-bearing transaction whose redeemers carry *real* execution units and
58
- * whose fee covers them.
59
- *
60
- * Background (verified against the vendored Buildooor source): `initTxBuild` constructs
61
- * every redeemer with a dummy budget — caller-supplied execution units in the build args
62
- * are never read — and `onEvaluationResult` unconditionally stamps each redeemer with
63
- * the budget the local CEK run consumed, even when the script failed (partial budget).
64
- * So the declared units are whatever the *local* evaluation produced, and any cushion
65
- * passed into the args silently evaporates. This method makes the declared units real:
66
- *
67
- * 1. First pass: build once; redeemers now carry the local CEK budgets.
68
- * 2. Evaluate that CBOR via Ogmios (when configured) for authoritative per-redeemer
69
- * budgets, cushioned by EXECUTION_UNIT_BUFFER / ABS_*_BUFFER.
70
- * 3. Resolve target units per redeemer (Ogmios beats buffered-local; a local failure
71
- * without an Ogmios result aborts — see makeScriptBuildOpts).
72
- * 4. Second pass with a fee floor covering the target units (Buildooor prices the fee
73
- * from its own local budgets, so the floor adds the price + encoding-size delta).
74
- * 5. Stamp the target units into the redeemers and recompute scriptDataHash.
43
+ * Build a script-bearing transaction with real execution units: Buildooor stamps local CEK
44
+ * budgets and ignores caller-supplied units, so build once, evaluate via Ogmios when available,
45
+ * rebuild with a fee floor for the target units, then stamp them and recompute scriptDataHash.
75
46
  */
76
47
  private _buildScriptTx;
77
48
  /**
78
- * Evaluate a transaction via Ogmios and return cushioned budgets keyed per redeemer
79
- * (`tag:index`). Returns undefined when the evaluation is unusable (transient backend
80
- * failure, empty result) so callers fall back to buffered local units. A
81
- * TransactionValidationError or ScriptValidationError from the evaluator is
82
- * authoritative (the script really failed on the ledger) and is rethrown.
49
+ * Evaluate via Ogmios; returns cushioned budgets keyed `tag:index`, or undefined when the
50
+ * evaluation is unusable (transient failure, empty result). Validation errors are rethrown.
83
51
  */
84
52
  private _evaluateExUnitsByRedeemer;
85
53
  /**
86
- * Combined cushion: relative multiplier catches proportional drift on large
87
- * validators, absolute floor catches sub-percent drift on small ones (observed
88
- * when metadata affects the real tx body vs the evaluator's ScriptContext).
54
+ * Cushion: relative multiplier for proportional drift on large validators, absolute floor
55
+ * for sub-percent drift on small ones.
89
56
  */
90
57
  private _applyExUnitBuffer;
91
58
  /**
92
- * Decide the execution units each redeemer must declare.
93
- * - Local run succeeded + Ogmios result → max of both (local is a real lower bound).
94
- * - Local run succeeded, no Ogmios → buffered local (cushions local↔ledger drift).
95
- * - Local run failed + Ogmios result → Ogmios (the local partial budget is meaningless).
96
- * - Local run failed, no Ogmios → abort: declaring unreliable units would forfeit the
97
- * collateral of whoever signs and submits the returned CBOR.
59
+ * Execution units each redeemer must declare: max(local, Ogmios) when both exist, buffered
60
+ * local without Ogmios, Ogmios alone after a local failure; a local failure without Ogmios
61
+ * aborts because unreliable units would forfeit the signer's collateral.
98
62
  */
99
63
  private _resolveTargetExUnits;
100
64
  /** Fee delta of the target vs local units, priced like Buildooor's own fee loop. */
@@ -103,15 +67,9 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
103
67
  private _exUnitsSizeDelta;
104
68
  private _txFeePerByte;
105
69
  /**
106
- * Replace the redeemers' execution units and recompute scriptDataHash.
107
- *
108
- * Still not implemented via TxBuilder.overrideTxRedeemers, although buildooor
109
- * 0.2.9 fixed its old-witness-set hashing (our PR): that method hashes with the
110
- * builder's named-key cost models, which clamp the chain array to the parameter
111
- * count the library release knows — wrong whenever the on-chain cost model has
112
- * grown past that (ScriptIntegrityHashMismatch at submit). This recompute with
113
- * _languageViewCostModels (raw chain arrays) stays governance-proof, so the hash
114
- * is recomputed here even when the target units already match.
70
+ * Replace the redeemers' execution units and recompute scriptDataHash with the raw chain
71
+ * cost-model arrays (TxBuilder.overrideTxRedeemers hashes with clamped named-key models,
72
+ * which mismatches once the on-chain cost model grows). Recomputed even when units match.
115
73
  */
116
74
  private _stampExecUnits;
117
75
  /**
@@ -121,49 +79,43 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
121
79
  */
122
80
  private _usedLanguageViewOpts;
123
81
  /**
124
- * Cost models for language-view hashing. The named-key objects the TxBuilder was
125
- * constructed with clamp the chain array to the parameter count this costmodels-ts
126
- * release knows (e.g. 297 for V3 pre-protocol-11), but the ledger hashes EVERY
127
- * entry the chain serves (350 on protocol-11 networks). toCostModelArrVN passes
128
- * array form through unclamped, so substitute the raw chain arrays where we have
129
- * them. (The named-key form stays in the TxBuilder — the CEK machine needs it.)
82
+ * Cost models for language-view hashing: named-key objects clamp the chain array to the
83
+ * parameter count this library release knows, but the ledger hashes every entry served,
84
+ * so raw chain arrays (passed through unclamped) are substituted where available.
130
85
  */
131
86
  private _languageViewCostModels;
132
87
  /**
133
- * Split UTxOs into forced inputs (must be consumed) and remaining candidates (free for
134
- * coin selection / collateral). Refs in forceInputs that are not present in utxos are
135
- * silently ignored — the resolver upstream has already validated existence.
88
+ * Split UTxOs into forced inputs (must be consumed) and remaining candidates; forceInputs
89
+ * refs absent from utxos are ignored (existence is validated upstream).
136
90
  */
137
91
  private _partitionForcedInputs;
92
+ /** Map resolved CIP-31 reference input UTxOs to Buildooor LedgerUTxO; empty when none. */
93
+ private _mapReferenceInputs;
138
94
  /**
139
- * Map resolved CIP-31 reference input UTxOs to Buildooor LedgerUTxO format.
140
- * Returns empty array when no reference inputs are provided.
95
+ * Funding contributed by extra outputs on a mint build: their summed lovelace plus, per asset
96
+ * unit, the demand the transaction's own positive mints do not cover.
141
97
  */
142
- private _mapReferenceInputs;
98
+ private _extraOutputsFundingAfterMint;
99
+ /**
100
+ * Script a mint action executes under: its per-action policy when set, else the request's
101
+ * top-level policy script.
102
+ */
103
+ private _mintActionScript;
143
104
  /**
144
- * Build the Buildooor mint-entry array shared by the mint-only flow and the
145
- * combined spend+mint flow (Buildooor ignores caller-supplied execution units;
146
- * they are stamped into the redeemers post-build by _buildScriptTx).
105
+ * Buildooor mint entries shared by the mint-only and combined spend+mint flows. Each action may
106
+ * carry its own policy script and redeemer (falling back to the request-level ones); the ledger
107
+ * holds ONE redeemer per policy, so actions on the same policy must agree, checked here.
147
108
  */
148
109
  private _buildMintEntries;
149
110
  /**
150
- * Consumer-facing context for insufficient-funds rejections after the
151
- * collateral partition: the builder's own "not enough …" message counts only
152
- * the funding pool, and without this the reservation is invisible ("but the
153
- * address HAS enough ADA").
111
+ * Context for insufficient-funds rejections after the collateral partition: the builder's
112
+ * message counts only the funding pool, so the reservation would otherwise be invisible.
154
113
  */
155
114
  private _collateralPartitionContext;
156
115
  /**
157
- * Pick a collateral UTxO and return remaining funding UTxOs.
158
- * Throws if no ADA-only UTxO is available.
159
- *
160
- * Selection: the SMALLEST ADA-only UTxO that still covers the static
161
- * COLLATERAL_LOVELACE floor (5 ADA ≳ collateralPercentage × any realistic fee).
162
- * The previous "first ADA-only" pick failed both ways: a dust UTxO below
163
- * collateralPercentage × fee is rejected at submit, and a large UTxO is
164
- * fully forfeited on phase-2 failure (Buildooor sets no collateralReturn
165
- * for ADA-only collateral). Everything above the floor is therefore handed
166
- * back via an explicit collateralReturn when the excess satisfies min-ADA.
116
+ * Pick the smallest ADA-only UTxO covering COLLATERAL_LOVELACE as collateral and return the
117
+ * rest as funding; excess above the floor goes back via collateralReturn when it meets min-ADA
118
+ * (Buildooor sets no collateralReturn for ADA-only collateral). Throws without an ADA-only UTxO.
167
119
  */
168
120
  private _setupCollateral;
169
121
  /** Build a Ledger Value from lovelace + optional multi-asset array */
@@ -171,100 +123,59 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
171
123
  /** Build a TxOut with optional inline datum and optional reference script (CIP-33) */
172
124
  private _buildTxOut;
173
125
  /**
174
- * Parse a consumer-provided, CBOR-wrapped Plutus script and reject UPLC 1.0.0
175
- * code (PlutusV1/V2). `Script.fromCbor` defaults to PlutusV3, so V1/V2 bytes
176
- * would be hashed with the 0x03 prefix — a silently wrong script hash, i.e.
177
- * wrong policy IDs and unspendable script addresses with no error anywhere
178
- * down the line. The UPLC version is the first three flat-encoded naturals
179
- * of the unwrapped script: [1,0,0] (V1/V2) vs [1,1,0] (V3).
126
+ * Parse a CBOR-wrapped Plutus script and reject UPLC 1.0.0 code (V1/V2): Script.fromCbor
127
+ * defaults to V3 and would hash with the 0x03 prefix, giving a silently wrong script hash.
128
+ * The UPLC version is the first three flat naturals of the unwrapped script: [1,0,0] vs [1,1,0].
180
129
  */
181
130
  private _parsePlutusV3Script;
182
131
  /** Parse a Plutus V3 CBOR hex into a Buildooor Script for refScript attachment. */
183
132
  private _parseReferenceScript;
184
133
  /**
185
- * Map an input UTxO's scriptRef field to a Buildooor Script when possible.
186
- * UTxO.scriptRef is overloaded across backends: Blockfrost/Ogmios set it to a 28-byte
187
- * hash (56 hex chars), Koios sets it to the full CBOR script bytes. Only full bytes
188
- * are usable here — hash-only entries are preserved only on-chain, not in local eval.
134
+ * Map an input UTxO's scriptRef to a Script. Blockfrost/Ogmios set scriptRef to the 28-byte
135
+ * hash (56 hex chars), Koios to the full CBOR bytes; only full bytes are usable locally.
189
136
  */
190
137
  private _buildInputRefScript;
191
138
  /**
192
- * Compute the post-sort input order so __INPUT_IDX__ placeholders (FR-3) resolve to the
193
- * same indices Buildooor will assign during build(). Order: script-input first by convention,
194
- * then forced + funding sorted lexicographically on (txHash, outputIndex).
195
- * Buildooor sorts ALL inputs together; we mirror that exact behaviour via sortInputsLikeBuildooor.
139
+ * Post-sort input order so __INPUT_IDX__ placeholders resolve to the indices Buildooor assigns
140
+ * in build(): all inputs (script, forced, funding) sorted lexicographically on (txHash, outputIndex).
196
141
  */
197
142
  private _computeSortedInputs;
198
143
  /** Extract InputRef list from the Buildooor-shaped funding inputs returned by keepRelevant. */
199
144
  private _extractFundingRefs;
200
- /**
201
- * Resolve __INPUT_IDX__ placeholders (FR-3) inside each extraOutput.inlineDatum.
202
- * Returns a new array with resolved datums; non-datum fields pass through unchanged.
203
- */
145
+ /** Resolve __INPUT_IDX__ placeholders inside each extraOutput.inlineDatum; other fields pass through. */
204
146
  private _resolveExtraOutputPlaceholders;
205
147
  /**
206
- * Append parsed extraOutputs (FR-2) to the outputs array, enforcing min-ADA per entry.
207
- * Throws TransactionValidationError with the required min-ADA in the message so consumers
208
- * can adjust without having to inspect Buildooor internals.
148
+ * Append parsed extra outputs, enforcing min-ADA per entry; the rejection names the
149
+ * required min-ADA so consumers can adjust without inspecting Buildooor internals.
209
150
  */
210
151
  private _appendExtraOutputs;
211
152
  /**
212
- * Resolve the transaction's validity window (slots) from the request.
213
- * Falls back to `now - 2 min` / `now + 1 h` when the request omits bounds.
214
- * Script-validated builds must call this; plain transfers pass their own
215
- * explicit bounds through (no defaulting) so replay behavior is opt-in.
153
+ * Validity window (slots) from the request. Script builds default to `now - 2 min` / `now + 1 h`;
154
+ * plain transfers pass explicit bounds through without defaulting.
216
155
  */
217
156
  private _resolveValiditySlots;
218
157
  /**
219
- * Map ODATANO LedgerProtocolParameter to Buildooor's ProtocolParameters shape.
220
- *
221
- * Every field is null-guarded: a missing/null source value keeps the library
222
- * default instead of degrading to 0 (`Number(null) === 0` previously set
223
- * utxoCostPerByte = 0, disabling min-ADA checks entirely). Cost models and
224
- * execution-unit prices are mapped because they feed the scriptDataHash
225
- * (language views) and the fee/ExUnits math — stale defaults there cause
226
- * PPViewHashesDontMatch or fee underestimation on-chain.
158
+ * Map LedgerProtocolParameter to Buildooor's ProtocolParameters. Every field is null-guarded so a
159
+ * missing value keeps the library default instead of degrading to 0 (e.g. utxoCostPerByte = 0
160
+ * disables min-ADA); cost models and ExUnit prices feed scriptDataHash and the fee math.
227
161
  */
228
162
  private _mapLedgerParametersToBuildooorParams;
229
163
  /**
230
- * Parse the cost-models JSON blob (backend-normalized number arrays, keys
231
- * 'PlutusV1'/'PlutusV2'/'PlutusV3' or Ogmios 'plutus:vN') into Buildooor's
232
- * CostModels shape ('PlutusScriptVN' keys). Returns undefined when nothing
233
- * usable is found, so the caller can keep defaults and warn.
234
- *
235
- * Side effect: (re)sets this.rawCostModelArrays with the unclamped chain arrays
236
- * for the versions mapped here — the named-key conversion drops every entry past
237
- * the parameter count this costmodels-ts release knows, and the scriptDataHash
238
- * must cover all of them (see _languageViewCostModels).
164
+ * Parse the cost-models JSON (keys 'PlutusVN', 'plutus:vN' or 'PlutusScriptVN') into Buildooor's
165
+ * CostModels; undefined when nothing usable is found. Also (re)sets this.rawCostModelArrays with
166
+ * the unclamped chain arrays, which the scriptDataHash must cover (see _languageViewCostModels).
239
167
  */
240
168
  private _mapCostModels;
241
- /**
242
- * Map ODATANO UTxO to Ledger UTxO (ADA-only)
243
- */
169
+ /** Map an ADA-only UTxO to a Ledger UTxO. */
244
170
  private _mapOdatanoUtxoToLedgerUtxo;
245
- /**
246
- * Map ODATANO UTxO to Ledger UTxO (with multi-asset support)
247
- */
171
+ /** Map a UTxO (with multi-assets) to a Ledger UTxO. */
248
172
  private _mapMultiAssetUtxoToLedgerUtxo;
249
- /**
250
- * Map ODATANO metadata JSON to Ledger TxMetadata
251
- */
173
+ /** Map metadata JSON (label -> value) to Ledger TxMetadata. */
252
174
  private _mapOdatanoMetadataToLedgerMetadata;
253
175
  /**
254
- * Recursively convert JSON value to TxMetadatum.
255
- *
256
- * Ledger rules enforced here (instead of a node-side rejection or a raw 500):
257
- * - numbers must be integers (BigInt(1.5) would throw a bare RangeError)
258
- * - text and byte values are limited to 64 BYTES per metadatum — longer values
259
- * are chunked into a list of ≤64-byte pieces (the established convention,
260
- * e.g. CIP-25 long strings)
261
- * - strings prefixed with "0x" (even hex length) become byte metadata
262
- * - map keys are not auto-chunked (readers match on the literal key) — over-long
263
- * keys are rejected with a clear 400
264
- *
265
- * @param path position of `value` inside the metadata JSON (label-rooted, e.g.
266
- * "1155.result" or "721.files[0].src") — named in every rejection
267
- * so the consumer can locate the offending value.
176
+ * Recursively convert a JSON value to TxMetadatum, enforcing ledger rules: integers only, text/bytes
177
+ * over 64 BYTES chunked into a list, "0x..." strings become bytes, over-long map keys rejected.
178
+ * @param path label-rooted position of `value` (e.g. "721.files[0].src"), named in every rejection
268
179
  */
269
180
  private _jsonToTxMetadatum;
270
181
  }