Repository navigation
feat: add transaction part builders for inputs, collateral and outputs - #854
Merged
Merged
Conversation
This was referenced Oct 24, 2026
Merged
twwu123
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds builders for transaction parts: one call per input, collateral or output, taking everything that part needs at once. They return plain, immutable values shaped after
TransactionPrototype, so they can later be assembled into one.The code lives in its own directory,
packages/mesh-transaction/src/tx-builder/, separate fromMeshTxBuilder. It is not yet exported from the package root, and nothing existing changes.Contents
packages/mesh-transaction/src/tx-builder/parts/:spend.pubKey,spend.native,spend.plutus: an input with its witness.{ reference }).Dataor anyBuilderDataformat."inline","none"(Plutus V3 only) or{ data }. When omitted, it is worked out from the spent UTxO.referenceInput,collateral,collateralReturn.output:Asset[]or asbigintquantities by unit.embed), or a known hash only.UTxO. A full UTxO is checked straight away and spares a lookup later. Parts copy what they are given and are deeply frozen.TxPartErrorcarries acode, the part kind and the part'slabel.label?on every part, echoed in its errors.unresolved(part)lists what a part leaves to be filled in before assembly: the contents of an input given by reference only, a reference script's hash/size/version, the datum of a spent output, execution units, an output's minimum lovelace, the total collateral. An empty list means the part is complete.Validation
unresolvedfor each kind of part;TransactionPrototype, encoded withtransactionPrototypeToHexand decoded withtransactionPrototypeFromHex, so their fragments survive real CBOR.mesh-transactionsuite (NODE_OPTIONS=--experimental-vm-modules npx jest): 185 tests pass.script-tx-fetcherandscript-tx-failfail to load under that flag onmaintoo.