Skip to content

Conversation

@palas
Copy link
Contributor

@palas palas commented Sep 18, 2025

Changelog

- description: |
    Added `HasTypeProxy` `FromCBOR`, `ToCBOR`, and `SerialiseAsCBOR ` instances to `TxOut`.
  type:
  - feature
  projects:
  - cardano-api

Context

This PR addresses #955.

How to trust this PR

The test should help with trust. But there is a bit of an issue with ToCBOR instance losing information, so there is a design decision to be make about this. Please, let me know what you think about this.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@palas palas force-pushed the SerialiseAsCBOR-for-TxOut branch from e9c48c5 to 753f06b Compare September 22, 2025 17:19
@palas palas force-pushed the SerialiseAsCBOR-for-TxOut branch from 753f06b to fe0c24c Compare October 21, 2025 21:29
@palas palas requested a review from carbolymer October 21, 2025 21:29
@palas palas force-pushed the SerialiseAsCBOR-for-TxOut branch from fe0c24c to bdb5761 Compare October 21, 2025 21:31
@palas palas force-pushed the SerialiseAsCBOR-for-TxOut branch 2 times, most recently from 07aa3fe to 8a17ba1 Compare October 22, 2025 22:28
@palas palas force-pushed the SerialiseAsCBOR-for-TxOut branch from 8a17ba1 to 2f1e19c Compare October 22, 2025 22:36
@palas palas requested a review from carbolymer October 22, 2025 22:44
pure (fromShelleyTxOut shelleyBasedEra) <*> L.fromEraCBOR @(ShelleyLedgerEra era)

-- | We do not provide a 'ToCBOR' instance for 'TxOut' because 'TxOut's can
-- contain supplemental datums and the CBOR representation does not support this.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-- contain supplemental datums and the CBOR representation does not support this.
-- contain supplemental datums and the ledger's CBOR representation does not support this.

, IsShelleyBasedEra era
)
=> ToCBOR (TxOut ctx era)
where
Copy link
Contributor

@Jimbo4350 Jimbo4350 Oct 24, 2025

Choose a reason for hiding this comment

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

Why bother providing a ToCBOR instance? A comment above the FromCBOR instance should be sufficient.

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.

make a deserialiseFromCbor instance for TxOut

3 participants