| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Tracing.Era.Shelley.Render
Description
JSON rendering helpers for Shelley-era ledger types used by the tracing instances in Ouroboros.Consensus.Tracing.Era.Shelley.
These were originally in cardano-node's Cardano.Node.Tracing.Render and
went through cardano-api. They are reimplemented here directly against
cardano-ledger (so Consensus need not depend on cardano-api, which sits
downstream), reproducing cardano-api's output: bech32 stake/reward
addresses (CIP-19), hex script hashes, and era-generic plutus purposes.
Synopsis
- renderScriptHash ∷ ScriptHash → Text
- renderScriptIntegrityHash ∷ Maybe ScriptIntegrityHash → Value
- renderScriptPurpose ∷ (AnyEraScript era, ToJSON (TxCert era), ToJSON (ProposalProcedure era)) ⇒ PlutusPurpose AsItem era → Value
- renderScriptIndex ∷ AnyEraScript era ⇒ PlutusPurpose AsIx era → Value
- renderMissingRedeemers ∷ (AnyEraScript era, EraPParams era, ToJSON (TxCert era)) ⇒ NonEmpty (PlutusPurpose AsItem era, ScriptHash) → Value
- renderIncompleteWithdrawals ∷ ∀ (rel ∷ Relation) payload. (Typeable rel, Show payload) ⇒ NonEmptyMap AccountAddress (Mismatch rel payload) → Value
- renderRewardAccount ∷ AccountAddress → Text
- renderTxIn ∷ TxIn → Text
Documentation
renderScriptHash ∷ ScriptHash → Text Source #
Hex-encode a script hash, matching cardano-api's
serialiseToRawBytesHexText . fromShelleyScriptHash.
renderScriptPurpose ∷ (AnyEraScript era, ToJSON (TxCert era), ToJSON (ProposalProcedure era)) ⇒ PlutusPurpose AsItem era → Value Source #
Render a plutus script purpose (as an item), era-generically via
cardano-ledger-api's AnyEraScript projections. Replaces cardano-api's
per-era renderAlonzoPlutusPurpose/renderConwayPlutusPurpose.
The projections are pattern synonyms, but cardano-ledger-api ships a
COMPLETE pragma covering all seven of them, so GHC does check exhaustiveness
here. Matching all seven rather than falling through to a catch-all means the
next ledger era shows up as a warning at compile time instead of as an
unrenderable purpose in an operator's logs.
renderScriptIndex ∷ AnyEraScript era ⇒ PlutusPurpose AsIx era → Value Source #
Render a plutus script purpose given by its index (redeemer pointer), era-generically.
Reproduces what cardano-api's toScriptIndex followed by
ToJSON ScriptWitnessIndex emitted: a kind naming the witness index
constructor and the index itself under value. The constructor names are
cardano-api's and do not all match the purpose names used by
renderScriptPurpose above. ScriptWitnessIndexGuarding is the exception:
cardano-api has no constructor for the Dijkstra-era guarding purpose, so
that name is ours, following the same scheme.
renderMissingRedeemers ∷ (AnyEraScript era, EraPParams era, ToJSON (TxCert era)) ⇒ NonEmpty (PlutusPurpose AsItem era, ScriptHash) → Value Source #
renderIncompleteWithdrawals ∷ ∀ (rel ∷ Relation) payload. (Typeable rel, Show payload) ⇒ NonEmptyMap AccountAddress (Mismatch rel payload) → Value Source #
renderRewardAccount ∷ AccountAddress → Text Source #
Bech32-encode a reward/stake account address (CIP-19), matching
cardano-api's serialiseAddress . fromShelleyStakeAddr: human-readable
part stake on mainnet, stake_test on testnets.
renderTxIn ∷ TxIn → Text Source #
Render a transaction input as <txid hex>#<index>.
Deliberately not cardano-ledger's ToJSON TxIn: that one shows the index
newtype, giving ...#TxIx {unTxIx = 0}. cardano-api rendered the bare
number, and that is what the log has always carried.