diff --git a/hydra-cardano-api/src/Hydra/Cardano/Api/Pretty.hs b/hydra-cardano-api/src/Hydra/Cardano/Api/Pretty.hs index 53cb6ad7ca5..25bbc43b162 100644 --- a/hydra-cardano-api/src/Hydra/Cardano/Api/Pretty.hs +++ b/hydra-cardano-api/src/Hydra/Cardano/Api/Pretty.hs @@ -34,10 +34,18 @@ renderTxWithUTxO utxo (Tx body _wits) = <> [""] <> inputLines <> [""] + <> collateralInputLines + <> [""] <> referenceInputLines <> [""] <> outputLines <> [""] + <> totalCollateralLines + <> [""] + <> returnCollateralLines + <> [""] + <> feeLines + <> [""] <> validityLines <> [""] <> mintLines @@ -69,6 +77,15 @@ renderTxWithUTxO utxo (Tx body _wits) = Api.TxInsReferenceNone -> [] Api.TxInsReference refInputs -> refInputs + collateralInputLines = + "== COLLATERAL INPUTS (" <> show (length collateralInputs) <> ")" + : (("- " <>) . prettyTxIn <$> sort collateralInputs) + + collateralInputs = + case txInsCollateral content of + Api.TxInsCollateralNone -> [] + Api.TxInsCollateral refInputs -> refInputs + prettyTxIn i = case UTxO.resolve i utxo of Nothing -> T.unpack $ renderTxIn i @@ -79,6 +96,7 @@ renderTxWithUTxO utxo (Tx body _wits) = <> ("\n " <> prettyDatumUtxo (Api.txOutDatum o)) <> ("\n " <> prettyReferenceScript (Api.txOutReferenceScript o)) + outputLines :: [String] outputLines = [ "== OUTPUTS (" <> show (length outs) <> ")" , "Total number of assets: " <> show totalNumberOfAssets @@ -100,6 +118,25 @@ renderTxWithUTxO utxo (Tx body _wits) = let totalValue = foldMap Api.txOutValue outs in length $ toList totalValue + totalCollateralLines :: [String] + totalCollateralLines = + [ "== TOTAL COLLATERAL" + , show $ txTotalCollateral content + ] + + returnCollateralLines :: [String] + returnCollateralLines = + [ "== RETURN COLLATERAL" + , show $ txReturnCollateral content + ] + + feeLines :: [String] + feeLines = + [ "== FEE" + , show $ txFee content + ] + + validityLines :: [String] validityLines = [ "== VALIDITY" , show (txValidityLowerBound content)