Skip to content

docs(transaction-output): deprecate it in favour of TxOut - #712

Open
jorbuedo wants to merge 1 commit into
IntersectMBO:mainfrom
jorbuedo:slice/transaction-output-deprecated
Open

jorbuedo wants to merge 1 commit into
IntersectMBO:mainfrom
jorbuedo:slice/transaction-output-deprecated

Conversation

@jorbuedo

@jorbuedo jorbuedo commented Oct 22, 2026 •

Copy link
Copy Markdown

One of the four fixes asked for in the closing comment on
#619 — deprecation, not an alias, so nothing
breaks.

The second TransactionOutput model. Please deprecate it in favor of TxOut instead of aliasing it, so it is not a breaking change.

The problem

Two models of a transaction output are public from the entry point under names that give no hint
which is which:

TransactionOutput TxOut
address AddressEras Address
value amount: Value assets: Assets
shape a Shelley and a Babbage class one class for both eras
used by nothing in the builders TransactionBody, the builders, the sdk

They reject each other, and the error says Expected TransactionOutput, actual [toString threw]
about a value that is a TransactionOutput — the other one.

Contents

  • packages/evolution/src/TransactionOutput.ts — @deprecated on the module and both classes,
    pointing at TxOut. No removal, no re-point, no alias: every caller holding a
    BabbageTransactionOutput keeps working, and new code is pointed the right way.
  • packages/evolution/test/TransactionOutput.deprecated.test.ts — pins the claim the note makes,
    so it cannot quietly stop being true. ⚠️ It passes before and after, by design: this PR
    changes documentation, not behaviour, and the test is a regression pin on the rejection, not a
    demonstration of a fix.
  • A patch changeset.

Verification

All six CI tasks run locally off ci.yml against this base (lint, type-check, test, build,
check:dts, docgen): green. packages/evolution: 1916 passed, 75 skipped, 0 failed.
devnet's suite needs Docker and was not run here.

Two models of a transaction output are public from the entry point under names
that give no hint which is which: this one (`address: AddressEras`,
`amount: Value`, a Shelley and a Babbage class) and `TxOut` (`address: Address`,
`assets: Assets`, one class for both eras), which is what `TransactionBody`, the
builders and the sdk take.

They reject each other, and the error says `Expected TransactionOutput, actual
[toString threw]` about a value that IS a `TransactionOutput` -- the other one.

Deprecation rather than removal or an alias: every caller holding a
`BabbageTransactionOutput` keeps working, and new code is pointed at `TxOut`.
The test pins the claim the note makes.

@solidsnakedev solidsnakedev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, deprecating it is the right call, and the comparison table matches the code.

Three changes before merge:

  • The module-level @deprecated makes docgen skip the whole module (it filters on !module.deprecated), so the TransactionOutput page would disappear from the docs site. Please keep the note and drop that tag.
  • Editors flag only the two classes. The TransactionOutput union stays unflagged because the export type TransactionOutput beside it has no tag, and the decoders and encoders (fromCBORHex, FromCDDL and the rest) have none. TypeScript can't deprecate a namespace re-export, so a tag on each export is the only way to reach users.
  • The test passes without the change, since the change is comments only, and its decode case returns Left for any output. Please drop the file.

Wallets.ts:161 still decodes CIP-30 UTxOs with TransactionOutput.fromCBORBytes. Moving it to TxOut can be a follow-up.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants