Repository navigation
Conversation
solidsnakedev
left a comment
There was a problem hiding this comment.
Thanks, deprecating it is the right call, and the comparison table matches the code.
Three changes before merge:
- The module-level
@deprecatedmakes 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
TransactionOutputunion stays unflagged because theexport type TransactionOutputbeside it has no tag, and the decoders and encoders (fromCBORHex,FromCDDLand 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
Leftfor 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.
6541c64 to
0b58b13
Compare
|
All three done, and rebased onto
Dropped, note kept — and measured both ways rather than taken on trust:
There are sixteen exports and each now carries one naming its own counterpart:
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 a follow-up, as you said. Worth noting the tags do not disturb it: there is no Gate, after a clean |
One of the four fixes asked for in the closing comment on
#619 — deprecation, not an alias, so nothing
breaks.
The problem
Two models of a transaction output are public from the entry point under names that give no hint
which is which:
TransactionOutputTxOutAddressErasAddressamount: Valueassets: AssetsTransactionBody, the builders, the sdkThey 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—@deprecatedon the module and both classes,pointing at
TxOut. No removal, no re-point, no alias: every caller holding aBabbageTransactionOutputkeeps 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.
changes documentation, not behaviour, and the test is a regression pin on the rejection, not a
demonstration of a fix.
Verification
All six CI tasks run locally off
ci.ymlagainst 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.