diff --git a/src/Cooked/Pretty/Cooked.hs b/src/Cooked/Pretty/Cooked.hs index 999c4e46b..bc8be0fe3 100644 --- a/src/Cooked/Pretty/Cooked.hs +++ b/src/Cooked/Pretty/Cooked.hs @@ -334,27 +334,18 @@ prettyTxSkelInReference opts skelContext txOutRef = do ) getReferenceScriptDoc :: (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => PrettyCookedOpts -> output -> Maybe DocCooked -getReferenceScriptDoc opts output = - case output ^. outputReferenceScriptL of - Nothing -> Nothing - Just refScript -> - Just $ - "Reference script hash:" - <+> prettyHash (pcOptHashes opts) (toHash . toScriptHash $ refScript) +getReferenceScriptDoc opts output = prettyReferenceScriptHash opts . toScriptHash <$> output ^. outputReferenceScriptL -lookupOutput :: - SkelContext -> - Pl.TxOutRef -> - Maybe (Pl.TxOut, TxSkelOutDatum) +lookupOutput :: SkelContext -> Pl.TxOutRef -> Maybe (Pl.TxOut, TxSkelOutDatum) lookupOutput (SkelContext managedTxOuts managedTxSkelOutDatums) txOutRef = do output <- Map.lookup txOutRef managedTxOuts - datumHash <- - case outputOutputDatum output of - Pl.OutputDatum datum -> return (Pl.datumHash datum) - Pl.OutputDatumHash datumHash -> return datumHash - Pl.NoOutputDatum -> Nothing - txSkelOutDatum <- Map.lookup datumHash managedTxSkelOutDatums - return (output, txSkelOutDatum) + return + ( output, + case outputOutputDatum output of + Pl.OutputDatum datum -> Map.findWithDefault TxSkelOutNoDatum (Pl.datumHash datum) managedTxSkelOutDatums + Pl.OutputDatumHash datumHash -> Map.findWithDefault TxSkelOutNoDatum datumHash managedTxSkelOutDatums + Pl.NoOutputDatum -> TxSkelOutNoDatum + ) -- | Pretty-print a list of transaction skeleton options, only printing an -- option if its value is non-default. If no non-default options are in the diff --git a/src/Cooked/Pretty/Options.hs b/src/Cooked/Pretty/Options.hs index 0c31445ac..65be14a79 100644 --- a/src/Cooked/Pretty/Options.hs +++ b/src/Cooked/Pretty/Options.hs @@ -1,6 +1,5 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TypeSynonymInstances #-} -- | Pretty-printing options for 'prettyCookedOpt' and their default values. module Cooked.Pretty.Options @@ -8,6 +7,7 @@ module Cooked.Pretty.Options PrettyCookedHashOpts (..), PCOptTxOutRefs (..), hashNamesFromList, + defaultHashNames, ) where