@odatano/core 2.0.0-rc.2 → 2.0.0-rc.21
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 +251 -0
- package/@cds-models/CardanoAgentService/index.js +36 -0
- package/@cds-models/CardanoIndexerService/index.d.ts +139 -2
- package/@cds-models/CardanoIndexerService/index.js +18 -0
- package/@cds-models/CardanoODataService/index.d.ts +231 -6
- package/@cds-models/CardanoODataService/index.js +27 -0
- package/@cds-models/CardanoSignService/index.d.ts +5 -2
- package/@cds-models/CardanoTransactionService/index.d.ts +9 -9
- package/@cds-models/odatano/cardano/index.d.ts +323 -6
- package/@cds-models/odatano/cardano/index.js +33 -0
- package/README.md +195 -136
- package/db/schema.cds +2133 -1633
- package/package.json +181 -173
- package/scripts/migrate-slot-leader.mjs +104 -0
- package/scripts/migrate-txseq.mjs +147 -0
- package/src/index.d.ts +10 -10
- package/src/index.js +24 -14
- package/src/plugin.js +39 -52
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +45 -158
- package/srv/blockchain/backends/cardano-backend.d.ts +83 -158
- package/srv/blockchain/backends/cardano-backend.js +14 -5
- package/srv/blockchain/backends/koios-backend.d.ts +126 -60
- package/srv/blockchain/backends/koios-backend.js +293 -203
- package/srv/blockchain/backends/ogmios-backend.d.ts +69 -94
- package/srv/blockchain/backends/ogmios-backend.js +319 -185
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +32 -0
- package/srv/blockchain/backends/ogmios-frame-guard.js +142 -0
- package/srv/blockchain/cardano-client.d.ts +57 -204
- package/srv/blockchain/cardano-client.js +94 -226
- package/srv/blockchain/cardano-indexer.d.ts +176 -240
- package/srv/blockchain/cardano-indexer.js +615 -338
- package/srv/blockchain/cardano-tx-builder.d.ts +29 -82
- package/srv/blockchain/cardano-tx-builder.js +88 -128
- 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 +121 -53
- package/srv/blockchain/crawler/crawler.js +403 -89
- package/srv/blockchain/crawler/hooks.d.ts +3 -14
- package/srv/blockchain/crawler/index.d.ts +5 -0
- package/srv/blockchain/crawler/index.js +35 -7
- package/srv/blockchain/crawler/sync-state.d.ts +44 -28
- package/srv/blockchain/crawler/sync-state.js +115 -43
- package/srv/blockchain/crawler/utxo-set-import.d.ts +69 -0
- package/srv/blockchain/crawler/utxo-set-import.js +269 -0
- package/srv/blockchain/ledger-state.d.ts +80 -0
- package/srv/blockchain/ledger-state.js +383 -0
- 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 +71 -160
- package/srv/blockchain/transaction-building/buildooor-tx.js +185 -260
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
- package/srv/blockchain/transaction-rows.d.ts +12 -0
- package/srv/blockchain/transaction-rows.js +42 -0
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +39 -23
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +25 -17
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +87 -41
- package/srv/blockchain/wallet-worker/index.js +2 -8
- package/srv/blockchain/wallet-worker/job-store.d.ts +36 -103
- 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 +40 -91
- package/srv/cardano-agent-service.cds +146 -0
- package/srv/cardano-agent-service.d.ts +2 -0
- package/srv/cardano-agent-service.js +12 -0
- package/srv/cardano-indexer-service.cds +164 -73
- package/srv/cardano-indexer-service.js +156 -11
- package/srv/cardano-service.cds +45 -0
- package/srv/cardano-service.js +38 -96
- package/srv/cardano-sign-service.cds +200 -180
- package/srv/cardano-sign-service.js +55 -173
- package/srv/cardano-tx-service.cds +32 -26
- package/srv/cardano-tx-service.js +136 -196
- package/srv/cardano-worker-service.js +7 -15
- package/srv/server.d.ts +28 -86
- package/srv/server.js +95 -128
- package/srv/utils/agent-grants-config.d.ts +37 -0
- package/srv/utils/agent-grants-config.js +138 -0
- package/srv/utils/agent-grants.d.ts +262 -0
- package/srv/utils/agent-grants.js +914 -0
- package/srv/utils/agent-token-auth.d.ts +16 -0
- package/srv/utils/agent-token-auth.js +78 -0
- 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 +25 -0
- package/srv/utils/db-indexes.js +93 -0
- package/srv/utils/db-sanitize.d.ts +27 -0
- package/srv/utils/db-sanitize.js +85 -0
- package/srv/utils/epoch-slots.d.ts +13 -0
- package/srv/utils/epoch-slots.js +25 -0
- package/srv/utils/error-codes.d.ts +18 -73
- package/srv/utils/error-codes.js +17 -70
- package/srv/utils/errors.d.ts +36 -179
- package/srv/utils/errors.js +62 -220
- package/srv/utils/liveness.d.ts +16 -0
- package/srv/utils/liveness.js +41 -0
- package/srv/utils/mappers.d.ts +89 -214
- package/srv/utils/mappers.js +289 -301
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-order-nulls.d.ts +14 -0
- package/srv/utils/pg-order-nulls.js +57 -0
- package/srv/utils/plutus-placeholders.d.ts +6 -18
- package/srv/utils/plutus-placeholders.js +6 -20
- package/srv/utils/rate-limiter.d.ts +46 -0
- package/srv/utils/rate-limiter.js +116 -0
- 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 +14 -20
- package/srv/utils/tx-request-parsers.js +33 -20
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +114 -169
- 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,49 +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;
|
|
92
|
+
/** Map resolved CIP-31 reference input UTxOs to Buildooor LedgerUTxO; empty when none. */
|
|
93
|
+
private _mapReferenceInputs;
|
|
138
94
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
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
|
|
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
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
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
|
-
*
|
|
151
|
-
*
|
|
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
|
|
158
|
-
*
|
|
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
|
|
175
|
-
*
|
|
176
|
-
*
|
|
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
|
|
186
|
-
*
|
|
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
|
-
*
|
|
193
|
-
*
|
|
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
|
|
207
|
-
*
|
|
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
|
-
*
|
|
213
|
-
*
|
|
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
|
|
220
|
-
*
|
|
221
|
-
*
|
|
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
|
|
231
|
-
*
|
|
232
|
-
*
|
|
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
|
-
*
|
|
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
|
}
|