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.

@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.

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 tag is on each of the sixteen exports, naming that export's `TxOut`
counterpart, rather than on the module: TypeScript cannot deprecate a namespace
re-export, so a module tag reaches no caller -- and docgen skips a module that
carries one, which would have dropped the page from the docs site.
@jorbuedo
jorbuedo force-pushed the slice/transaction-output-deprecated branch from 6541c64 to 0b58b13 Compare November 5, 2026 21:15
@jorbuedo

jorbuedo commented Nov 5, 2026

Copy link
Copy Markdown
Author

All three done, and rebased onto fcf30275.

The module-level @deprecated makes docgen skip the whole module […] Please keep the note and drop that tag

Dropped, note kept — and measured both ways rather than taken on trust: docgen emits 139 module pages with the module tag present and 140 with it dropped, and the one that comes back is TransactionOutput.ts.md. The whole note renders in the page overview.

a tag on each export is the only way to reach users

There are sixteen exports and each now carries one naming its own counterpart: TxOut.TransactionOutput for the two classes, the union and the export type beside it; TxOut.ShelleyTransactionOutputCDDL, TxOut.CDDLSchema, TxOut.FromShelleyTransactionOutputCDDL, TxOut.FromBabbageTransactionOutputCDDL, TxOut.FromCDDL, TxOut.FromCBORBytes, TxOut.FromCBORHex, TxOut.arbitrary, TxOut.toCBORBytes, TxOut.toCBORHex, TxOut.fromCBORBytes, TxOut.fromCBORHex for the rest. Four of them had no doc comment at all and got a minimal block with @since 2.0.0, which docgen accepts.

The test passes without the change […] Please drop the file.

Dropped. You are right that it was not a test of this change — the change is comments only, so there was nothing for it to go red against, and its decode case returns Left for any output, which is not the claim the note makes. The PR is now the changeset and the one source file.

Wallets.ts:161 still decodes CIP-30 UTxOs with TransactionOutput.fromCBORBytes

Left for a follow-up, as you said. Worth noting the tags do not disturb it: there is no no-deprecated rule in eslint.config.mjs, so that call site keeps linting clean and only shows the hint in an editor.

Gate, after a clean dist and .tsbuildinfo: lint, type-check, build, check:dts and docgen pass, and packages/evolution is 2021 passed / 75 skipped, 0 failed — the same count as the base now that the test file is gone, which is the honest reading of a comments-only change.

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