Skip to content

refactor(wallets): decode CIP-30 UTxOs with TxOut - #730

Open
emmanuel-musau wants to merge 1 commit into
mainfrom
refactor/cip30-utxo-txout
Open

emmanuel-musau wants to merge 1 commit into
mainfrom
refactor/cip30-utxo-txout

Conversation

@emmanuel-musau

Copy link
Copy Markdown
Collaborator

Follow-up to #712, which deprecates TransactionOutput. cip30UtxoFromCBORHex was its last user in src.

It decoded the CIP-30 output into the old model and converted each field by hand: the AddressEras address re-encoded and decoded again as an Address, Assets rebuilt from the Value, and a Shelley/Babbage branch for the datum and script ref. TxOut.fromCBORBytes already returns an Address, Assets and one datumOption for both eras, so the UTxO is built straight from its fields. Only the script ref still goes through Script.fromCBOR, as in SignBuilderImpl.

The UTxOs it returns are unchanged. Run side by side on 2,000 random outputs, half encoded by TxOut and half by TransactionOutput, the old and new decoders returned equal UTxOs for every one, 1,238 of them with a reference script.

The test fixtures now build outputs with TxOut. No test covered a reference script, so one is added; it fails with the script-ref line removed.

Closes #729

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wallets: decode CIP-30 UTxOs with TxOut instead of the deprecated TransactionOutput

1 participant