Skip to content

Deprecate TxBody and TxBodyContent in favour of the experimental API#1200

Open
Jimbo4350 wants to merge 3 commits into
masterfrom
jordan/deprecate-txbody-txbodycontent
Open

Deprecate TxBody and TxBodyContent in favour of the experimental API#1200
Jimbo4350 wants to merge 3 commits into
masterfrom
jordan/deprecate-txbody-txbodycontent

Conversation

@Jimbo4350
Copy link
Copy Markdown
Contributor

Context

Deprecates the old-API transaction body surface (the type, its constructor, and direct producers/consumers) so users are pointed at Cardano.Api.Experimental. Internal modules that still use these symbols are annotated with -Wno-deprecations to keep -Werror green; they will be migrated in a follow-up along with the setter family.

Deprecations introduced:

  • TxBody (data type), ShelleyTxBody (constructor)
  • TxBodyContent (type/constructor)
  • createTransactionBody, defaultTxBodyContent
  • getTxBody, getTxBodyContent
  • BalancedTxBody

The existing pattern-synonym TxBody deprecation message is updated for consistency with the new messages.

How to trust this PR

  • Single commit; mechanical addition of {-# DEPRECATED ... #-} pragmas plus -Wno-deprecations OPTIONS_GHC in modules that still consume the deprecated surface internally (so -Werror stays green until the follow-up migrates those callers).
  • cabal build cardano-api -j4 is clean against current master.
  • Diff is +23/-1 across 10 files; no behavioural change.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • Self-reviewed the diff
  • Changelog fragment added in .changes/ (will add once PR number is assigned)

Jimbo4350 added a commit that referenced this pull request May 7, 2026
Jimbo4350 added 2 commits May 11, 2026 15:27
Deprecates the old-API transaction body surface (the type, its
constructor, and direct producers/consumers) so users are pointed at
'Cardano.Api.Experimental'. Internal modules that still use these
symbols are annotated with -Wno-deprecations to keep -Werror green;
they will be migrated in a follow-up along with the setter family.

Deprecations:
- TxBody (data type), ShelleyTxBody (constructor)
- TxBodyContent (type/constructor)
- createTransactionBody, defaultTxBodyContent
- getTxBody, getTxBodyContent
- BalancedTxBody

The existing pattern-synonym TxBody deprecation message is updated for
consistency with the new messages.
@Jimbo4350 Jimbo4350 force-pushed the jordan/deprecate-txbody-txbodycontent branch from f687c93 to 67ad5f7 Compare May 11, 2026 19:32
@Jimbo4350 Jimbo4350 marked this pull request as ready for review May 11, 2026 19:56
@Jimbo4350 Jimbo4350 requested a review from erikd as a code owner May 11, 2026 19:56
Copilot AI review requested due to automatic review settings May 11, 2026 19:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR deprecates the legacy transaction body API (TxBody, TxBodyContent, and related helpers) to steer users toward the experimental transaction API, while adding -Wno-deprecations to internal/test modules that still rely on the deprecated surface to keep -Werror builds clean.

Changes:

  • Added {-# DEPRECATED #-} pragmas for the legacy Tx body types/constructors and helper functions.
  • Added {-# OPTIONS_GHC -Wno-deprecations #-} in internal modules and tests that still use the deprecated API.
  • Added a Herald changelog fragment documenting the deprecations.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cardano-api/test/cardano-api-test/Test/Cardano/Api/TxBody.hs Suppress deprecation warnings in tests that still exercise legacy TxBody APIs.
cardano-api/test/cardano-api-test/Test/Cardano/Api/Transaction/Autobalance.hs Suppress deprecation warnings in autobalance tests still using deprecated symbols.
cardano-api/test/cardano-api-test/Test/Cardano/Api/Experimental.hs Suppress deprecation warnings in experimental tests that import legacy types during transition.
cardano-api/src/Cardano/Api/Tx/Internal/Sign.hs Deprecates TxBody, ShelleyTxBody, and getTxBody; suppresses internal deprecation warnings.
cardano-api/src/Cardano/Api/Tx/Internal/Fee.hs Deprecates BalancedTxBody; suppresses internal deprecation warnings.
cardano-api/src/Cardano/Api/Tx/Internal/Convenience.hs Suppresses deprecation warnings where legacy balancing/building helpers are still used.
cardano-api/src/Cardano/Api/Tx/Internal/Body.hs Deprecates TxBodyContent, defaultTxBodyContent, createTransactionBody, getTxBodyContent, and updates the TxBody pattern synonym deprecation message.
cardano-api/src/Cardano/Api/Network/IPC/Internal.hs Suppresses deprecation warnings due to importing legacy TxBody-related internals.
cardano-api/src/Cardano/Api/Governance/Internal/Poll.hs Suppresses deprecation warnings due to importing legacy TxBody/metadata internals.
cardano-api/src/Cardano/Api/Experimental/Tx.hs Suppresses deprecation warnings due to intentional bridging/imports from deprecated legacy internals.
.changes/20260507_cardano_api_deprecate_txbody_txbodycontent.yml Adds a changelog fragment documenting the deprecations and the temporary warning suppressions.

Comment on lines +865 to +866
{-# DEPRECATED TxBodyContent "Use 'TxBodyContent' from 'Cardano.Api.Experimental' instead." #-}

Comment on lines +896 to 897
{-# DEPRECATED defaultTxBodyContent "Use 'TxBodyContent' from 'Cardano.Api.Experimental' instead." #-}
defaultTxBodyContent
Replace the deprecated getTxBody/getTxId chain in
Cardano.Rpc.Server.Internal.UtxoRpc.Submit with a direct ledger projection:
pattern-match the API Tx, then compute the TxId via Cardano.Ledger.Core.txIdTx
(which is bodyTxL composed with txIdTxBody) and lift back through
fromShelleyTxId.
@Jimbo4350 Jimbo4350 force-pushed the jordan/deprecate-txbody-txbodycontent branch from 0b7cec1 to 3b808dd Compare May 11, 2026 20:21
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