Re-export ledger accessors auxDataTxL and metadataTxAuxDataL#1262
Open
Jimbo4350 wants to merge 3 commits into
Open
Re-export ledger accessors auxDataTxL and metadataTxAuxDataL#1262Jimbo4350 wants to merge 3 commits into
Jimbo4350 wants to merge 3 commits into
Conversation
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.
Jimbo4350
requested review from
CarlosLopezDeLara,
carbolymer,
disassembler,
erikd and
palas
as code owners
July 22, 2026 15:16
Contributor
There was a problem hiding this comment.
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
auxDataTxLviaEraTx, enabling access to a transaction’s auxiliary data throughCardano.Api.Ledger. - Re-export
metadataTxAuxDataLviaEraTxAuxData, 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 oncardano-ledger.The required ledger accessors were not reachable through
cardano-api: inCardano.Api.Ledger,EraTxwas re-exported with onlywitsTxL/bodyTxL(omittingauxDataTxL), andEraTxAuxData/metadataTxAuxDataLwere not re-exported at all.EraTxBodyis 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)EraTxAuxData (metadataTxAuxDataL), imported fromCardano.Ledger.CoreWith this,
tx ^. auxDataTxLthen^. metadataTxAuxDataLyields theMap Word64 Metadatumfor any Shelley-based era, via ledger lenses only.cabal build cardano-apicompiles cleanly.Checklist
.changes/