diff --git a/cabal.project b/cabal.project index 84f5dd16e1..b2c78c5fee 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2026-04-16T00:15:23Z - , cardano-haskell-packages 2026-04-30T13:08:25Z + , cardano-haskell-packages 2026-05-08T13:26:45Z active-repositories: , :rest diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 695fbae1cf..2c175bf2f0 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -242,7 +242,7 @@ library binary, bytestring, canonical-json, - cardano-api ^>=11.0, + cardano-api ^>=11.1, cardano-binary, cardano-crypto, cardano-crypto-class ^>=2.3, diff --git a/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs index faef8f3a74..f8f0e712b5 100644 --- a/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Compatible/Json/Friendly.hs @@ -43,9 +43,12 @@ import Cardano.CLI.Orphan () import Cardano.CLI.Type.Common (FormatJson (..), FormatYaml (..)) import Cardano.CLI.Type.MonadWarning (MonadWarning, runWarningIO) import Cardano.Crypto.Hash (hashToTextAsHex) +import Cardano.Ledger.Api.Tx qualified as L import Cardano.Ledger.Core qualified as C import Cardano.Ledger.Credential (credKeyHash, credScriptHash) +import Cardano.Ledger.Keys (coerceKeyRole) +import Control.Applicative ((<|>)) import Data.Aeson (Value (..), object, (.=)) import Data.Aeson qualified as Aeson import Data.Aeson.Key qualified as Aeson @@ -53,18 +56,17 @@ import Data.Aeson.KeyMap qualified as KeyMap import Data.Aeson.Types qualified as Aeson import Data.ByteString.Char8 qualified as BSC import Data.Char (isAscii) +import Data.Foldable (asum) import Data.Function ((&)) -import Data.Functor ((<&>)) import Data.Map.Strict qualified as Map import Data.Maybe -import Data.Ratio (numerator) +import Data.Set qualified as Set import Data.Text qualified as T import Data.Text qualified as Text import Data.Typeable (Typeable) import Data.Vector qualified as Vector import Data.Yaml (array) import GHC.Exts (IsList (..)) -import GHC.Real (denominator) import GHC.Unicode (isAlphaNum) import Lens.Micro ((^.)) import Vary (Vary) @@ -93,8 +95,8 @@ friendlyTx :: MonadIO m => Vary [FormatJson, FormatYaml] -> Maybe (File () Out) - -> ShelleyBasedEra era - -> Tx era + -> Exp.Era era + -> Exp.SignedTx era -> m (Either (FileError e) ()) friendlyTx format mOutFile era tx = do pairs <- runWarningIO $ friendlyTxImpl era tx @@ -104,11 +106,11 @@ friendlyTxBody :: MonadIO m => Vary [FormatJson, FormatYaml] -> Maybe (File () Out) - -> ShelleyBasedEra era - -> TxBody era + -> Exp.Era era + -> Exp.UnsignedTx (Exp.LedgerEra era) -> m (Either (FileError e) ()) -friendlyTxBody format mOutFile era tx = do - pairs <- runWarningIO $ friendlyTxBodyImpl era tx +friendlyTxBody format mOutFile era unsignedTx = do + pairs <- runWarningIO $ friendlyTxBodyImpl era unsignedTx friendly format mOutFile $ object pairs friendlyProposal @@ -141,14 +143,17 @@ friendlyProposalImpl ] friendlyTxImpl - :: MonadWarning m - => ShelleyBasedEra era - -> Tx era + :: forall m era + . MonadWarning m + => Exp.Era era + -> Exp.SignedTx era -> m [Aeson.Pair] -friendlyTxImpl era tx = - (("witnesses" .= map friendlyKeyWitness witnesses) :) <$> friendlyTxBodyImpl era body - where - (body, witnesses) = getTxBodyAndWitnesses tx +friendlyTxImpl era (Exp.SignedTx ledgerTx) = + Exp.obtainCommonConstraints era $ + let sbe = convert era :: ShelleyBasedEra era + witnesses = getTxWitnesses (ShelleyTx sbe ledgerTx) + in (("witnesses" .= map friendlyKeyWitness witnesses) :) + <$> friendlyTxBodyImpl era (Exp.UnsignedTx ledgerTx) friendlyKeyWitness :: KeyWitness era -> Aeson.Value friendlyKeyWitness = @@ -163,246 +168,274 @@ friendlyKeyWitness = friendlyTxBodyImpl :: forall m era . MonadWarning m - => ShelleyBasedEra era - -> TxBody era + => Exp.Era era + -> Exp.UnsignedTx (Exp.LedgerEra era) -> m [Aeson.Pair] -friendlyTxBodyImpl sbe tb = do - let era = convert sbe :: CardanoEra era - return - ( mconcat - [ - [ "auxiliary scripts" .= friendlyAuxScripts txAuxScripts - , "certificates" .= forShelleyBasedEraInEon sbe Null (`friendlyCertificates` txCertificates) - , "collateral inputs" .= friendlyCollateralInputs txInsCollateral - , "era" .= era - , "fee" .= friendlyFee txFee - , "inputs" .= friendlyInputs txIns - , "metadata" .= friendlyMetadata txMetadata - , "mint" .= friendlyMintValue txMintValue - , "outputs" .= map (friendlyTxOut sbe) txOuts - , "reference inputs" .= friendlyReferenceInputs txInsReference - , "total collateral" .= friendlyTotalCollateral txTotalCollateral - , "return collateral" .= friendlyReturnCollateral sbe txReturnCollateral - , "required signers (payment key hashes needed for scripts)" - .= friendlyExtraKeyWits txExtraKeyWits - , "update proposal" .= friendlyUpdateProposal txUpdateProposal - , "validity range" .= friendlyValidityRange sbe (txValidityLowerBound, txValidityUpperBound) - , "withdrawals" .= friendlyWithdrawals txWithdrawals - ] - , forShelleyBasedEraInEon - sbe - mempty - (`getScriptWitnessDetails` tb) - , forShelleyBasedEraInEon - sbe - mempty - ( \cOnwards -> - conwayEraOnwardsConstraints cOnwards $ - case txProposalProcedures of - Nothing -> [] - Just (Featured _ TxProposalProceduresNone) -> [] - Just (Featured _ pp) -> do - let lProposals = toList $ convProposalProcedures pp - ["governance actions" .= friendlyLedgerProposals (convert cOnwards) lProposals] - ) - , forShelleyBasedEraInEon - sbe - mempty - ( \cOnwards -> - case txVotingProcedures of - Nothing -> [] - Just (Featured _ TxVotingProceduresNone) -> [] - Just (Featured _ (TxVotingProcedures votes _witnesses)) -> - ["voters" .= friendlyVotingProcedures cOnwards votes] - ) - , forShelleyBasedEraInEon @ConwayEraOnwards - sbe - mempty - (const ["currentTreasuryValue" .= toJSON (unFeatured <$> txCurrentTreasuryValue)]) - , forShelleyBasedEraInEon @ConwayEraOnwards - sbe - mempty - (const ["treasuryDonation" .= toJSON (unFeatured <$> txTreasuryDonation)]) +friendlyTxBodyImpl era (Exp.UnsignedTx ledgerTx) = + pure $ + Exp.obtainCommonConstraints era $ + let body = ledgerTx ^. L.bodyTxL + mAuxData = strictMaybeToMaybe (ledgerTx ^. L.auxDataTxL) + in basePairs era body mAuxData + <> [ "validity range" .= renderValidityInterval (body ^. L.vldtTxBodyL) + , "mint" .= renderMaryMint (body ^. L.mintTxBodyL) + , "collateral inputs" .= renderCollateralInputs body + , renderReqSigners body + , "reference inputs" .= renderReferenceInputs body + , "total collateral" .= toJSON (strictMaybeToMaybe (body ^. L.totalCollateralTxBodyL)) + , "return collateral" .= friendlyReturnCollateral era (body ^. L.collateralReturnTxBodyL) + ] + <> alonzoScriptWitnessPairs era ledgerTx + <> conwayBodyPairs body + +renderCollateralInputs + :: L.AlonzoEraTxBody (Exp.LedgerEra era) + => L.TxBody C.TopTx (Exp.LedgerEra era) + -> Aeson.Value +renderCollateralInputs body = + toJSON (map fromShelleyTxIn (toList (body ^. L.collateralInputsTxBodyL))) + +renderReqSigners + :: L.AlonzoEraTxBody (Exp.LedgerEra era) + => L.TxBody C.TopTx (Exp.LedgerEra era) + -> Aeson.Pair +renderReqSigners body = + "required signers (payment key hashes needed for scripts)" + .= friendlyExtraKeyWits (body ^. L.reqSignerHashesTxBodyG) + +renderReferenceInputs + :: L.BabbageEraTxBody (Exp.LedgerEra era) + => L.TxBody C.TopTx (Exp.LedgerEra era) + -> Aeson.Value +renderReferenceInputs body = + toJSON (map fromShelleyTxIn (toList (body ^. L.referenceInputsTxBodyL))) + +-- | Pairs that are present in every Conway-onwards era. +basePairs + :: forall era + . Exp.Era era + -> L.TxBody C.TopTx (Exp.LedgerEra era) + -> Maybe (L.TxAuxData (Exp.LedgerEra era)) + -> [Aeson.Pair] +basePairs era body mAuxData = + Exp.obtainCommonConstraints era $ + let sbe = convert era :: ShelleyBasedEra era + certs = toList (body ^. L.certsTxBodyL) + in [ "auxiliary scripts" .= friendlyAuxScripts era mAuxData + , "certificates" + .= if null certs + then Null + else array [friendlyCertificate era (Exp.Certificate cert) | cert <- certs] + , "era" .= (convert era :: CardanoEra era) + , "fee" .= friendlyLovelace (body ^. L.feeTxBodyL) + , "inputs" .= toJSON (map fromShelleyTxIn (toList (body ^. L.inputsTxBodyL))) + , "metadata" .= friendlyMetadata mAuxData + , "outputs" + .= map + (friendlyTxOut era . fromCtxUTxOTxOut . fromShelleyTxOut sbe) + (toList (body ^. L.outputsTxBodyL)) + , "withdrawals" .= friendlyWithdrawals (body ^. L.withdrawalsTxBodyL) ] - ) - where - -- Enumerating the fields, so that we are warned by GHC when we add a new one - TxBodyContent - txIns - txInsCollateral - txInsReference - txOuts - txTotalCollateral - txReturnCollateral - txFee - txValidityLowerBound - txValidityUpperBound - txMetadata - txAuxScripts - txExtraKeyWits - _txProtocolParams - txWithdrawals - txCertificates - txUpdateProposal - txMintValue - _txScriptValidity - txProposalProcedures - txVotingProcedures - txCurrentTreasuryValue - txTreasuryDonation = getTxBodyContent tb + +renderValidityInterval :: L.ValidityInterval -> Aeson.Value +renderValidityInterval (L.ValidityInterval invalidBefore invalidHereafter) = + object + [ "lower bound" .= toJSON (strictMaybeToMaybe invalidBefore) + , "upper bound" .= toJSON (strictMaybeToMaybe invalidHereafter) + ] + +renderMaryMint :: L.MultiAsset -> Aeson.Value +renderMaryMint ma + | ma == mempty = Null + | otherwise = friendlyValue (fromMultiAsset ma) + +alonzoScriptWitnessPairs + :: L.AlonzoEraTx (Exp.LedgerEra era) + => Exp.Era era + -> Ledger.Tx C.TopTx (Exp.LedgerEra era) + -> [Aeson.Pair] +alonzoScriptWitnessPairs era tx = + [ "redeemers" .= renderRedeemers era tx + , "scripts" .= renderScriptData tx + , "datums" .= renderDats tx + ] + +conwayBodyPairs + :: forall era + . ( L.ConwayEraTxBody (Exp.LedgerEra era) + , Typeable era + , Exp.IsEra era + , L.EraTx (Exp.LedgerEra era) + ) + => L.TxBody C.TopTx (Exp.LedgerEra era) + -> [Aeson.Pair] +conwayBodyPairs body = + [ "governance actions" + .= friendlyLedgerProposals + (Exp.useEra @era) + (toList (body ^. L.proposalProceduresTxBodyL)) + , "voters" .= toJSON (body ^. L.votingProceduresTxBodyL) + , "currentTreasuryValue" + .= toJSON (strictMaybeToMaybe (body ^. L.currentTreasuryValueTxBodyL)) + , "treasuryDonation" .= toJSON (body ^. L.treasuryDonationTxBodyL) + ] friendlyLedgerProposals - :: Typeable era => Exp.Era era -> [L.ProposalProcedure (ShelleyLedgerEra era)] -> Aeson.Value + :: Typeable era => Exp.Era era -> [L.ProposalProcedure (Exp.LedgerEra era)] -> Aeson.Value friendlyLedgerProposals e proposalProcedures = Array $ fromList $ map (obtainCommonConstraints e friendlyLedgerProposal) proposalProcedures friendlyLedgerProposal - :: (Typeable era, Exp.IsEra era) => L.ProposalProcedure (ShelleyLedgerEra era) -> Aeson.Value -friendlyLedgerProposal proposalProcedure = object $ friendlyProposalImpl (Proposal proposalProcedure) - -friendlyVotingProcedures - :: ConwayEraOnwards era -> L.VotingProcedures (ShelleyLedgerEra era) -> Aeson.Value -friendlyVotingProcedures cOnwards x = conwayEraOnwardsConstraints cOnwards $ toJSON x - -data EraIndependentPlutusScriptPurpose - = Spending - | Minting - | Certifying - | Rewarding - | Voting - | Proposing - | Guarding - -getScriptWitnessDetails - :: forall era. Exp.Era era -> TxBody era -> [Aeson.Pair] -getScriptWitnessDetails era tb = - let ShelleyTx _ ledgerTx = makeSignedTransaction [] tb - in [ "redeemers" .= friendlyRedeemers ledgerTx - , "scripts" .= friendlyScriptData ledgerTx - , "datums" .= friendlyDats ledgerTx - ] + :: forall era. (Typeable era, Exp.IsEra era) => L.ProposalProcedure (Exp.LedgerEra era) -> Aeson.Value +friendlyLedgerProposal proposalProcedure = + Exp.obtainCommonConstraints (Exp.useEra @era) $ + object $ + friendlyProposalImpl (Proposal proposalProcedure) + +renderRedeemers + :: L.AlonzoEraTx (Exp.LedgerEra era) + => Exp.Era era + -> Ledger.Tx C.TopTx (Exp.LedgerEra era) + -> Aeson.Value +renderRedeemers era tx = + let plutusScriptPurposeAndExUnits = Map.toList $ Ledger.unRedeemers $ tx ^. Ledger.witsTxL . Ledger.rdmrsTxWitsL + redeemerList = map (uncurry (renderRedeemerInfo era tx)) plutusScriptPurposeAndExUnits + in Aeson.Array $ Vector.fromList redeemerList + +renderRedeemerInfo + :: L.AlonzoEraTx (Exp.LedgerEra era) + => Exp.Era era + -> Ledger.Tx C.TopTx (Exp.LedgerEra era) + -> Ledger.PlutusPurpose Ledger.AsIx (Exp.LedgerEra era) + -> (Ledger.Data (Exp.LedgerEra era), ExUnits) + -> Aeson.Value +renderRedeemerInfo era tx redeemerPurpose (redeemerData, exUnits) = + let inputNotFoundError = + Aeson.object + [ "error" + .= Aeson.String (T.pack $ "Could not find corresponding input to " ++ show redeemerPurpose) + ] + mCorrespondingInput = strictMaybeToMaybe $ Ledger.redeemerPointerInverse (tx ^. Ledger.bodyTxL) redeemerPurpose + mPurposeRendered = renderPurpose era <$> mCorrespondingInput + in object + [ "purpose" .= fromMaybe inputNotFoundError mPurposeRendered + , "redeemer" .= renderRedeemer redeemerData exUnits + ] + +renderRedeemer :: Ledger.Data era -> ExUnits -> Aeson.Value +renderRedeemer scriptData ExUnits{exUnitsSteps = exSteps, exUnitsMem = exMemUnits} = + object + [ "data" .= Aeson.String (T.pack $ show $ Ledger.unData scriptData) + , "execution units" + .= object + [ "steps" .= Aeson.Number (fromIntegral exSteps) + , "memory" .= Aeson.Number (fromIntegral exMemUnits) + ] + ] + +renderLedgerInput :: Ledger.TxIn -> Aeson.Value +renderLedgerInput (Ledger.TxIn (Ledger.TxId txidHash) ix) = + Aeson.String $ + T.pack $ + T.unpack (hashToTextAsHex (extractHash txidHash)) ++ "#" ++ show (Ledger.txIxToInt ix) + +-- | Render a Plutus purpose. Dispatches on the experimental era to pick the +-- right ledger constructor set. +renderPurpose + :: Exp.Era era + -> Ledger.PlutusPurpose L.AsIxItem (Exp.LedgerEra era) + -> Aeson.Value +renderPurpose era purpose = case era of + Exp.ConwayEra -> + fromMaybe Aeson.Null (alonzoView purpose <|> conwayView purpose) + Exp.DijkstraEra -> + fromMaybe Aeson.Null (alonzoView purpose <|> conwayView purpose <|> dijkstraView purpose) where - aeo = convert era - friendlyRedeemers - :: Ledger.Tx C.TopTx (ShelleyLedgerEra era) - -> Aeson.Value - friendlyRedeemers tx = - alonzoEraOnwardsConstraints aeo $ do - let plutusScriptPurposeAndExUnits = Map.toList $ Ledger.unRedeemers $ tx ^. Ledger.witsTxL . Ledger.rdmrsTxWitsL - redeemerList = map (uncurry $ friendlyRedeemerInfo tx) plutusScriptPurposeAndExUnits - Aeson.Array $ Vector.fromList redeemerList - - friendlyRedeemerInfo - :: Ledger.Tx C.TopTx (ShelleyLedgerEra era) - -> Ledger.PlutusPurpose Ledger.AsIx (ShelleyLedgerEra era) - -> (Ledger.Data (ShelleyLedgerEra era), ExUnits) - -> Aeson.Value - friendlyRedeemerInfo tx redeemerPurpose (redeemerData, exUnits) = - alonzoEraOnwardsConstraints aeo $ do - let inputNotFoundError = - Aeson.object - [ "error" .= Aeson.String (T.pack $ "Could not find corresponding input to " ++ show redeemerPurpose) - ] - mCorrespondingInput = strictMaybeToMaybe $ Ledger.redeemerPointerInverse (tx ^. Ledger.bodyTxL) redeemerPurpose - mFriendlyPurposeResult = friendlyPurpose aeo <$> mCorrespondingInput - in object - [ "purpose" .= fromMaybe inputNotFoundError mFriendlyPurposeResult - , "redeemer" .= friendlyRedeemer redeemerData exUnits - ] + spendingLabel + , mintingLabel + , certifyingLabel + , rewardingLabel + , votingLabel + , proposingLabel + :: Aeson.Key + spendingLabel = "spending script witnessed input" + mintingLabel = "minting currency with policy id" + certifyingLabel = "validating certificate with script credentials" + rewardingLabel = "withdrawing reward from script address" + votingLabel = "voting using script protected voter credentials" + proposingLabel = "submitting a proposal following proposal policy" + + labelPurpose :: ToJSON v => Aeson.Key -> v -> Aeson.Value + labelPurpose k v = Aeson.object [k .= v] + + unAsIxItem :: L.AsIxItem ix it -> it + unAsIxItem (L.AsIxItem _ it) = it + + alonzoView + :: ( L.AlonzoEraScript ledgerEra + , ToJSON (C.TxCert ledgerEra) + ) + => Ledger.PlutusPurpose L.AsIxItem ledgerEra -> Maybe Aeson.Value + alonzoView p = + asum + [ labelPurpose spendingLabel . renderLedgerInput . unAsIxItem <$> L.toSpendingPurpose p + , labelPurpose mintingLabel . unAsIxItem <$> L.toMintingPurpose p + , labelPurpose certifyingLabel . unAsIxItem <$> L.toCertifyingPurpose p + , labelPurpose rewardingLabel . unAsIxItem <$> L.toRewardingPurpose p + ] - friendlyRedeemer :: Ledger.Data (ShelleyLedgerEra era) -> ExUnits -> Aeson.Value - friendlyRedeemer scriptData ExUnits{exUnitsSteps = exSteps, exUnitsMem = exMemUnits} = - object - [ "data" .= Aeson.String (T.pack $ show $ Ledger.unData scriptData) - , "execution units" - .= object - [ "steps" .= Aeson.Number (fromIntegral exSteps) - , "memory" .= Aeson.Number (fromIntegral exMemUnits) + conwayView + :: ( L.ConwayEraScript ledgerEra + , C.EraPParams ledgerEra + ) + => Ledger.PlutusPurpose L.AsIxItem ledgerEra -> Maybe Aeson.Value + conwayView p = + asum + [ labelPurpose votingLabel . unAsIxItem <$> L.toVotingPurpose p + , labelPurpose proposingLabel . unAsIxItem <$> L.toProposingPurpose p + ] + + dijkstraView + :: Ledger.PlutusPurpose L.AsIxItem ledgerEra -> Maybe Aeson.Value + dijkstraView _ = error "TODO Dijkstra" + +renderScriptData + :: ( L.AlonzoEraTxWits (Exp.LedgerEra era) + , L.EraTx (Exp.LedgerEra era) + ) + => Ledger.Tx C.TopTx (Exp.LedgerEra era) -> Aeson.Value +renderScriptData tx = + Aeson.Array $ + Vector.fromList + [ Aeson.Object $ + KeyMap.fromList + [ "script hash" .= scriptHash + , "script data" .= friendlyScript scriptData ] + | (scriptHash, scriptData) <- Map.toList $ tx ^. Ledger.witsTxL . Ledger.scriptTxWitsL ] - friendlyPurpose - :: AlonzoEraOnwards era -> Ledger.PlutusPurpose L.AsIxItem (ShelleyLedgerEra era) -> Aeson.Value - friendlyPurpose AlonzoEraOnwardsAlonzo purpose = - case purpose of - Ledger.AlonzoSpending (L.AsIxItem _ sp) -> addLabelToPurpose Spending (friendlyInput sp) - Ledger.AlonzoMinting (L.AsIxItem _ mp) -> addLabelToPurpose Minting mp - Ledger.AlonzoCertifying (L.AsIxItem _ cp) -> addLabelToPurpose Certifying cp - Ledger.AlonzoRewarding (L.AsIxItem _ rp) -> addLabelToPurpose Rewarding rp - friendlyPurpose AlonzoEraOnwardsBabbage purpose = - case purpose of - Ledger.AlonzoSpending (L.AsIxItem _ sp) -> addLabelToPurpose Spending (friendlyInput sp) - Ledger.AlonzoMinting (L.AsIxItem _ mp) -> addLabelToPurpose Minting mp - Ledger.AlonzoCertifying (L.AsIxItem _ cp) -> addLabelToPurpose Certifying cp - Ledger.AlonzoRewarding (L.AsIxItem _ rp) -> addLabelToPurpose Rewarding rp - friendlyPurpose AlonzoEraOnwardsConway purpose = - case purpose of - Ledger.ConwaySpending (L.AsIxItem _ sp) -> addLabelToPurpose Spending (friendlyInput sp) - Ledger.ConwayMinting (L.AsIxItem _ mp) -> addLabelToPurpose Minting mp - Ledger.ConwayCertifying (L.AsIxItem _ cp) -> addLabelToPurpose Certifying cp - Ledger.ConwayRewarding (L.AsIxItem _ rp) -> addLabelToPurpose Rewarding rp - Ledger.ConwayVoting (L.AsIxItem _ vp) -> addLabelToPurpose Voting vp - Ledger.ConwayProposing (L.AsIxItem _ pp) -> addLabelToPurpose Proposing pp - friendlyPurpose AlonzoEraOnwardsDijkstra purpose = do - let era' = fromJust $ forEraMaybeEon (convert era) - obtainCommonConstraints era' $ - case purpose of - Ledger.DijkstraSpending (L.AsIxItem _ sp) -> addLabelToPurpose Spending (friendlyInput sp) - Ledger.DijkstraMinting (L.AsIxItem _ mp) -> addLabelToPurpose Minting mp - Ledger.DijkstraCertifying (L.AsIxItem _ cp) -> addLabelToPurpose Certifying cp - Ledger.DijkstraRewarding (L.AsIxItem _ rp) -> addLabelToPurpose Rewarding rp - Ledger.DijkstraVoting (L.AsIxItem _ vp) -> addLabelToPurpose Voting vp - Ledger.DijkstraProposing (L.AsIxItem _ pp) -> addLabelToPurpose Proposing pp - Ledger.DijkstraGuarding (L.AsIxItem _ pp) -> addLabelToPurpose Guarding pp - friendlyInput :: Ledger.TxIn -> Aeson.Value - friendlyInput (Ledger.TxIn (Ledger.TxId txidHash) ix) = - Aeson.String $ - T.pack $ - T.unpack (hashToTextAsHex (extractHash txidHash)) ++ "#" ++ show (Ledger.txIxToInt ix) - - addLabelToPurpose - :: ToJSON v - => EraIndependentPlutusScriptPurpose - -> v - -> Aeson.Value - addLabelToPurpose Spending sp = Aeson.object ["spending script witnessed input" .= sp] - addLabelToPurpose Minting mp = Aeson.object ["minting currency with policy id" .= mp] - addLabelToPurpose Certifying cp = Aeson.object ["validating certificate with script credentials" .= cp] - addLabelToPurpose Rewarding rp = Aeson.object ["withdrawing reward from script address" .= rp] - addLabelToPurpose Voting vp = Aeson.object ["voting using script protected voter credentials" .= vp] - addLabelToPurpose Proposing pp = Aeson.object ["submitting a proposal following proposal policy" .= pp] - addLabelToPurpose Guarding _ = error "TODO Dijkstra" - - friendlyScriptData :: Ledger.Tx C.TopTx (ShelleyLedgerEra era) -> Aeson.Value - friendlyScriptData tx = - alonzoEraOnwardsConstraints aeo $ do - Aeson.Array $ - Vector.fromList $ +renderDats + :: ( L.AlonzoEraTxWits (Exp.LedgerEra era) + , L.EraTx (Exp.LedgerEra era) + ) + => Ledger.Tx C.TopTx (Exp.LedgerEra era) -> Aeson.Value +renderDats tx = + let Ledger.TxDats dats = tx ^. Ledger.witsTxL . Ledger.datsTxWitsL + in Aeson.Array $ + Vector.fromList [ Aeson.Object $ KeyMap.fromList - [ "script hash" .= scriptHash - , "script data" .= friendlyScript scriptData + [ "datum hash" .= datHash + , "datum" .= friendlyDatum dat ] - | (scriptHash, scriptData) <- Map.toList $ tx ^. Ledger.witsTxL . Ledger.scriptTxWitsL + | (datHash, dat) <- Map.toList dats ] - friendlyDats :: Ledger.Tx C.TopTx (ShelleyLedgerEra era) -> Aeson.Value - friendlyDats tx = - alonzoEraOnwardsConstraints aeo $ - let Ledger.TxDats dats = tx ^. Ledger.witsTxL . Ledger.datsTxWitsL - in Aeson.Array $ - Vector.fromList $ - [ Aeson.Object $ - KeyMap.fromList - [ "datum hash" .= datHash - , "datum" .= friendlyDatum dat - ] - | (datHash, dat) <- Map.toList dats - ] - -- | Create a friendly JSON out of a script friendlyScript - :: AlonzoEraOnwardsConstraints era => Ledger.Script (ShelleyLedgerEra era) -> Aeson.Value + :: L.AlonzoEraScript (Exp.LedgerEra era) + => Ledger.Script (Exp.LedgerEra era) -> Aeson.Value friendlyScript script = Aeson.Object $ KeyMap.fromList $ case Ledger.getNativeScript script of @@ -427,59 +460,38 @@ friendlyScript script = Aeson.Object $ ] -- | Create a friendly JSON out of a datum -friendlyDatum - :: AlonzoEraOnwardsConstraints era => Alonzo.Data (ShelleyLedgerEra era) -> Aeson.Value +friendlyDatum :: L.Era era => Alonzo.Data era -> Aeson.Value friendlyDatum (Alonzo.Data datum) = Aeson.String (T.pack $ show datum) -friendlyTotalCollateral :: TxTotalCollateral era -> Aeson.Value -friendlyTotalCollateral TxTotalCollateralNone = Aeson.Null -friendlyTotalCollateral (TxTotalCollateral _ coll) = toJSON coll - friendlyReturnCollateral - :: () - => ShelleyBasedEra era - -> TxReturnCollateral CtxTx era + :: forall era + . Exp.Era era + -> L.StrictMaybe (L.TxOut (Exp.LedgerEra era)) -> Aeson.Value friendlyReturnCollateral era = \case - TxReturnCollateralNone -> Aeson.Null - TxReturnCollateral _ collOut -> friendlyTxOut era collOut - -friendlyExtraKeyWits :: TxExtraKeyWitnesses era -> Aeson.Value -friendlyExtraKeyWits = \case - TxExtraKeyWitnessesNone -> Null - TxExtraKeyWitnesses _supported paymentKeyHashes -> toJSON paymentKeyHashes - -friendlyValidityRange - :: ShelleyBasedEra era - -> (TxValidityLowerBound era, TxValidityUpperBound era) - -> Aeson.Value -friendlyValidityRange era = \case - (lowerBound, upperBound) - | isLowerBoundSupported || isUpperBoundSupported -> - object - [ "lower bound" - .= case lowerBound of - TxValidityNoLowerBound -> Null - TxValidityLowerBound _ s -> toJSON s - , "upper bound" - .= case upperBound of - TxValidityUpperBound _ s -> toJSON s - ] - | otherwise -> Null - where - isLowerBoundSupported = isJust $ forShelleyBasedEraInEonMaybe era TxValidityLowerBound - isUpperBoundSupported = isJust $ forShelleyBasedEraInEonMaybe era TxValidityUpperBound - -friendlyWithdrawals :: TxWithdrawals ViewTx era -> Aeson.Value -friendlyWithdrawals TxWithdrawalsNone = Null -friendlyWithdrawals (TxWithdrawals _ withdrawals) = - array - [ object $ - "address" .= serialiseAddress addr - : "amount" .= friendlyLovelace amount - : friendlyStakeAddress addr - | (addr, amount, _) <- withdrawals - ] + L.SNothing -> Aeson.Null + L.SJust collOut -> + Exp.obtainCommonConstraints era $ + let sbe = convert era :: ShelleyBasedEra era + in friendlyTxOut era (fromCtxUTxOTxOut (fromShelleyTxOut sbe collOut)) + +friendlyExtraKeyWits :: Set.Set (L.KeyHash L.Guard) -> Aeson.Value +friendlyExtraKeyWits keyhashes + | Set.null keyhashes = Null + | otherwise = toJSON [PaymentKeyHash (coerceKeyRole kh) | kh <- Set.toList keyhashes] + +friendlyWithdrawals :: L.Withdrawals -> Aeson.Value +friendlyWithdrawals (L.Withdrawals ws) + | Map.null ws = Null + | otherwise = + array + [ object $ + "address" .= serialiseAddress addr + : "amount" .= friendlyLovelace amount + : friendlyStakeAddress addr + | (rewardAccount, amount) <- Map.toList ws + , let addr = fromShelleyStakeAddr rewardAccount + ] friendlyStakeAddress :: StakeAddress -> [Aeson.Pair] friendlyStakeAddress (StakeAddress net cred) = @@ -487,15 +499,15 @@ friendlyStakeAddress (StakeAddress net cred) = , friendlyStakeCredential cred ] -friendlyTxOut :: ShelleyBasedEra era -> TxOut CtxTx era -> Aeson.Value -friendlyTxOut sbe (TxOut addr amount mdatum script) = - shelleyBasedEraConstraints sbe $ +friendlyTxOut :: Exp.Era era -> TxOut CtxTx era -> Aeson.Value +friendlyTxOut era (TxOut addr amount mdatum script) = + Exp.obtainCommonConstraints era $ object $ case addr of AddressInEra ByronAddressInAnyEra byronAdr -> [ "address era" .= String "Byron" , "address" .= serialiseAddress byronAdr - , "amount" .= friendlyTxOutValue amount + , "amount" .= friendlyTxOutValue era amount ] AddressInEra (ShelleyAddressInEra _) saddr@(ShelleyAddress net cred stake) -> let preAlonzo = @@ -503,7 +515,7 @@ friendlyTxOut sbe (TxOut addr amount mdatum script) = : [ "address era" .= Aeson.String "Shelley" , "network" .= net , "address" .= serialiseAddress saddr - , "amount" .= friendlyTxOutValue amount + , "amount" .= friendlyTxOutValue era amount , "stake reference" .= friendlyStakeReference (fromShelleyStakeReference stake) ] datum = ["datum" .= d | d <- maybeToList $ renderDatum mdatum] @@ -523,113 +535,17 @@ friendlyStakeReference = \case StakeAddressByPointer ptr -> String (textShow ptr) StakeAddressByValue cred -> object [friendlyStakeCredential $ toShelleyStakeCredential cred] -friendlyUpdateProposal :: TxUpdateProposal era -> Aeson.Value -friendlyUpdateProposal = \case - TxUpdateProposalNone -> Null - TxUpdateProposal _ (UpdateProposal parameterUpdates epoch) -> - object - [ "epoch" .= epoch - , "updates" - .= [ object - [ "genesis key hash" .= genesisKeyHash - , "update" .= friendlyProtocolParametersUpdate parameterUpdate - ] - | (genesisKeyHash, parameterUpdate) <- Map.assocs parameterUpdates - ] - ] - -friendlyProtocolParametersUpdate :: ProtocolParametersUpdate -> Aeson.Value -friendlyProtocolParametersUpdate - ProtocolParametersUpdate - { protocolUpdateProtocolVersion - , protocolUpdateDecentralization - , protocolUpdateExtraPraosEntropy - , protocolUpdateMaxBlockHeaderSize - , protocolUpdateMaxBlockBodySize - , protocolUpdateMaxTxSize - , protocolUpdateTxFeeFixed - , protocolUpdateTxFeePerByte - , protocolUpdateMinUTxOValue - , protocolUpdateStakeAddressDeposit - , protocolUpdateStakePoolDeposit - , protocolUpdateMinPoolCost - , protocolUpdatePoolRetireMaxEpoch - , protocolUpdateStakePoolTargetNum - , protocolUpdatePoolPledgeInfluence - , protocolUpdateMonetaryExpansion - , protocolUpdateTreasuryCut - , protocolUpdateCollateralPercent - , protocolUpdateMaxBlockExUnits - , protocolUpdateMaxCollateralInputs - , protocolUpdateMaxTxExUnits - , protocolUpdateMaxValueSize - , protocolUpdatePrices - , protocolUpdateUTxOCostPerByte - } = - object . catMaybes $ - [ protocolUpdateProtocolVersion <&> \(major, minor) -> - "protocol version" .= (textShow major <> "." <> textShow minor) - , protocolUpdateDecentralization - <&> ("decentralization parameter" .=) . friendlyRational - , protocolUpdateExtraPraosEntropy - <&> ("extra entropy" .=) . maybe "reset" toJSON - , protocolUpdateMaxBlockHeaderSize <&> ("max block header size" .=) - , protocolUpdateMaxBlockBodySize <&> ("max block body size" .=) - , protocolUpdateMaxTxSize <&> ("max transaction size" .=) - , protocolUpdateTxFeeFixed <&> ("transaction fee constant" .=) - , protocolUpdateTxFeePerByte <&> ("transaction fee linear per byte" .=) - , protocolUpdateMinUTxOValue <&> ("min UTxO value" .=) . friendlyLovelace - , protocolUpdateStakeAddressDeposit - <&> ("key registration deposit" .=) . friendlyLovelace - , protocolUpdateStakePoolDeposit - <&> ("pool registration deposit" .=) . friendlyLovelace - , protocolUpdateMinPoolCost <&> ("min pool cost" .=) . friendlyLovelace - , protocolUpdatePoolRetireMaxEpoch <&> ("pool retirement epoch boundary" .=) - , protocolUpdateStakePoolTargetNum <&> ("number of pools" .=) - , protocolUpdatePoolPledgeInfluence - <&> ("pool influence" .=) . friendlyRational - , protocolUpdateMonetaryExpansion - <&> ("monetary expansion" .=) . friendlyRational - , protocolUpdateTreasuryCut <&> ("treasury expansion" .=) . friendlyRational - , protocolUpdateCollateralPercent - <&> ("collateral inputs share" .=) . (<> "%") . textShow - , protocolUpdateMaxBlockExUnits <&> ("max block execution units" .=) - , protocolUpdateMaxCollateralInputs <&> ("max collateral inputs" .=) - , protocolUpdateMaxTxExUnits <&> ("max transaction execution units" .=) - , protocolUpdateMaxValueSize <&> ("max value size" .=) - , protocolUpdatePrices <&> ("execution prices" .=) . friendlyPrices - , protocolUpdateUTxOCostPerByte - <&> ("UTxO storage cost per byte" .=) . friendlyLovelace - ] - -friendlyPrices :: ExecutionUnitPrices -> Aeson.Value -friendlyPrices ExecutionUnitPrices{priceExecutionMemory, priceExecutionSteps} = - object - [ "memory" .= friendlyRational priceExecutionMemory - , "steps" .= friendlyRational priceExecutionSteps - ] - -friendlyCertificates :: ShelleyBasedEra era -> TxCertificates ViewTx era -> Aeson.Value -friendlyCertificates sbe = \case - TxCertificatesNone -> Null - TxCertificates _ cs -> array $ map (friendlyCertificate sbe . fst) $ toList cs - -friendlyCertificate :: ShelleyBasedEra era -> Exp.Certificate (ShelleyLedgerEra era) -> Aeson.Value -friendlyCertificate sbe = - shelleyBasedEraConstraints sbe $ - object . (: []) . renderCertificate sbe +friendlyCertificate :: Exp.Era era -> Exp.Certificate (Exp.LedgerEra era) -> Aeson.Value +friendlyCertificate era = + Exp.obtainCommonConstraints era $ + object . (: []) . renderCertificate era renderCertificate - :: ShelleyBasedEra era -> Exp.Certificate (ShelleyLedgerEra era) -> (Aeson.Key, Aeson.Value) -renderCertificate sbe (Exp.Certificate c) = - case sbe of - ShelleyBasedEraShelley -> renderShelleyCertificate sbe c - ShelleyBasedEraAllegra -> renderShelleyCertificate sbe c - ShelleyBasedEraMary -> renderShelleyCertificate sbe c - ShelleyBasedEraAlonzo -> renderShelleyCertificate sbe c - ShelleyBasedEraBabbage -> renderShelleyCertificate sbe c - ShelleyBasedEraConway -> renderConwayCertificate c - ShelleyBasedEraDijkstra -> error "renderCertificate: TODO Dijkstra era not supported" + :: Exp.Era era -> Exp.Certificate (Exp.LedgerEra era) -> (Aeson.Key, Aeson.Value) +renderCertificate era (Exp.Certificate c) = + case era of + Exp.ConwayEra -> renderConwayCertificate c + Exp.DijkstraEra -> error "renderCertificate: TODO Dijkstra era not supported" renderDrepCredential :: () @@ -657,44 +573,8 @@ delegateeJson = , "DRep" .= drep ] -renderShelleyCertificate - :: ShelleyBasedEra era -> Ledger.ShelleyTxCert (ShelleyLedgerEra era) -> (Aeson.Key, Aeson.Value) -renderShelleyCertificate sbe c = - case c of - L.ShelleyTxCertDelegCert (L.ShelleyRegCert cred) -> - "stake address registration" .= cred - L.ShelleyTxCertDelegCert (L.ShelleyUnRegCert cred) -> - "stake address deregistration" .= cred - L.ShelleyTxCertDelegCert (L.ShelleyDelegCert cred poolId) -> - "stake address delegation" - .= object - [ "credential" .= cred - , "pool" .= poolId - ] - L.ShelleyTxCertPool (L.RetirePool poolId retirementEpoch) -> - "stake pool retirement" - .= object - [ "pool" .= StakePoolKeyHash poolId - , "epoch" .= retirementEpoch - ] - L.ShelleyTxCertPool (L.RegPool poolParams) -> - "stake pool registration" .= poolParams - L.ShelleyTxCertGenesisDeleg (L.GenesisDelegCert genesisKeyHash delegateKeyHash vrfKeyHash) -> - "genesis key delegation" - .= object - [ "genesis key hash" .= genesisKeyHash - , "delegate key hash" .= delegateKeyHash - , "VRF key hash" .= vrfKeyHash - ] - L.ShelleyTxCertMir (L.MIRCert pot target) -> - "MIR" - .= object - [ "pot" .= friendlyMirPot pot - , friendlyMirTarget sbe target - ] - renderConwayCertificate - :: Ledger.ConwayTxCert (ShelleyLedgerEra ConwayEra) -> (Aeson.Key, Aeson.Value) + :: Ledger.ConwayTxCert (Exp.LedgerEra ConwayEra) -> (Aeson.Key, Aeson.Value) renderConwayCertificate cert = case cert of L.RegDRepTxCert credential coin mAnchor -> @@ -792,19 +672,6 @@ renderConwayCertificate cert = ] _ -> "unsupported certificate" .= String (T.pack $ show cert) -friendlyMirTarget - :: ShelleyBasedEra era -> L.MIRTarget -> Aeson.Pair -friendlyMirTarget sbe = \case - L.StakeAddressesMIR addresses -> - "target stake addresses" - .= [ object - [ friendlyStakeCredential credential - , "amount" .= friendlyLovelace (L.Coin 0 `L.addDeltaCoin` lovelace) - ] - | (credential, lovelace) <- shelleyBasedEraConstraints sbe $ toList addresses - ] - L.SendToOppositePotMIR amount -> "MIR amount" .= friendlyLovelace amount - friendlyStakeCredential :: L.Credential L.Staking -> Aeson.Pair friendlyStakeCredential = \case @@ -820,51 +687,26 @@ friendlyPaymentCredential = \case PaymentCredentialByScript scriptHash -> "payment credential script hash" .= scriptHash -friendlyMirPot :: L.MIRPot -> Aeson.Value -friendlyMirPot = \case - L.ReservesMIR -> "reserves" - L.TreasuryMIR -> "treasury" - -friendlyRational :: Rational -> Aeson.Value -friendlyRational r = - String $ - case d of - 1 -> textShow n - _ -> textShow n <> "/" <> textShow d - where - n = numerator r - d = denominator r - -friendlyFee :: TxFee era -> Aeson.Value -friendlyFee = \case - TxFeeExplicit _ fee -> friendlyLovelace fee - friendlyLovelace :: Lovelace -> Aeson.Value friendlyLovelace value = String $ docToText (pretty value) -friendlyMintValue :: forall era. TxMintValue ViewTx era -> Aeson.Value -friendlyMintValue = \case - TxMintNone -> Null - txMintValue@(TxMintValue w _) -> friendlyValue @era (convert w) $ txMintValueToValue txMintValue - -friendlyTxOutValue :: TxOutValue era -> Aeson.Value -friendlyTxOutValue = \case +friendlyTxOutValue :: Exp.Era era -> TxOutValue era -> Aeson.Value +friendlyTxOutValue era = \case TxOutValueByron lovelace -> friendlyLovelace lovelace - TxOutValueShelleyBased sbe v -> friendlyLedgerValue sbe v + TxOutValueShelleyBased _ v -> + Exp.obtainCommonConstraints era $ friendlyLedgerValue era v friendlyLedgerValue :: () - => ShelleyBasedEra era - -> L.Value (ShelleyLedgerEra era) + => Exp.Era era + -> L.Value (Exp.LedgerEra era) -> Aeson.Value -friendlyLedgerValue sbe v = friendlyValue sbe $ Api.fromLedgerValue sbe v +friendlyLedgerValue era v = + Exp.obtainCommonConstraints era $ + friendlyValue (Api.fromLedgerValue (convert era) v) -friendlyValue - :: () - => ShelleyBasedEra era - -> Api.Value - -> Aeson.Value -friendlyValue _ v = +friendlyValue :: Api.Value -> Aeson.Value +friendlyValue v = object [ case bundle of ValueNestedBundleAda q -> "lovelace" .= q @@ -890,37 +732,49 @@ friendlyValue _ v = nameIsAscii = BSC.all (\c -> isAscii c && isAlphaNum c) nameBS nameAscii = Text.pack $ BSC.unpack nameBS -friendlyMetadata :: TxMetadataInEra era -> Aeson.Value -friendlyMetadata = \case - TxMetadataNone -> Null - TxMetadataInEra _ (TxMetadata m) -> toJSON $ friendlyMetadataValue <$> m - -friendlyMetadataValue :: TxMetadataValue -> Aeson.Value -friendlyMetadataValue = \case - TxMetaNumber int -> toJSON int - TxMetaBytes bytes -> String $ textShow bytes - TxMetaList lst -> array $ map friendlyMetadataValue lst - TxMetaMap m -> +friendlyMetadata + :: forall era + . L.EraTxAuxData era + => Maybe (L.TxAuxData era) -> Aeson.Value +friendlyMetadata Nothing = Null +friendlyMetadata (Just auxData) = + let m = auxData ^. L.metadataTxAuxDataL + in if Map.null m + then Null + else toJSON $ friendlyMetadatum <$> m + +friendlyMetadatum :: L.Metadatum -> Aeson.Value +friendlyMetadatum = \case + L.I int -> toJSON int + L.B bytes -> String $ textShow bytes + L.List lst -> array $ map friendlyMetadatum lst + L.Map m -> array - [array [friendlyMetadataValue k, friendlyMetadataValue v] | (k, v) <- m] - TxMetaText text -> toJSON text - -friendlyAuxScripts :: TxAuxScripts era -> Aeson.Value -friendlyAuxScripts = \case - TxAuxScriptsNone -> Null - TxAuxScripts _ scripts -> String $ textShow scripts - -friendlyReferenceInputs :: TxInsReference era build -> Aeson.Value -friendlyReferenceInputs TxInsReferenceNone = Null -friendlyReferenceInputs (TxInsReference _ txins _) = toJSON txins - -friendlyInputs :: [(TxIn, build)] -> Aeson.Value -friendlyInputs = toJSON . map fst - -friendlyCollateralInputs :: TxInsCollateral era -> Aeson.Value -friendlyCollateralInputs = \case - TxInsCollateralNone -> Null - TxInsCollateral _ txins -> toJSON txins + [array [friendlyMetadatum k, friendlyMetadatum v] | (k, v) <- m] + L.S text -> toJSON text + +-- | Render aux-data scripts. Conway+ aux data exposes native (timelock) and +-- Plutus scripts. Matches the old API's @textShow scripts@ shape. +friendlyAuxScripts + :: Exp.Era era + -> Maybe (L.TxAuxData (Exp.LedgerEra era)) + -> Aeson.Value +friendlyAuxScripts _ Nothing = Null +friendlyAuxScripts era (Just aux) = case era of + Exp.ConwayEra -> renderAux aux + Exp.DijkstraEra -> renderAux aux + where + renderAux + :: ( L.AlonzoEraTxAuxData ledgerEra + , Show (C.NativeScript ledgerEra) + ) + => L.TxAuxData ledgerEra -> Aeson.Value + renderAux ad = + let nat = ad ^. L.nativeScriptsTxAuxDataL + plut = ad ^. L.plutusScriptsTxAuxDataL + in if null nat && Map.null plut + then Null + else String (textShow (nat, plut)) friendlyDRep :: L.DRep -> Aeson.Value friendlyDRep L.DRepAlwaysAbstain = "alwaysAbstain" diff --git a/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/TransactionView/Run.hs b/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/TransactionView/Run.hs index 9984c12710..153b61db96 100644 --- a/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/TransactionView/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/TransactionView/Run.hs @@ -1,5 +1,6 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} module Cardano.CLI.EraIndependent.Debug.TransactionView.Run @@ -8,8 +9,13 @@ module Cardano.CLI.EraIndependent.Debug.TransactionView.Run where import Cardano.Api +import Cardano.Api.Experimental qualified as Exp import Cardano.CLI.Compatible.Exception + ( CIO + , fromEitherCli + , fromEitherIOCli + ) import Cardano.CLI.Compatible.Json.Friendly ( friendlyTx , friendlyTxBody @@ -34,16 +40,25 @@ runTransactionViewCmd unwitnessed <- fromEitherIOCli $ readFileTxBody txbodyFile - InAnyShelleyBasedEra era txbody <- pure $ unIncompleteTxBody unwitnessed + InAnyShelleyBasedEra (sbe :: ShelleyBasedEra era) txbody <- + pure $ unIncompleteTxBody unwitnessed + era <- fromEitherCli (Exp.sbeToEra sbe) -- Why are we differentiating between a transaction body and a transaction? -- In the case of a transaction body, we /could/ simply call @makeSignedTransaction []@ -- to get a transaction which would allow us to reuse friendlyTxBS. However, -- this would mean that we'd have an empty list of witnesses mentioned in the output, which -- is arguably not part of the transaction body. + let ShelleyTx _ ledgerTx = makeSignedTransaction [] txbody + unsignedTx :: Exp.UnsignedTx (Exp.LedgerEra era) + unsignedTx = Exp.obtainCommonConstraints era $ Exp.UnsignedTx ledgerTx fromEitherIOCli @(FileError ()) $ - friendlyTxBody outputFormat mOutFile era txbody + friendlyTxBody outputFormat mOutFile era unsignedTx InputTxFile (File txFilePath) -> do txFile <- liftIO $ fileOrPipe txFilePath - InAnyShelleyBasedEra era tx <- fromEitherIOCli (readFileTx txFile) + InAnyShelleyBasedEra (sbe :: ShelleyBasedEra era) tx <- fromEitherIOCli (readFileTx txFile) + era <- fromEitherCli (Exp.sbeToEra sbe) + let ShelleyTx _ ledgerTx = tx + signedTx :: Exp.SignedTx era + signedTx = Exp.obtainCommonConstraints era $ Exp.SignedTx ledgerTx fromEitherIOCli @(FileError ()) $ - friendlyTx outputFormat mOutFile era tx + friendlyTx outputFormat mOutFile era signedTx diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index ac00562387..a1bac324a8 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -560,7 +560,8 @@ readTxUpdateProposal -> UpdateProposalFile -> ExceptT (FileError TextEnvelopeError) IO (TxUpdateProposal era) readTxUpdateProposal w (UpdateProposalFile upFp) = do - TxUpdateProposal w <$> newExceptT (readFileTextEnvelope (File upFp)) + TxUpdateProposal w + <$> newExceptT (shelleyBasedEraConstraints (convert w) $ readFileTextEnvelope (File upFp)) newtype ConstitutionError = ConstitutionNotUnicodeError Text.UnicodeException diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Debug/TransactionView.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Debug/TransactionView.hs index a266c9a043..23dd013c68 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Debug/TransactionView.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Debug/TransactionView.hs @@ -14,170 +14,6 @@ inputDir, goldenDir :: FilePath inputDir = "test/cardano-cli-golden/files/input" goldenDir = "test/cardano-cli-golden/files/golden" --- ---------------------------------------------------------------------------- --- Shelley era tests --- ---------------------------------------------------------------------------- - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view shelley json/"'@ -hprop_golden_debug_transaction_view_shelley_json :: Property -hprop_golden_debug_transaction_view_shelley_json = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "shelley/tx/signed.tx" - , "--output-json" - ] - H.diffVsGoldenFile result $ goldenDir "shelley/transaction-view.json" - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view shelley yaml/"'@ -hprop_golden_debug_transaction_view_shelley_yaml :: Property -hprop_golden_debug_transaction_view_shelley_yaml = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "shelley/tx/signed.tx" - , "--output-yaml" - ] - H.diffVsGoldenFile result $ goldenDir "shelley/transaction-view.yaml" - --- ---------------------------------------------------------------------------- --- Allegra era tests --- ---------------------------------------------------------------------------- - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view allegra json/"'@ -hprop_golden_debug_transaction_view_allegra_json :: Property -hprop_golden_debug_transaction_view_allegra_json = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "allegra/tx/signed.tx" - , "--output-json" - ] - H.diffVsGoldenFile result $ goldenDir "allegra/transaction-view.json" - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view allegra yaml/"'@ -hprop_golden_debug_transaction_view_allegra_yaml :: Property -hprop_golden_debug_transaction_view_allegra_yaml = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "allegra/tx/signed.tx" - , "--output-yaml" - ] - H.diffVsGoldenFile result $ goldenDir "allegra/transaction-view.yaml" - --- ---------------------------------------------------------------------------- --- Mary era tests --- ---------------------------------------------------------------------------- - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view mary json/"'@ -hprop_golden_debug_transaction_view_mary_json :: Property -hprop_golden_debug_transaction_view_mary_json = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "mary/tx/signed.tx" - , "--output-json" - ] - H.diffVsGoldenFile result $ goldenDir "mary/transaction-view.json" - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view mary yaml/"'@ -hprop_golden_debug_transaction_view_mary_yaml :: Property -hprop_golden_debug_transaction_view_mary_yaml = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "mary/tx/signed.tx" - , "--output-yaml" - ] - H.diffVsGoldenFile result $ goldenDir "mary/transaction-view.yaml" - --- ---------------------------------------------------------------------------- --- Alonzo era tests --- ---------------------------------------------------------------------------- - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view alonzo json/"'@ -hprop_golden_debug_transaction_view_alonzo_json :: Property -hprop_golden_debug_transaction_view_alonzo_json = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "alonzo/tx/signed.tx" - , "--output-json" - ] - H.diffVsGoldenFile result $ goldenDir "alonzo/transaction-view.json" - --- ---------------------------------------------------------------------------- --- Babbage era tests --- ---------------------------------------------------------------------------- - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view babbage json/"'@ -hprop_golden_debug_transaction_view_babbage_json :: Property -hprop_golden_debug_transaction_view_babbage_json = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "babbage/tx/signed.tx" - , "--output-json" - ] - H.diffVsGoldenFile result $ goldenDir "babbage/transaction-view.json" - --- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden debug transaction view babbage yaml/"'@ -hprop_golden_debug_transaction_view_babbage_yaml :: Property -hprop_golden_debug_transaction_view_babbage_yaml = - watchdogProp . propertyOnce $ do - result <- - execCardanoCLI - [ "debug" - , "transaction" - , "view" - , "--tx-file" - , inputDir "babbage/tx/signed.tx" - , "--output-yaml" - ] - H.diffVsGoldenFile result $ goldenDir "babbage/transaction-view.yaml" - -- ---------------------------------------------------------------------------- -- Conway era tests -- ---------------------------------------------------------------------------- diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs index 3a4d3d65c4..685464820c 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/TxView.hs @@ -18,9 +18,9 @@ goldenDir = "test/cardano-cli-golden/files/golden" inputDir = "test/cardano-cli-golden/files/input" -- | Execute me with: --- @cabal test cardano-cli-golden --test-options '-p "/golden view babbage yaml/"'@ -hprop_golden_view_babbage_yaml :: Property -hprop_golden_view_babbage_yaml = +-- @cabal test cardano-cli-golden --test-options '-p "/golden view conway yaml/"'@ +hprop_golden_view_conway_yaml :: Property +hprop_golden_view_conway_yaml = watchdogProp . propertyOnce $ moduleWorkspace "tmp" $ \tempDir -> do transactionBodyFile <- noteTempFile tempDir "transaction-body-file" @@ -169,7 +169,7 @@ hprop_golden_view_babbage_yaml = result <- execCardanoCLI ["debug", "transaction", "view", "--tx-body-file", transactionBodyFile, "--output-yaml"] - H.diffVsGoldenFile result $ goldenDir "alonzo/transaction-view.out" + H.diffVsGoldenFile result $ goldenDir "conway/transaction-view.out" -- | Test metadata format hprop_golden_view_metadata :: Property diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.json b/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.json deleted file mode 100644 index b57d352315..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "auxiliary scripts": null, - "certificates": null, - "collateral inputs": null, - "era": "Allegra", - "fee": "200000 Lovelace", - "inputs": [ - "aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0" - ], - "metadata": null, - "mint": null, - "outputs": [ - { - "address": "addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9", - "address era": "Shelley", - "amount": { - "lovelace": 5000000 - }, - "network": "Mainnet", - "payment credential key hash": "4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169", - "reference script": null, - "stake reference": { - "stake credential key hash": "98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991" - } - } - ], - "reference inputs": null, - "required signers (payment key hashes needed for scripts)": null, - "return collateral": null, - "total collateral": null, - "update proposal": null, - "validity range": { - "lower bound": null, - "upper bound": null - }, - "withdrawals": null, - "witnesses": [] -} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.yaml b/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.yaml deleted file mode 100644 index 399b74c330..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/allegra/transaction-view.yaml +++ /dev/null @@ -1,29 +0,0 @@ -auxiliary scripts: null -certificates: null -collateral inputs: null -era: Allegra -fee: 200000 Lovelace -inputs: -- aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0 -metadata: null -mint: null -outputs: -- address: addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9 - address era: Shelley - amount: - lovelace: 5000000 - network: Mainnet - payment credential key hash: 4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169 - reference script: null - stake reference: - stake credential key hash: 98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991 -reference inputs: null -required signers (payment key hashes needed for scripts): null -return collateral: null -total collateral: null -update proposal: null -validity range: - lower bound: null - upper bound: null -withdrawals: null -witnesses: [] diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/transaction-view.json b/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/transaction-view.json deleted file mode 100644 index 87e756dc8d..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/transaction-view.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "auxiliary scripts": null, - "certificates": null, - "collateral inputs": [], - "era": "Alonzo", - "fee": "200000 Lovelace", - "inputs": [ - "aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0" - ], - "metadata": null, - "mint": null, - "outputs": [ - { - "address": "addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9", - "address era": "Shelley", - "amount": { - "lovelace": 5000000 - }, - "datum": "fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3571", - "network": "Mainnet", - "payment credential key hash": "4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169", - "reference script": null, - "stake reference": { - "stake credential key hash": "98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991" - } - } - ], - "reference inputs": null, - "required signers (payment key hashes needed for scripts)": null, - "return collateral": null, - "total collateral": null, - "update proposal": null, - "validity range": { - "lower bound": null, - "upper bound": null - }, - "withdrawals": null, - "witnesses": [] -} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/babbage/transaction-view.json b/cardano-cli/test/cardano-cli-golden/files/golden/babbage/transaction-view.json deleted file mode 100644 index 48763e90ed..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/babbage/transaction-view.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "auxiliary scripts": null, - "certificates": null, - "collateral inputs": [], - "era": "Babbage", - "fee": "200000 Lovelace", - "inputs": [ - "aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0" - ], - "metadata": null, - "mint": null, - "outputs": [ - { - "address": "addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9", - "address era": "Shelley", - "amount": { - "lovelace": 5000000 - }, - "datum": { - "map": [ - { - "k": { - "bytes": "636f6e7374727563746f72" - }, - "v": { - "int": 0 - } - }, - { - "k": { - "bytes": "6669656c6473" - }, - "v": { - "list": [ - { - "map": [ - { - "k": { - "bytes": "696e74" - }, - "v": { - "int": 42 - } - } - ] - } - ] - } - } - ] - }, - "network": "Mainnet", - "payment credential key hash": "4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169", - "reference script": null, - "stake reference": { - "stake credential key hash": "98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991" - } - } - ], - "reference inputs": [], - "required signers (payment key hashes needed for scripts)": null, - "return collateral": null, - "total collateral": null, - "update proposal": null, - "validity range": { - "lower bound": null, - "upper bound": null - }, - "withdrawals": null, - "witnesses": [] -} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/babbage/transaction-view.yaml b/cardano-cli/test/cardano-cli-golden/files/golden/babbage/transaction-view.yaml deleted file mode 100644 index f4cf0c0197..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/babbage/transaction-view.yaml +++ /dev/null @@ -1,44 +0,0 @@ -auxiliary scripts: null -certificates: null -collateral inputs: [] -era: Babbage -fee: 200000 Lovelace -inputs: -- aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0 -metadata: null -mint: null -outputs: -- address: addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9 - address era: Shelley - amount: - lovelace: 5000000 - datum: - map: - - k: - bytes: 636f6e7374727563746f72 - v: - int: 0 - - k: - bytes: 6669656c6473 - v: - list: - - map: - - k: - bytes: '696e74' - v: - int: 42 - network: Mainnet - payment credential key hash: 4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169 - reference script: null - stake reference: - stake credential key hash: 98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991 -reference inputs: [] -required signers (payment key hashes needed for scripts): null -return collateral: null -total collateral: null -update proposal: null -validity range: - lower bound: null - upper bound: null -withdrawals: null -witnesses: [] diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-detailedschema.out b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-detailedschema.out index 85e8b2f790..ac3350e0ef 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-detailedschema.out +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-detailedschema.out @@ -39,7 +39,6 @@ return collateral: null scripts: [] total collateral: null treasuryDonation: 0 -update proposal: null validity range: lower bound: null upper bound: null diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-noschema.out b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-noschema.out index bf7d7aadfb..a944e66699 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-noschema.out +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view-metadata-noschema.out @@ -72,7 +72,6 @@ return collateral: null scripts: [] total collateral: null treasuryDonation: 0 -update proposal: null validity range: lower bound: null upper bound: null diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.json b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.json index 65326a9520..8a18c53c1a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.json @@ -34,7 +34,6 @@ "scripts": [], "total collateral": null, "treasuryDonation": 0, - "update proposal": null, "validity range": { "lower bound": null, "upper bound": null diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/transaction-view.out b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.out similarity index 99% rename from cardano-cli/test/cardano-cli-golden/files/golden/alonzo/transaction-view.out rename to cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.out index 4da770791a..3e6cee507f 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/alonzo/transaction-view.out +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.out @@ -826,7 +826,6 @@ scripts: script hash: d441227553a0f1a965fee7d60a0f724b368dd1bddbc208730fccebcf total collateral: 10000 treasuryDonation: 1000000 -update proposal: null validity range: lower bound: 140 upper bound: null diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.yaml b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.yaml index cb63f45238..6d478445e4 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.yaml +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/transaction-view.yaml @@ -27,7 +27,6 @@ return collateral: null scripts: [] total collateral: null treasuryDonation: 0 -update proposal: null validity range: lower bound: null upper bound: null diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/conway/tx-proposal.out.json b/cardano-cli/test/cardano-cli-golden/files/golden/conway/tx-proposal.out.json index b5655243b9..8dba3ea15e 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/conway/tx-proposal.out.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/conway/tx-proposal.out.json @@ -58,7 +58,6 @@ "scripts": [], "total collateral": null, "treasuryDonation": 0, - "update proposal": null, "validity range": { "lower bound": null, "upper bound": null diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/mary/transaction-view.json b/cardano-cli/test/cardano-cli-golden/files/golden/mary/transaction-view.json deleted file mode 100644 index 9fcdbb5493..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/mary/transaction-view.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "auxiliary scripts": null, - "certificates": null, - "collateral inputs": null, - "era": "Mary", - "fee": "200000 Lovelace", - "inputs": [ - "aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0" - ], - "metadata": null, - "mint": null, - "outputs": [ - { - "address": "addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9", - "address era": "Shelley", - "amount": { - "lovelace": 5000000, - "policy d441227553a0f1a965fee7d60a0f724b368dd1bddbc208730fccebcf": { - "default asset": 100 - } - }, - "network": "Mainnet", - "payment credential key hash": "4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169", - "reference script": null, - "stake reference": { - "stake credential key hash": "98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991" - } - } - ], - "reference inputs": null, - "required signers (payment key hashes needed for scripts)": null, - "return collateral": null, - "total collateral": null, - "update proposal": null, - "validity range": { - "lower bound": null, - "upper bound": null - }, - "withdrawals": null, - "witnesses": [] -} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/mary/transaction-view.yaml b/cardano-cli/test/cardano-cli-golden/files/golden/mary/transaction-view.yaml deleted file mode 100644 index 8c75b89d39..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/mary/transaction-view.yaml +++ /dev/null @@ -1,31 +0,0 @@ -auxiliary scripts: null -certificates: null -collateral inputs: null -era: Mary -fee: 200000 Lovelace -inputs: -- aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0 -metadata: null -mint: null -outputs: -- address: addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9 - address era: Shelley - amount: - lovelace: 5000000 - policy d441227553a0f1a965fee7d60a0f724b368dd1bddbc208730fccebcf: - default asset: 100 - network: Mainnet - payment credential key hash: 4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169 - reference script: null - stake reference: - stake credential key hash: 98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991 -reference inputs: null -required signers (payment key hashes needed for scripts): null -return collateral: null -total collateral: null -update proposal: null -validity range: - lower bound: null - upper bound: null -withdrawals: null -witnesses: [] diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.json b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.json deleted file mode 100644 index 8418af661c..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "auxiliary scripts": null, - "certificates": null, - "collateral inputs": null, - "era": "Shelley", - "fee": "200000 Lovelace", - "inputs": [ - "aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0" - ], - "metadata": null, - "mint": null, - "outputs": [ - { - "address": "addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9", - "address era": "Shelley", - "amount": { - "lovelace": 5000000 - }, - "network": "Mainnet", - "payment credential key hash": "4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169", - "reference script": null, - "stake reference": { - "stake credential key hash": "98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991" - } - } - ], - "reference inputs": null, - "required signers (payment key hashes needed for scripts)": null, - "return collateral": null, - "total collateral": null, - "update proposal": null, - "validity range": { - "lower bound": null, - "upper bound": null - }, - "withdrawals": null, - "witnesses": [] -} \ No newline at end of file diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.yaml b/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.yaml deleted file mode 100644 index d805419828..0000000000 --- a/cardano-cli/test/cardano-cli-golden/files/golden/shelley/transaction-view.yaml +++ /dev/null @@ -1,29 +0,0 @@ -auxiliary scripts: null -certificates: null -collateral inputs: null -era: Shelley -fee: 200000 Lovelace -inputs: -- aabbccdd01234567aabbccdd01234567aabbccdd01234567aabbccdd01234567#0 -metadata: null -mint: null -outputs: -- address: addr1q98lftnu9ejleqjz8n34znw96c5cf6jt9ar4de7kk90gz6vcjs3ct30t2c255cm29d3pm4m69sazxf25vs9elax8exgsqlcmz9 - address era: Shelley - amount: - lovelace: 5000000 - network: Mainnet - payment credential key hash: 4ff4ae7c2e65fc82423ce3514dc5d62984ea4b2f4756e7d6b15e8169 - reference script: null - stake reference: - stake credential key hash: 98942385c5eb56154a636a2b621dd77a2c3a232554640b9ff4c7c991 -reference inputs: null -required signers (payment key hashes needed for scripts): null -return collateral: null -total collateral: null -update proposal: null -validity range: - lower bound: null - upper bound: null -withdrawals: null -witnesses: [] diff --git a/flake.lock b/flake.lock index 6423f8562d..5f6a26b4a5 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1777581742, - "narHash": "sha256-tvS+sD3FRG621hvRsmF2QpyIwkk5dtopA6ejnO6bMrk=", + "lastModified": 1778248807, + "narHash": "sha256-LI4R+Yl7cy9uO/jWXpo93mUyVMR/UhOoDFVbHV7/abw=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "20e9dea177c8a003436eda8c59311c2dcd558ffc", + "rev": "61c9835abcfc3a6c9b6279226d4502fa877bb6a7", "type": "github" }, "original": {