@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,291 +1,93 @@
1
1
  import type { CardanoTxBuilder } from "./cardano-tx";
2
- import type { TxBuildRequest, TxBuildMintRequest, TxBuildPlutusSpendRequest, TxBuildContext, TxBuildResult, LedgerProtocolParameters } from "../../utils/types";
2
+ import type { TxBuildRequest, TxBuildMintRequest, TxBuildPlutusSpendRequest, TxBuildPlutusRequest, 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;
10
8
  private cardanoClient;
11
9
  private genesisInfos;
12
10
  private paramsFingerprint;
13
- /**
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).
18
- */
11
+ /** Chain cost-model arrays kept verbatim for language-view hashing. */
19
12
  private rawCostModelArrays;
20
- /**
21
- * Initialize the builder
22
- * @param client - The CardanoClient instance
23
- * @param protocolParams - Optional protocol parameters (if not provided, fetched from backend)
24
- */
13
+ /** Initialize the builder. Protocol parameters are fetched when omitted. */
25
14
  init(client: CardanoClient, protocolParams?: LedgerProtocolParameters): Promise<void>;
26
- /**
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.
32
- */
15
+ /** TxBuilder has no setter, so it is rebuilt when the protocol parameters change. */
33
16
  private _ensureCurrentProtocolParameters;
34
17
  private _applyProtocolParameters;
35
- /**
36
- * Build unsigned transfer transaction (ADA-only or with native assets).
37
- */
18
+ /** Build an unsigned transfer transaction (ADA-only or with native assets). */
38
19
  buildUnsignedTransfer(req: TxBuildRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
39
- /**
40
- * Build unsigned transfer transaction with attached metadata.
41
- */
20
+ /** Build an unsigned transfer transaction with attached metadata. */
42
21
  buildUnsignedTransactionWithMetadata(req: TxBuildRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
43
- /**
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.
48
- */
22
+ /** Shared non-script transfer build. */
49
23
  private _buildSimpleTransfer;
50
24
  buildUnsignedMintTransaction(req: TxBuildMintRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
25
+ private _buildMintTransaction;
51
26
  buildUnsignedPlutusSpendTransaction(req: TxBuildPlutusSpendRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
27
+ private _buildPlutusSpendTransaction;
28
+ buildUnsignedPlutusTransaction(req: TxBuildPlutusRequest, ctx: TxBuildContext): Promise<TxBuildResult>;
29
+ private _buildPlutusTransaction;
30
+ /** Appends the outputs in order. A CBOR inline datum keeps its bytes. */
31
+ private _appendPlutusOutputs;
32
+ private _minOutputLovelace;
52
33
  /** Extract CBOR, hash, fee, size, inputs and outputs from a built Buildooor Tx */
53
34
  private _extractTxDetails;
54
35
  /** Build the standard TxBuildResult object */
55
36
  private _buildResult;
56
- /**
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.
75
- */
76
37
  private _buildScriptTx;
77
- /**
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.
83
- */
84
38
  private _evaluateExUnitsByRedeemer;
85
- /**
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).
89
- */
90
39
  private _applyExUnitBuffer;
91
- /**
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.
98
- */
99
40
  private _resolveTargetExUnits;
100
41
  /** Fee delta of the target vs local units, priced like Buildooor's own fee loop. */
101
42
  private _exUnitsPriceDelta;
102
43
  /** CBOR size growth (bytes) from stamping larger budgets into the redeemers. */
103
44
  private _exUnitsSizeDelta;
104
45
  private _txFeePerByte;
105
- /**
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.
115
- */
116
46
  private _stampExecUnits;
117
- /**
118
- * Language-view selection for scriptDataHash, mirroring Buildooor's initTxBuild
119
- * (which flags the languages of *executed* scripts). This builder only attaches
120
- * scripts inline, so the witness set carries every executed script.
121
- */
47
+ /** Language views the scriptDataHash covers, from the chain's cost models. */
48
+ private _languageViews;
49
+ private _checkWitnessDatum;
122
50
  private _usedLanguageViewOpts;
123
- /**
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.)
130
- */
131
51
  private _languageViewCostModels;
132
- /**
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.
136
- */
52
+ private _withRefScriptFallback;
137
53
  private _partitionForcedInputs;
138
- /**
139
- * Map resolved CIP-31 reference input UTxOs to Buildooor LedgerUTxO format.
140
- * Returns empty array when no reference inputs are provided.
141
- */
54
+ private _resolveScriptWitness;
55
+ private _ledgerWithdrawalOrder;
56
+ private _checkForeignForcedInputs;
57
+ /** Keys (`txhash#index`) of the reference inputs of a build, from the resolved UTxOs and the request refs. */
58
+ private _referencedKeys;
59
+ /** Map resolved CIP-31 reference input UTxOs to Buildooor LedgerUTxO; empty when none. */
142
60
  private _mapReferenceInputs;
143
- /**
144
- * Funding requirement contributed by extra outputs on a mint build:
145
- * the summed lovelace of all entries plus, per asset unit, the demand the
146
- * transaction's own positive mints do NOT cover. Minted quantities are
147
- * aggregated per unit and subtracted from the aggregated output demand;
148
- * only a positive remainder is requested from the wallet (a fully covered
149
- * unit is not requested at all — it does not exist before this tx).
150
- */
151
61
  private _extraOutputsFundingAfterMint;
152
- /**
153
- * The script an individual mint action executes under: its own
154
- * per-action policy when set (multi-policy mint FR), else the request's
155
- * top-level policy script.
156
- */
62
+ /** Per-action policy script when set, else the request's policy script. */
157
63
  private _mintActionScript;
158
- /**
159
- * Build the Buildooor mint-entry array shared by the mint-only flow and the
160
- * combined spend+mint flow (Buildooor ignores caller-supplied execution units;
161
- * they are stamped into the redeemers post-build by _buildScriptTx).
162
- *
163
- * Multi-policy mint FR: each action may carry its own policy script and
164
- * redeemer; absent fields fall back to the request-level ones. The ledger
165
- * carries ONE redeemer per policy, so actions resolving to the same policy
166
- * must agree on their redeemer, checked here.
167
- */
168
64
  private _buildMintEntries;
169
- /**
170
- * Consumer-facing context for insufficient-funds rejections after the
171
- * collateral partition: the builder's own "not enough …" message counts only
172
- * the funding pool, and without this the reservation is invisible ("but the
173
- * address HAS enough ADA").
174
- */
175
65
  private _collateralPartitionContext;
176
- /**
177
- * Pick a collateral UTxO and return remaining funding UTxOs.
178
- * Throws if no ADA-only UTxO is available.
179
- *
180
- * Selection: the SMALLEST ADA-only UTxO that still covers the static
181
- * COLLATERAL_LOVELACE floor (5 ADA ≳ collateralPercentage × any realistic fee).
182
- * The previous "first ADA-only" pick failed both ways: a dust UTxO below
183
- * collateralPercentage × fee is rejected at submit, and a large UTxO is
184
- * fully forfeited on phase-2 failure (Buildooor sets no collateralReturn
185
- * for ADA-only collateral). Everything above the floor is therefore handed
186
- * back via an explicit collateralReturn when the excess satisfies min-ADA.
187
- */
188
66
  private _setupCollateral;
189
67
  /** Build a Ledger Value from lovelace + optional multi-asset array */
190
68
  private _buildLedgerValue;
191
69
  /** Build a TxOut with optional inline datum and optional reference script (CIP-33) */
192
70
  private _buildTxOut;
193
- /**
194
- * Parse a consumer-provided, CBOR-wrapped Plutus script and reject UPLC 1.0.0
195
- * code (PlutusV1/V2). `Script.fromCbor` defaults to PlutusV3, so V1/V2 bytes
196
- * would be hashed with the 0x03 prefix — a silently wrong script hash, i.e.
197
- * wrong policy IDs and unspendable script addresses with no error anywhere
198
- * down the line. The UPLC version is the first three flat-encoded naturals
199
- * of the unwrapped script: [1,0,0] (V1/V2) vs [1,1,0] (V3).
200
- */
201
71
  private _parsePlutusV3Script;
202
72
  /** Parse a Plutus V3 CBOR hex into a Buildooor Script for refScript attachment. */
203
73
  private _parseReferenceScript;
204
- /**
205
- * Map an input UTxO's scriptRef field to a Buildooor Script when possible.
206
- * UTxO.scriptRef is overloaded across backends: Blockfrost/Ogmios set it to a 28-byte
207
- * hash (56 hex chars), Koios sets it to the full CBOR script bytes. Only full bytes
208
- * are usable here — hash-only entries are preserved only on-chain, not in local eval.
209
- */
210
74
  private _buildInputRefScript;
211
- /**
212
- * Compute the post-sort input order so __INPUT_IDX__ placeholders (FR-3) resolve to the
213
- * same indices Buildooor will assign during build(). Order: script-input first by convention,
214
- * then forced + funding sorted lexicographically on (txHash, outputIndex).
215
- * Buildooor sorts ALL inputs together; we mirror that exact behaviour via sortInputsLikeBuildooor.
216
- */
217
75
  private _computeSortedInputs;
218
76
  /** Extract InputRef list from the Buildooor-shaped funding inputs returned by keepRelevant. */
219
77
  private _extractFundingRefs;
220
- /**
221
- * Resolve __INPUT_IDX__ placeholders (FR-3) inside each extraOutput.inlineDatum.
222
- * Returns a new array with resolved datums; non-datum fields pass through unchanged.
223
- */
78
+ /** Resolve __INPUT_IDX__ placeholders inside each extraOutput.inlineDatum; other fields pass through. */
224
79
  private _resolveExtraOutputPlaceholders;
225
- /**
226
- * Append parsed extraOutputs (FR-2) to the outputs array, enforcing min-ADA per entry.
227
- * Throws TransactionValidationError with the required min-ADA in the message so consumers
228
- * can adjust without having to inspect Buildooor internals.
229
- */
80
+ /** Appends extra outputs. A rejection names the required min-ADA. */
230
81
  private _appendExtraOutputs;
231
- /**
232
- * Resolve the transaction's validity window (slots) from the request.
233
- * Falls back to `now - 2 min` / `now + 1 h` when the request omits bounds.
234
- * Script-validated builds must call this; plain transfers pass their own
235
- * explicit bounds through (no defaulting) so replay behavior is opt-in.
236
- */
237
82
  private _resolveValiditySlots;
238
- /**
239
- * Map ODATANO LedgerProtocolParameter to Buildooor's ProtocolParameters shape.
240
- *
241
- * Every field is null-guarded: a missing/null source value keeps the library
242
- * default instead of degrading to 0 (`Number(null) === 0` previously set
243
- * utxoCostPerByte = 0, disabling min-ADA checks entirely). Cost models and
244
- * execution-unit prices are mapped because they feed the scriptDataHash
245
- * (language views) and the fee/ExUnits math — stale defaults there cause
246
- * PPViewHashesDontMatch or fee underestimation on-chain.
247
- */
248
83
  private _mapLedgerParametersToBuildooorParams;
249
- /**
250
- * Parse the cost-models JSON blob (backend-normalized number arrays, keys
251
- * 'PlutusV1'/'PlutusV2'/'PlutusV3' or Ogmios 'plutus:vN') into Buildooor's
252
- * CostModels shape ('PlutusScriptVN' keys). Returns undefined when nothing
253
- * usable is found, so the caller can keep defaults and warn.
254
- *
255
- * Side effect: (re)sets this.rawCostModelArrays with the unclamped chain arrays
256
- * for the versions mapped here — the named-key conversion drops every entry past
257
- * the parameter count this costmodels-ts release knows, and the scriptDataHash
258
- * must cover all of them (see _languageViewCostModels).
259
- */
260
84
  private _mapCostModels;
261
- /**
262
- * Map ODATANO UTxO to Ledger UTxO (ADA-only)
263
- */
85
+ /** Map an ADA-only UTxO to a Ledger UTxO. */
264
86
  private _mapOdatanoUtxoToLedgerUtxo;
265
- /**
266
- * Map ODATANO UTxO to Ledger UTxO (with multi-asset support)
267
- */
87
+ /** Map a UTxO (with multi-assets) to a Ledger UTxO. */
268
88
  private _mapMultiAssetUtxoToLedgerUtxo;
269
- /**
270
- * Map ODATANO metadata JSON to Ledger TxMetadata
271
- */
89
+ /** Map metadata JSON (label -> value) to Ledger TxMetadata. */
272
90
  private _mapOdatanoMetadataToLedgerMetadata;
273
- /**
274
- * Recursively convert JSON value to TxMetadatum.
275
- *
276
- * Ledger rules enforced here (instead of a node-side rejection or a raw 500):
277
- * - numbers must be integers (BigInt(1.5) would throw a bare RangeError)
278
- * - text and byte values are limited to 64 BYTES per metadatum — longer values
279
- * are chunked into a list of ≤64-byte pieces (the established convention,
280
- * e.g. CIP-25 long strings)
281
- * - strings prefixed with "0x" (even hex length) become byte metadata
282
- * - map keys are not auto-chunked (readers match on the literal key) — over-long
283
- * keys are rejected with a clear 400
284
- *
285
- * @param path position of `value` inside the metadata JSON (label-rooted, e.g.
286
- * "1155.result" or "721.files[0].src") — named in every rejection
287
- * so the consumer can locate the offending value.
288
- */
289
91
  private _jsonToTxMetadatum;
290
92
  }
291
93
  //# sourceMappingURL=buildooor-tx.d.ts.map