@odatano/core 2.0.0-rc.19 → 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.
- package/@cds-models/CardanoAgentService/index.d.ts +1 -5
- package/@cds-models/CardanoIndexerService/index.d.ts +51 -2
- package/@cds-models/CardanoIndexerService/index.js +7 -0
- package/package.json +1 -1
- package/src/index.d.ts +4 -10
- package/src/index.js +6 -16
- package/src/plugin.js +11 -27
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +39 -150
- package/srv/blockchain/backends/cardano-backend.d.ts +53 -171
- package/srv/blockchain/backends/cardano-backend.js +1 -5
- package/srv/blockchain/backends/koios-backend.d.ts +26 -71
- package/srv/blockchain/backends/koios-backend.js +50 -132
- package/srv/blockchain/backends/ogmios-backend.d.ts +43 -124
- package/srv/blockchain/backends/ogmios-backend.js +71 -179
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +12 -57
- package/srv/blockchain/backends/ogmios-frame-guard.js +27 -66
- package/srv/blockchain/cardano-client.d.ts +43 -216
- package/srv/blockchain/cardano-client.js +49 -234
- package/srv/blockchain/cardano-indexer.d.ts +79 -357
- package/srv/blockchain/cardano-indexer.js +98 -406
- package/srv/blockchain/cardano-tx-builder.d.ts +19 -84
- package/srv/blockchain/cardano-tx-builder.js +21 -107
- package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
- package/srv/blockchain/crawler/certificate-backfill.js +150 -0
- package/srv/blockchain/crawler/crawler.d.ts +41 -145
- package/srv/blockchain/crawler/crawler.js +57 -172
- package/srv/blockchain/crawler/hooks.d.ts +3 -14
- package/srv/blockchain/crawler/index.d.ts +2 -6
- package/srv/blockchain/crawler/index.js +4 -9
- package/srv/blockchain/crawler/sync-state.d.ts +17 -39
- package/srv/blockchain/crawler/sync-state.js +23 -55
- package/srv/blockchain/crawler/utxo-set-import.d.ts +5 -22
- package/srv/blockchain/crawler/utxo-set-import.js +8 -28
- package/srv/blockchain/ledger-state.d.ts +3 -12
- package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
- package/srv/blockchain/signing/cose-verifier.js +6 -12
- package/srv/blockchain/signing/external-signer.d.ts +16 -113
- package/srv/blockchain/signing/external-signer.js +19 -122
- package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
- package/srv/blockchain/signing/hsm-signer.js +23 -63
- package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
- package/srv/blockchain/signing/signature-verifier.js +13 -54
- package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
- package/srv/blockchain/signing/submission-finalizer.js +16 -48
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +65 -174
- package/srv/blockchain/transaction-building/buildooor-tx.js +107 -266
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +9 -22
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +12 -35
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -32
- package/srv/blockchain/wallet-worker/index.js +2 -8
- package/srv/blockchain/wallet-worker/job-store.d.ts +33 -111
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
- package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
- package/srv/blockchain/wallet-worker/signers.js +3 -8
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
- package/srv/blockchain/wallet-worker/wallet-worker.js +34 -90
- package/srv/cardano-agent-service.cds +1 -5
- package/srv/cardano-agent-service.js +3 -7
- package/srv/cardano-indexer-service.cds +32 -4
- package/srv/cardano-indexer-service.js +83 -15
- package/srv/cardano-service.js +36 -98
- package/srv/cardano-sign-service.cds +1 -1
- package/srv/cardano-sign-service.js +55 -173
- package/srv/cardano-tx-service.cds +1 -1
- package/srv/cardano-tx-service.js +54 -174
- package/srv/cardano-worker-service.js +7 -15
- package/srv/server.d.ts +27 -86
- package/srv/server.js +52 -148
- package/srv/utils/agent-grants-config.d.ts +11 -50
- package/srv/utils/agent-grants-config.js +12 -45
- package/srv/utils/agent-grants.d.ts +34 -123
- package/srv/utils/agent-grants.js +57 -156
- package/srv/utils/agent-token-auth.d.ts +2 -5
- package/srv/utils/agent-token-auth.js +2 -5
- package/srv/utils/backend-request-handler.d.ts +2 -16
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +4 -8
- package/srv/utils/collections.js +4 -8
- package/srv/utils/const.d.ts +19 -68
- package/srv/utils/const.js +20 -69
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +5 -18
- package/srv/utils/db-indexes.d.ts +2 -7
- package/srv/utils/db-indexes.js +7 -34
- package/srv/utils/db-sanitize.d.ts +5 -18
- package/srv/utils/db-sanitize.js +6 -19
- package/srv/utils/error-codes.d.ts +18 -73
- package/srv/utils/error-codes.js +17 -70
- package/srv/utils/errors.d.ts +29 -191
- package/srv/utils/errors.js +44 -229
- package/srv/utils/liveness.d.ts +2 -9
- package/srv/utils/liveness.js +3 -11
- package/srv/utils/mappers.d.ts +50 -298
- package/srv/utils/mappers.js +80 -386
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-order-nulls.js +4 -23
- package/srv/utils/plutus-placeholders.d.ts +6 -18
- package/srv/utils/plutus-placeholders.js +6 -20
- package/srv/utils/rate-limiter.d.ts +6 -17
- package/srv/utils/rate-limiter.js +5 -15
- package/srv/utils/service-events.d.ts +2 -22
- package/srv/utils/service-events.js +3 -23
- package/srv/utils/signing-helper.d.ts +3 -18
- package/srv/utils/signing-helper.js +10 -32
- package/srv/utils/tx-build-helper.d.ts +18 -92
- package/srv/utils/tx-build-helper.js +32 -123
- package/srv/utils/tx-request-parsers.d.ts +7 -26
- package/srv/utils/tx-request-parsers.js +7 -26
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +67 -206
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +19 -89
- 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
|
|
15
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
45
|
-
*
|
|
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
|
|
58
|
-
*
|
|
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
|
|
79
|
-
*
|
|
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
|
-
*
|
|
87
|
-
*
|
|
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
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
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
|
-
*
|
|
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,69 +79,43 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
|
|
|
121
79
|
*/
|
|
122
80
|
private _usedLanguageViewOpts;
|
|
123
81
|
/**
|
|
124
|
-
* Cost models for language-view hashing
|
|
125
|
-
*
|
|
126
|
-
*
|
|
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
|
|
134
|
-
*
|
|
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;
|
|
138
|
-
/**
|
|
139
|
-
* Map resolved CIP-31 reference input UTxOs to Buildooor LedgerUTxO format.
|
|
140
|
-
* Returns empty array when no reference inputs are provided.
|
|
141
|
-
*/
|
|
92
|
+
/** Map resolved CIP-31 reference input UTxOs to Buildooor LedgerUTxO; empty when none. */
|
|
142
93
|
private _mapReferenceInputs;
|
|
143
94
|
/**
|
|
144
|
-
* Funding
|
|
145
|
-
* 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).
|
|
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.
|
|
150
97
|
*/
|
|
151
98
|
private _extraOutputsFundingAfterMint;
|
|
152
99
|
/**
|
|
153
|
-
*
|
|
154
|
-
* per-action policy when set (multi-policy mint FR), else the request's
|
|
100
|
+
* Script a mint action executes under: its per-action policy when set, else the request's
|
|
155
101
|
* top-level policy script.
|
|
156
102
|
*/
|
|
157
103
|
private _mintActionScript;
|
|
158
104
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
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.
|
|
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.
|
|
167
108
|
*/
|
|
168
109
|
private _buildMintEntries;
|
|
169
110
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* the funding pool, and without this the reservation is invisible ("but the
|
|
173
|
-
* 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.
|
|
174
113
|
*/
|
|
175
114
|
private _collateralPartitionContext;
|
|
176
115
|
/**
|
|
177
|
-
* Pick
|
|
178
|
-
*
|
|
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.
|
|
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.
|
|
187
119
|
*/
|
|
188
120
|
private _setupCollateral;
|
|
189
121
|
/** Build a Ledger Value from lovelace + optional multi-asset array */
|
|
@@ -191,100 +123,59 @@ export declare class BuildooorTxBuilder implements CardanoTxBuilder {
|
|
|
191
123
|
/** Build a TxOut with optional inline datum and optional reference script (CIP-33) */
|
|
192
124
|
private _buildTxOut;
|
|
193
125
|
/**
|
|
194
|
-
* Parse a
|
|
195
|
-
*
|
|
196
|
-
*
|
|
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).
|
|
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].
|
|
200
129
|
*/
|
|
201
130
|
private _parsePlutusV3Script;
|
|
202
131
|
/** Parse a Plutus V3 CBOR hex into a Buildooor Script for refScript attachment. */
|
|
203
132
|
private _parseReferenceScript;
|
|
204
133
|
/**
|
|
205
|
-
* Map an input UTxO's scriptRef
|
|
206
|
-
*
|
|
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.
|
|
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.
|
|
209
136
|
*/
|
|
210
137
|
private _buildInputRefScript;
|
|
211
138
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* then forced + funding sorted lexicographically on (txHash, outputIndex).
|
|
215
|
-
* 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).
|
|
216
141
|
*/
|
|
217
142
|
private _computeSortedInputs;
|
|
218
143
|
/** Extract InputRef list from the Buildooor-shaped funding inputs returned by keepRelevant. */
|
|
219
144
|
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
|
-
*/
|
|
145
|
+
/** Resolve __INPUT_IDX__ placeholders inside each extraOutput.inlineDatum; other fields pass through. */
|
|
224
146
|
private _resolveExtraOutputPlaceholders;
|
|
225
147
|
/**
|
|
226
|
-
* Append parsed
|
|
227
|
-
*
|
|
228
|
-
* 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.
|
|
229
150
|
*/
|
|
230
151
|
private _appendExtraOutputs;
|
|
231
152
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* Script-validated builds must call this; plain transfers pass their own
|
|
235
|
-
* 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.
|
|
236
155
|
*/
|
|
237
156
|
private _resolveValiditySlots;
|
|
238
157
|
/**
|
|
239
|
-
* Map
|
|
240
|
-
*
|
|
241
|
-
*
|
|
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.
|
|
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.
|
|
247
161
|
*/
|
|
248
162
|
private _mapLedgerParametersToBuildooorParams;
|
|
249
163
|
/**
|
|
250
|
-
* Parse the cost-models JSON
|
|
251
|
-
*
|
|
252
|
-
*
|
|
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).
|
|
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).
|
|
259
167
|
*/
|
|
260
168
|
private _mapCostModels;
|
|
261
|
-
/**
|
|
262
|
-
* Map ODATANO UTxO to Ledger UTxO (ADA-only)
|
|
263
|
-
*/
|
|
169
|
+
/** Map an ADA-only UTxO to a Ledger UTxO. */
|
|
264
170
|
private _mapOdatanoUtxoToLedgerUtxo;
|
|
265
|
-
/**
|
|
266
|
-
* Map ODATANO UTxO to Ledger UTxO (with multi-asset support)
|
|
267
|
-
*/
|
|
171
|
+
/** Map a UTxO (with multi-assets) to a Ledger UTxO. */
|
|
268
172
|
private _mapMultiAssetUtxoToLedgerUtxo;
|
|
269
|
-
/**
|
|
270
|
-
* Map ODATANO metadata JSON to Ledger TxMetadata
|
|
271
|
-
*/
|
|
173
|
+
/** Map metadata JSON (label -> value) to Ledger TxMetadata. */
|
|
272
174
|
private _mapOdatanoMetadataToLedgerMetadata;
|
|
273
175
|
/**
|
|
274
|
-
* Recursively convert JSON value to TxMetadatum
|
|
275
|
-
*
|
|
276
|
-
*
|
|
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.
|
|
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
|
|
288
179
|
*/
|
|
289
180
|
private _jsonToTxMetadatum;
|
|
290
181
|
}
|