Skip to content

Re-export ledger accessors auxDataTxL and metadataTxAuxDataL#1262

Open
Jimbo4350 wants to merge 3 commits into
masterfrom
expose-txauxdata-ledger-accessors
Open

Re-export ledger accessors auxDataTxL and metadataTxAuxDataL#1262
Jimbo4350 wants to merge 3 commits into
masterfrom
expose-txauxdata-ledger-accessors

Conversation

@Jimbo4350

Copy link
Copy Markdown
Contributor

Context

Downstream code (a chain-indexer built on cardano-api) needs to read a transaction's auxiliary data / metadata labels from blocks obtained over ChainSync, without taking a direct dependency on cardano-ledger.

The required ledger accessors were not reachable through cardano-api: in Cardano.Api.Ledger, EraTx was re-exported with only witsTxL/bodyTxL (omitting auxDataTxL), and EraTxAuxData / metadataTxAuxDataL were not re-exported at all. EraTxBody is already re-exported in full, so outputs/inputs are reachable — only the aux-data path was missing.

How to trust this PR

Pure re-export widening in Cardano.Api.Ledger.Internal.Reexport — no logic changes:

  • EraTx (witsTxL, bodyTxL)EraTx (witsTxL, bodyTxL, auxDataTxL) (both re-export sites)
  • adds EraTxAuxData (metadataTxAuxDataL), imported from Cardano.Ledger.Core

With this, tx ^. auxDataTxL then ^. metadataTxAuxDataL yields the Map Word64 Metadatum for any Shelley-based era, via ledger lenses only. cabal build cardano-api compiles cleanly.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated — n/a, pure re-export, no behaviour to test
  • Self-reviewed the diff
  • Changelog fragment added in .changes/

Widen the EraTx re-export to include auxDataTxL, and re-export
EraTxAuxData(metadataTxAuxDataL) from Cardano.Api.Ledger. Together these let
downstream code read a transaction's auxiliary data (metadata) through the
ledger lenses without depending on cardano-ledger directly.
Copilot AI review requested due to automatic review settings July 22, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 widens the Cardano.Api.Ledger public re-exports to expose ledger-level auxiliary-data accessors needed by downstream consumers (e.g., chain indexers) without requiring a direct dependency on cardano-ledger.

Changes:

  • Re-export auxDataTxL via EraTx, enabling access to a transaction’s auxiliary data through Cardano.Api.Ledger.
  • Re-export metadataTxAuxDataL via EraTxAuxData, enabling access to metadata labels within auxiliary data.
  • Add a Herald changelog fragment documenting the compatible API surface widening.

Reviewed changes

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

File Description
cardano-api/src/Cardano/Api/Ledger/Internal/Reexport.hs Expands re-export lists to include auxDataTxL and metadataTxAuxDataL so they become reachable via Cardano.Api.Ledger.
.changes/reexport-txauxdata-accessors.yml Adds a compatible changelog entry describing the new re-exported accessors.

Add addrTxOutL / valueTxOutL (EraTx0ut), datumTxOutF (AlonzoEraTxOut),
Datum(..), hashBinaryData, and hashScript to Cardano.Api.Ledger, so
downstream code can read a transaction output's address, value, datum and
reference script through the ledger lenses.
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