From 47eaafa8d01b1c912bf4c891e46ca11318cfb1b2 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Tue, 13 Feb 2024 01:59:19 +0100 Subject: [PATCH] Unify qualification of Cardano.Api.Ledger to L --- .../EraBased/Commands/Governance/Actions.hs | 30 ++--- .../EraBased/Commands/Governance/Committee.hs | 4 +- .../CLI/EraBased/Commands/Governance/DRep.hs | 4 +- .../CLI/EraBased/Commands/Governance/Vote.hs | 4 +- .../EraBased/Options/Governance/Actions.hs | 25 ++-- .../Cardano/CLI/EraBased/Run/Governance.hs | 16 +-- .../CLI/EraBased/Run/Governance/Actions.hs | 58 +++++----- .../CLI/EraBased/Run/Governance/DRep.hs | 6 +- .../CLI/EraBased/Run/Governance/Hash.hs | 12 +- .../CLI/EraBased/Run/Governance/Vote.hs | 12 +- .../Cardano/CLI/EraBased/Run/StakeAddress.hs | 14 +-- .../src/Cardano/CLI/EraBased/Run/StakePool.hs | 6 +- .../Cardano/CLI/EraBased/Run/Transaction.hs | 12 +- cardano-cli/src/Cardano/CLI/Json/Friendly.hs | 108 +++++++++--------- .../src/Cardano/CLI/Legacy/Run/Governance.hs | 4 +- cardano-cli/src/Cardano/CLI/Types/Output.hs | 6 +- 16 files changed, 160 insertions(+), 161 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs index 6fcd72ef98..b1409de9e7 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Actions.hs @@ -22,7 +22,7 @@ module Cardano.CLI.EraBased.Commands.Governance.Actions ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Common @@ -44,11 +44,11 @@ data GovernanceActionCmds era data GoveranceActionUpdateCommitteeCmdArgs era = GoveranceActionUpdateCommitteeCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , oldCommitteeVkeySource :: ![VerificationKeyOrHashOrFile CommitteeColdKey] , newCommitteeVkeySource :: ![(VerificationKeyOrHashOrFile CommitteeColdKey, EpochNo)] , requiredQuorum :: !Rational @@ -59,14 +59,14 @@ data GoveranceActionUpdateCommitteeCmdArgs era data GovernanceActionCreateConstitutionCmdArgs era = GovernanceActionCreateConstitutionCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , stakeCredential :: !(VerificationKeyOrHashOrFile StakeKey) , mPrevGovernanceActionId :: !(Maybe (TxId, Word32)) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , constitutionUrl :: !ConstitutionUrl - , constitutionHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , constitutionHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , outFile :: !(File () Out) } deriving Show @@ -74,22 +74,22 @@ data GovernanceActionCreateConstitutionCmdArgs era data GovernanceActionInfoCmdArgs era = GovernanceActionInfoCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , outFile :: !(File () Out) } deriving Show data GovernanceActionCreateNoConfidenceCmdArgs era = GovernanceActionCreateNoConfidenceCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnStakeAddress :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , governanceActionId :: !TxId , governanceActionIndex :: !Word32 , outFile :: !(File () Out) @@ -115,11 +115,11 @@ data GovernanceActionProtocolParametersUpdateCmdArgs era data GovernanceActionTreasuryWithdrawalCmdArgs era = GovernanceActionTreasuryWithdrawalCmdArgs { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , treasuryWithdrawal :: ![(VerificationKeyOrHashOrFile StakeKey, Lovelace)] , constitutionScriptHash :: !(Maybe ScriptHash) , outFile :: !(File () Out) @@ -136,11 +136,11 @@ data GovernanceActionViewCmdArgs era data UpdateProtocolParametersConwayOnwards era = UpdateProtocolParametersConwayOnwards { eon :: !(ConwayEraOnwards era) - , networkId :: !Ledger.Network + , networkId :: !L.Network , deposit :: !Lovelace , returnAddr :: !(VerificationKeyOrHashOrFile StakeKey) , proposalUrl :: !ProposalUrl - , proposalHash :: !(Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , proposalHash :: !(L.SafeHash L.StandardCrypto L.AnchorData) , governanceActionId :: !(Maybe (TxId, Word32)) , constitutionScriptHash :: !(Maybe ScriptHash) } @@ -148,7 +148,7 @@ data UpdateProtocolParametersConwayOnwards era data CostModelsFile era = CostModelsFile { eon :: !(AlonzoEraOnwards era) - , costModelsFile :: !(File Ledger.CostModels In) + , costModelsFile :: !(File L.CostModels In) } deriving Show deriving instance Show (UpdateProtocolParametersConwayOnwards era) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs index 9746c3f9ef..4a800cee9e 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Committee.hs @@ -13,7 +13,7 @@ module Cardano.CLI.EraBased.Commands.Governance.Committee ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Key @@ -61,7 +61,7 @@ data GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs era = GovernanceCommitteeCreateColdKeyResignationCertificateCmdArgs { eon :: !(ConwayEraOnwards era) , vkeyColdKeySource :: !(VerificationKeyOrHashOrFile CommitteeColdKey) - , anchor :: !(Maybe (Ledger.Anchor (Ledger.EraCrypto (ShelleyLedgerEra era)))) + , anchor :: !(Maybe (L.Anchor (L.EraCrypto (ShelleyLedgerEra era)))) , outFile :: !(File () Out) } deriving Show diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs index 49d5aab84a..63ad5a98df 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/DRep.hs @@ -15,7 +15,7 @@ module Cardano.CLI.EraBased.Commands.Governance.DRep where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Common @@ -50,7 +50,7 @@ data GovernanceDRepRegistrationCertificateCmdArgs era = { eon :: !(ConwayEraOnwards era) , drepHashSource :: !DRepHashSource , deposit :: !Lovelace - , mAnchor :: !(Maybe (Ledger.Anchor (Ledger.EraCrypto (ShelleyLedgerEra era)))) + , mAnchor :: !(Maybe (L.Anchor (L.EraCrypto (ShelleyLedgerEra era)))) , outFile :: !(File () Out) } diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs index 8ca7ec2a09..b7ee797aeb 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/Governance/Vote.hs @@ -9,7 +9,7 @@ module Cardano.CLI.EraBased.Commands.Governance.Vote , GovernanceVoteCreateCmdArgs(..) , renderGovernanceVoteCmds ) where -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.Types.Common @@ -30,7 +30,7 @@ data GovernanceVoteCreateCmdArgs era , voteChoice :: Vote , governanceAction :: (TxId, Word32) , votingStakeCredentialSource :: AnyVotingStakeVerificationKeyOrHashOrFile - , mAnchor :: Maybe (VoteUrl, Ledger.SafeHash Ledger.StandardCrypto Ledger.AnchorData) + , mAnchor :: Maybe (VoteUrl, L.SafeHash L.StandardCrypto L.AnchorData) , outFile :: VoteFile Out } diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index 4d49dcc191..bab118c5b8 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -7,8 +7,7 @@ module Cardano.CLI.EraBased.Options.Governance.Actions ) where import Cardano.Api -import Cardano.Api.Ledger -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Actions as Cmd @@ -219,20 +218,20 @@ pGovernanceActionProtocolParametersUpdateCmd era = do <$> pUpdateProtocolParametersCmd w -convertToLedger :: (a -> b) -> Parser (Maybe a) -> Parser (StrictMaybe b) -convertToLedger conv = fmap (maybeToStrictMaybe . fmap conv) +convertToLedger :: (a -> b) -> Parser (Maybe a) -> Parser (L.StrictMaybe b) +convertToLedger conv = fmap (L.maybeToStrictMaybe . fmap conv) -toNonNegativeIntervalOrErr :: Rational -> NonNegativeInterval -toNonNegativeIntervalOrErr r = case Ledger.boundRational r of +toNonNegativeIntervalOrErr :: Rational -> L.NonNegativeInterval +toNonNegativeIntervalOrErr r = case L.boundRational r of Nothing -> error $ mconcat [ "toNonNegativeIntervalOrErr: " , "rational out of bounds " <> show r ] Just n -> n -mkProtocolVersionOrErr :: (Natural, Natural) -> Ledger.ProtVer +mkProtocolVersionOrErr :: (Natural, Natural) -> L.ProtVer mkProtocolVersionOrErr (majorProtVer, minorProtVer) = - case (`Ledger.ProtVer` minorProtVer) <$> Ledger.mkVersion majorProtVer of + case (`L.ProtVer` minorProtVer) <$> L.mkVersion majorProtVer of Just v -> v Nothing -> error $ "mkProtocolVersionOrErr: invalid protocol version " <> show (majorProtVer, minorProtVer) @@ -273,7 +272,7 @@ pShelleyToAlonzoPParams = pAlonzoOnwardsPParams :: Parser (AlonzoOnwardsPParams ledgerera) pAlonzoOnwardsPParams = - AlonzoOnwardsPParams SNothing -- The cost models are read separately from a file, so we use 'SNothing' as the place holder here + AlonzoOnwardsPParams L.SNothing -- The cost models are read separately from a file, so we use 'SNothing' as the place holder here <$> convertToLedger (either (\e -> error $ "pAlonzoOnwardsPParams: " <> show e) id . toAlonzoPrices) (optional pExecutionUnitPrices) <*> convertToLedger toAlonzoExUnits (optional pMaxTxExecutionUnits) @@ -286,7 +285,7 @@ pAlonzoOnwardsPParams = pIntroducedInBabbagePParams :: Parser (IntroducedInBabbagePParams ledgerera) pIntroducedInBabbagePParams = IntroducedInBabbagePParams - <$> convertToLedger (CoinPerByte . toShelleyLovelace) (optional pUTxOCostPerByte) + <$> convertToLedger (L.CoinPerByte . toShelleyLovelace) (optional pUTxOCostPerByte) pIntroducedInConwayPParams :: Parser (IntroducedInConwayPParams ledgerera) pIntroducedInConwayPParams = @@ -363,13 +362,13 @@ pGovernanceActionTreasuryWithdrawalCmd era = do ) $ Opt.progDesc "Create a treasury withdrawal." -pNetwork :: Parser Ledger.Network +pNetwork :: Parser L.Network pNetwork = asum $ mconcat - [ [ Opt.flag' Ledger.Mainnet $ mconcat + [ [ Opt.flag' L.Mainnet $ mconcat [ Opt.long "mainnet" , Opt.help "Use the mainnet magic id." ] - , Opt.flag' Ledger.Testnet $ mconcat + , Opt.flag' L.Testnet $ mconcat [ Opt.long "testnet" , Opt.help "Use the testnet magic id." ] diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs index 7aba46f9a4..6989a4db25 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs @@ -16,7 +16,7 @@ module Cardano.CLI.EraBased.Run.Governance ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance as Cmd @@ -79,7 +79,7 @@ runGovernanceCmds = \case runGovernanceMIRCertificatePayStakeAddrs :: ShelleyToBabbageEra era - -> Ledger.MIRPot + -> L.MIRPot -> [StakeAddress] -- ^ Stake addresses -> [Lovelace] -- ^ Corresponding reward amounts (same length) -> File () Out @@ -90,8 +90,8 @@ runGovernanceMIRCertificatePayStakeAddrs w mirPot sAddrs rwdAmts oFp = do (unFile oFp) (length sAddrs) (length rwdAmts) let sCreds = map stakeAddressCredential sAddrs - mirTarget = Ledger.StakeAddressesMIR - $ Map.fromList [ (toShelleyStakeCredential scred, Ledger.toDeltaCoin (toShelleyLovelace rwdAmt)) + mirTarget = L.StakeAddressesMIR + $ Map.fromList [ (toShelleyStakeCredential scred, L.toDeltaCoin (toShelleyLovelace rwdAmt)) | (scred, rwdAmt) <- zip sCreds rwdAmts ] let mirCert = makeMIRCertificate @@ -113,9 +113,9 @@ runGovernanceCreateMirCertificateTransferToTreasuryCmd :: () -> File () Out -> ExceptT GovernanceCmdError IO () runGovernanceCreateMirCertificateTransferToTreasuryCmd w ll oFp = do - let mirTarget = Ledger.SendToOppositePotMIR (toShelleyLovelace ll) + let mirTarget = L.SendToOppositePotMIR (toShelleyLovelace ll) - let mirCert = makeMIRCertificate $ MirCertificateRequirements w Ledger.ReservesMIR mirTarget + let mirCert = makeMIRCertificate $ MirCertificateRequirements w L.ReservesMIR mirTarget firstExceptT GovernanceCmdTextEnvWriteError . newExceptT @@ -132,9 +132,9 @@ runGovernanceCreateMirCertificateTransferToReservesCmd :: () -> File () Out -> ExceptT GovernanceCmdError IO () runGovernanceCreateMirCertificateTransferToReservesCmd w ll oFp = do - let mirTarget = Ledger.SendToOppositePotMIR (toShelleyLovelace ll) + let mirTarget = L.SendToOppositePotMIR (toShelleyLovelace ll) - let mirCert = makeMIRCertificate $ MirCertificateRequirements w Ledger.TreasuryMIR mirTarget + let mirCert = makeMIRCertificate $ MirCertificateRequirements w L.TreasuryMIR mirTarget firstExceptT GovernanceCmdTextEnvWriteError . newExceptT diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index ae61bfd0e1..9f786ee67d 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -13,7 +13,7 @@ module Cardano.CLI.EraBased.Run.Governance.Actions import Cardano.Api import Cardano.Api.Ledger (StrictMaybe (..)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.Governance.Actions @@ -92,9 +92,9 @@ runGovernanceActionInfoCmd } = do returnKeyHash <- readStakeKeyHash returnStakeAddress - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } let sbe = conwayEraOnwardsToShelleyBasedEra eon @@ -123,14 +123,14 @@ runGovernanceActionCreateNoConfidenceCmd } = do returnKeyHash <- readStakeKeyHash returnStakeAddress - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } let sbe = conwayEraOnwardsToShelleyBasedEra eon previousGovernanceAction = MotionOfNoConfidence - $ Ledger.SJust + $ L.SJust $ shelleyBasedEraConstraints sbe $ createPreviousGovernanceActionId governanceActionId @@ -161,17 +161,17 @@ runGovernanceActionCreateConstitutionCmd stakeKeyHash <- readStakeKeyHash stakeCredential - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } - let prevGovActId = Ledger.maybeToStrictMaybe + let prevGovActId = L.maybeToStrictMaybe $ shelleyBasedEraConstraints sbe $ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId - constitutionAnchor = Ledger.Anchor - { Ledger.anchorUrl = unConstitutionUrl constitutionUrl - , Ledger.anchorDataHash = constitutionHash + constitutionAnchor = L.Anchor + { L.anchorUrl = unConstitutionUrl constitutionUrl + , L.anchorDataHash = constitutionHash } govAct = ProposeNewConstitution prevGovActId constitutionAnchor sbe = conwayEraOnwardsToShelleyBasedEra eon @@ -201,14 +201,14 @@ runGovernanceActionCreateNewCommitteeCmd , Cmd.outFile } = do let sbe = conwayEraOnwardsToShelleyBasedEra eon - govActIdentifier = Ledger.maybeToStrictMaybe + govActIdentifier = L.maybeToStrictMaybe $ shelleyBasedEraConstraints sbe $ uncurry createPreviousGovernanceActionId <$> mPrevGovernanceActionId quorumRational = toRational requiredQuorum - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } oldCommitteeKeyHashes <- forM oldCommitteeVkeySource $ \vkeyOrHashOrTextFile -> @@ -278,13 +278,13 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do let updateProtocolParams = createEraBasedProtocolParamUpdate sbe eraBasedPParams - prevGovActId = Ledger.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovActId - proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + prevGovActId = L.maybeToStrictMaybe $ uncurry createPreviousGovernanceActionId <$> mPrevGovActId + proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } govAct = UpdatePParams prevGovActId updateProtocolParams - (toShelleyScriptHash <$> Ledger.maybeToStrictMaybe mConstitutionalScriptHash) + (toShelleyScriptHash <$> L.maybeToStrictMaybe mConstitutionalScriptHash) let proposalProcedure = createProposalProcedure sbe network deposit returnKeyHash govAct proposalAnchor @@ -311,7 +311,7 @@ readStakeKeyHash stake = addCostModelsToEraBasedProtocolParametersUpdate :: AlonzoEraOnwards era - -> Ledger.CostModels + -> L.CostModels -> EraBasedProtocolParametersUpdate era -> EraBasedProtocolParametersUpdate era addCostModelsToEraBasedProtocolParametersUpdate @@ -346,9 +346,9 @@ runGovernanceActionTreasuryWithdrawalCmd , Cmd.outFile } = do - let proposalAnchor = Ledger.Anchor - { Ledger.anchorUrl = unProposalUrl proposalUrl - , Ledger.anchorDataHash = proposalHash + let proposalAnchor = L.Anchor + { L.anchorUrl = unProposalUrl proposalUrl + , L.anchorDataHash = proposalHash } returnKeyHash <- readStakeKeyHash returnAddr @@ -359,7 +359,7 @@ runGovernanceActionTreasuryWithdrawalCmd let sbe = conwayEraOnwardsToShelleyBasedEra eon treasuryWithdrawals = TreasuryWithdrawal withdrawals - (toShelleyScriptHash <$> Ledger.maybeToStrictMaybe constitutionScriptHash) + (toShelleyScriptHash <$> L.maybeToStrictMaybe constitutionScriptHash) proposal = createProposalProcedure sbe networkId deposit returnKeyHash treasuryWithdrawals proposalAnchor firstExceptT GovernanceActionsCmdWriteFileError . newExceptT diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs index 424388d157..e88e17aaad 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -16,7 +16,7 @@ module Cardano.CLI.EraBased.Run.Governance.DRep import Cardano.Api import Cardano.Api.Ledger (Credential (KeyHashObj)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.DRep as Cmd @@ -114,13 +114,13 @@ runGovernanceDRepRegistrationCertificateCmd drepCred <- case drepHashSource of DRepHashSourceScript (ScriptHash scriptHash) -> - return $ Ledger.ScriptHashObj scriptHash + return $ L.ScriptHashObj scriptHash DRepHashSourceVerificationKey drepVkeyHashSource -> do DRepKeyHash drepKeyHash <- firstExceptT RegistrationReadError . newExceptT $ readVerificationKeyOrHashOrFile AsDRepKey drepVkeyHashSource - return $ Ledger.KeyHashObj $ conwayEraOnwardsConstraints w drepKeyHash + return $ L.KeyHashObj $ conwayEraOnwardsConstraints w drepKeyHash let req = DRepRegistrationRequirements w drepCred deposit registrationCert = makeDrepRegistrationCertificate req mAnchor description = Just @TextEnvelopeDescr "DRep Key Registration Certificate" diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs index ef9cf0a62d..d5fd8d4e81 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Hash.hs @@ -14,7 +14,7 @@ module Cardano.CLI.EraBased.Run.Governance.Hash ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import qualified Cardano.CLI.EraBased.Commands.Governance.Hash as Cmd import Cardano.CLI.Read @@ -52,23 +52,23 @@ runGovernanceHashAnchorDataCmd Cmd.GovernanceHashAnchorDataCmdArgs { toHash, mou Cmd.GovernanceAnchorDataHashSourceBinaryFile fp -> do let path = unFile fp bytes <- handleIOExceptT (GovernanceHashReadFileError path) $ BS.readFile path - let hash = Ledger.hashAnchorData $ Ledger.AnchorData bytes + let hash = L.hashAnchorData $ L.AnchorData bytes printHash hash Cmd.GovernanceAnchorDataHashSourceTextFile fp -> do let path = unFile fp text <- handleIOExceptT (GovernanceHashReadFileError path) $ Text.readFile path - let hash = Ledger.hashAnchorData $ Ledger.AnchorData $ Text.encodeUtf8 text + let hash = L.hashAnchorData $ L.AnchorData $ Text.encodeUtf8 text printHash hash Cmd.GovernanceAnchorDataHashSourceText text -> do - let hash = Ledger.hashAnchorData $ Ledger.AnchorData $ Text.encodeUtf8 text + let hash = L.hashAnchorData $ L.AnchorData $ Text.encodeUtf8 text printHash hash where - printHash :: Ledger.SafeHash Ledger.StandardCrypto i -> ExceptT GovernanceHashError IO () + printHash :: L.SafeHash L.StandardCrypto i -> ExceptT GovernanceHashError IO () printHash hash = do firstExceptT GovernanceHashWriteFileError $ newExceptT $ writeTextOutput moutFile text where - text = hashToTextAsHex . Ledger.extractHash $ hash + text = hashToTextAsHex . L.extractHash $ hash runGovernanceHashScriptCmd :: () => Cmd.GovernanceHashScriptCmdArgs era diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index c787472e4a..7e34eff091 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -11,7 +11,7 @@ module Cardano.CLI.EraBased.Run.Governance.Vote ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Vote as Cmd @@ -56,24 +56,24 @@ runGovernanceVoteCreateCmd voteProcedure <- case mAnchor of Nothing -> pure $ createVotingProcedure eon voteChoice Nothing Just (VoteUrl url, voteHash) -> shelleyBasedEraConstraints sbe $ do - let voteAnchor = Ledger.Anchor { Ledger.anchorUrl = url, Ledger.anchorDataHash = voteHash } + let voteAnchor = L.Anchor { L.anchorUrl = url, L.anchorDataHash = voteHash } VotingProcedure votingProcedureWithoutAnchor = createVotingProcedure eon voteChoice Nothing - votingProcedureWithAnchor = VotingProcedure $ votingProcedureWithoutAnchor { Ledger.vProcAnchor = Ledger.SJust voteAnchor } + votingProcedureWithAnchor = VotingProcedure $ votingProcedureWithoutAnchor { L.vProcAnchor = L.SJust voteAnchor } pure votingProcedureWithAnchor shelleyBasedEraConstraints sbe $ do voter <- firstExceptT GovernanceVoteCmdReadVerificationKeyError $ case votingStakeCredentialSource of AnyDRepVerificationKeyOrHashOrFile stake -> do DRepKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsDRepKey stake - pure $ Ledger.DRepVoter $ Ledger.KeyHashObj h + pure $ L.DRepVoter $ L.KeyHashObj h AnyStakePoolVerificationKeyOrHashOrFile stake -> do StakePoolKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsStakePoolKey stake - pure $ Ledger.StakePoolVoter h + pure $ L.StakePoolVoter h AnyCommitteeHotVerificationKeyOrHashOrFile stake -> do CommitteeHotKeyHash h <- newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsCommitteeHotKey stake - pure $ Ledger.CommitteeVoter $ Ledger.KeyHashObj h + pure $ L.CommitteeVoter $ L.KeyHashObj h let govActIdentifier = createGovernanceActionId govActionTxId govActionIndex votingProcedures = singletonVotingProcedures eon voter govActIdentifier (unVotingProcedure voteProcedure) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index ab1d45586a..f5a70f23ef 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -19,7 +19,7 @@ module Cardano.CLI.EraBased.Run.StakeAddress ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.StakeAddress @@ -219,11 +219,11 @@ runStakeAddressStakeAndVoteDelegationCertificateCmd w stakeVerifier poolVKeyOrHa readVoteDelegationTarget voteDelegationTarget & firstExceptT StakeAddressCmdDelegationError - let delegatee = Ledger.DelegStakeVote poolStakeVKeyHash drep + let delegatee = L.DelegStakeVote poolStakeVKeyHash drep let certificate = ConwayCertificate w - $ Ledger.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee + $ L.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee firstExceptT StakeAddressCmdWriteFileError . newExceptT @@ -248,11 +248,11 @@ runStakeAddressVoteDelegationCertificateCmd w stakeVerifier voteDelegationTarget readVoteDelegationTarget voteDelegationTarget & firstExceptT StakeAddressCmdDelegationError - let delegatee = Ledger.DelegVote drep + let delegatee = L.DelegVote drep let certificate = ConwayCertificate w - $ Ledger.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee + $ L.mkDelegTxCert (toShelleyStakeCredential stakeCredential) delegatee firstExceptT StakeAddressCmdWriteFileError . newExceptT @@ -269,11 +269,11 @@ createStakeDelegationCertificate stakeCredential (StakePoolKeyHash poolStakeVKey (\w -> shelleyToBabbageEraConstraints w $ ShelleyRelatedCertificate w - $ Ledger.mkDelegStakeTxCert (toShelleyStakeCredential stakeCredential) poolStakeVKeyHash) + $ L.mkDelegStakeTxCert (toShelleyStakeCredential stakeCredential) poolStakeVKeyHash) (\w -> conwayEraOnwardsConstraints w $ ConwayCertificate w - $ Ledger.mkDelegTxCert (toShelleyStakeCredential stakeCredential) (Ledger.DelegStake poolStakeVKeyHash) + $ L.mkDelegTxCert (toShelleyStakeCredential stakeCredential) (L.DelegStake poolStakeVKeyHash) ) runStakeAddressDeregistrationCertificateCmd :: () diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs index 212a71606e..f591512cfd 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakePool.hs @@ -15,7 +15,7 @@ module Cardano.CLI.EraBased.Run.StakePool ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.StakePool @@ -124,7 +124,7 @@ runStakePoolRegistrationCertificateCmd createStakePoolRegistrationRequirements :: () => ShelleyBasedEra era - -> Ledger.PoolParams (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> L.PoolParams (L.EraCrypto (ShelleyLedgerEra era)) -> StakePoolRegistrationRequirements era createStakePoolRegistrationRequirements sbe pparams = case sbe of @@ -173,7 +173,7 @@ runStakePoolDeregistrationCertificateCmd createStakePoolRetirementRequirements :: () => ShelleyBasedEra era -> PoolId - -> Ledger.EpochNo + -> L.EpochNo -> StakePoolRetirementRequirements era createStakePoolRetirementRequirements sbe pid epoch = case sbe of diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 4be66c5bdc..071e93d675 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -34,7 +34,7 @@ module Cardano.CLI.EraBased.Run.Transaction import Cardano.Api import Cardano.Api.Byron hiding (SomeByronSigningKey (..)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Transaction as Cmd @@ -247,11 +247,11 @@ runTransactionBuildCmd in lift (cardanoEraConstraints era $ writeTxFileTextEnvelopeCddl eon fpath noWitTx) & onLeft (left . TxCmdWriteFileError) -getExecutionUnitPrices :: CardanoEra era -> LedgerProtocolParameters era -> Maybe Ledger.Prices +getExecutionUnitPrices :: CardanoEra era -> LedgerProtocolParameters era -> Maybe L.Prices getExecutionUnitPrices cEra (LedgerProtocolParameters pp) = forEraInEonMaybe cEra $ \aeo -> alonzoEraOnwardsConstraints aeo $ - pp ^. Ledger.ppPricesL + pp ^. L.ppPricesL runTransactionBuildRawCmd :: () => Cmd.TransactionBuildRawCmdArgs era @@ -296,7 +296,7 @@ runTransactionBuildRawCmd mapM (readFileScriptInAnyLang . unScriptFile) scriptFiles txAuxScripts <- hoistEither $ first TxCmdAuxScriptsValidationError $ validateTxAuxScripts eon scripts - -- TODO: Conway era - update readProtocolParameters to rely on Ledger.PParams JSON instances + -- TODO: Conway era - update readProtocolParameters to rely on L.PParams JSON instances pparams <- forM mProtocolParamsFile $ \ppf -> firstExceptT TxCmdProtocolParamsError (readProtocolParameters ppf) @@ -714,8 +714,8 @@ toAddressInShelleyBasedEra sbe sAddr = runExcept $ pure (AddressInEra (ShelleyAddressInEra sbe) sAddr) -lovelaceToCoin :: Lovelace -> Ledger.Coin -lovelaceToCoin (Lovelace ll) = Ledger.Coin ll +lovelaceToCoin :: Lovelace -> L.Coin +lovelaceToCoin (Lovelace ll) = L.Coin ll toTxOutValueInAnyEra :: ShelleyBasedEra era diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index 2607bc9a64..c36df87daf 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -19,7 +19,7 @@ module Cardano.CLI.Json.Friendly import Cardano.Api as Api import Cardano.Api.Byron (KeyWitness (ByronKeyWitness)) -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley (Address (ShelleyAddress), Hash (..), KeyWitness (ShelleyBootstrapWitness, ShelleyKeyWitness), Proposal (Proposal), ShelleyLedgerEra, StakeAddress (..), fromShelleyPaymentCredential, @@ -99,11 +99,11 @@ friendlyProposalImpl :: ConwayEraOnwards era -> Proposal era -> [Aeson.Pair] friendlyProposalImpl era (Proposal - (Ledger.ProposalProcedure - { Ledger.pProcDeposit - , Ledger.pProcReturnAddr - , Ledger.pProcGovAction - , Ledger.pProcAnchor + (L.ProposalProcedure + { L.pProcDeposit + , L.pProcReturnAddr + , L.pProcGovAction + , L.pProcAnchor } ) ) = conwayEraOnwardsConstraints era @@ -127,7 +127,7 @@ friendlyKeyWitness = ByronKeyWitness txInWitness -> ["Byron witness" .= textShow txInWitness] ShelleyBootstrapWitness _era bootstrapWitness -> ["bootstrap witness" .= textShow bootstrapWitness] - ShelleyKeyWitness _era (Ledger.WitVKey key signature) -> + ShelleyKeyWitness _era (L.WitVKey key signature) -> ["key" .= textShow key, "signature" .= textShow signature] friendlyTxBodyImpl :: () @@ -365,29 +365,29 @@ renderCertificate sbe = \case ShelleyRelatedCertificate _ c -> shelleyBasedEraConstraints sbe $ case c of - Ledger.ShelleyTxCertDelegCert (Ledger.ShelleyRegCert cred) -> + L.ShelleyTxCertDelegCert (L.ShelleyRegCert cred) -> "stake address registration" .= cred - Ledger.ShelleyTxCertDelegCert (Ledger.ShelleyUnRegCert cred) -> + L.ShelleyTxCertDelegCert (L.ShelleyUnRegCert cred) -> "stake address deregistration" .= cred - Ledger.ShelleyTxCertDelegCert (Ledger.ShelleyDelegCert cred poolId) -> + L.ShelleyTxCertDelegCert (L.ShelleyDelegCert cred poolId) -> "stake address delegation" .= object [ "credential" .= cred , "pool" .= poolId ] - Ledger.ShelleyTxCertPool (Ledger.RetirePool poolId retirementEpoch) -> + L.ShelleyTxCertPool (L.RetirePool poolId retirementEpoch) -> "stake pool retirement" .= object [ "pool" .= StakePoolKeyHash poolId , "epoch" .= retirementEpoch ] - Ledger.ShelleyTxCertPool (Ledger.RegPool poolParams) -> + L.ShelleyTxCertPool (L.RegPool poolParams) -> "stake pool registration" .= poolParams - Ledger.ShelleyTxCertGenesisDeleg (Ledger.GenesisDelegCert genesisKeyHash delegateKeyHash vrfKeyHash) -> + L.ShelleyTxCertGenesisDeleg (L.GenesisDelegCert genesisKeyHash delegateKeyHash vrfKeyHash) -> "genesis key delegation" .= object [ "genesis key hash" .= genesisKeyHash , "delegate key hash" .= delegateKeyHash , "VRF key hash" .= vrfKeyHash ] - Ledger.ShelleyTxCertMir (Ledger.MIRCert pot target) -> + L.ShelleyTxCertMir (L.MIRCert pot target) -> "MIR" .= object [ "pot" .= friendlyMirPot pot , friendlyMirTarget sbe target @@ -396,79 +396,79 @@ renderCertificate sbe = \case ConwayCertificate w cert -> conwayEraOnwardsConstraints w $ case cert of - Ledger.RegDRepTxCert credential coin mAnchor -> + L.RegDRepTxCert credential coin mAnchor -> "Drep registration certificate" .= object [ "deposit" .= coin , "certificate" .= conwayToObject w credential , "anchor" .= mAnchor ] - Ledger.UnRegDRepTxCert credential coin -> + L.UnRegDRepTxCert credential coin -> "Drep unregistration certificate" .= object [ "refund" .= coin , "certificate" .= conwayToObject w credential ] - Ledger.AuthCommitteeHotKeyTxCert coldCred hotCred - | Ledger.ScriptHashObj sh <- coldCred -> + L.AuthCommitteeHotKeyTxCert coldCred hotCred + | L.ScriptHashObj sh <- coldCred -> "Cold committee authorization" .= object [ "script hash" .= sh ] - | Ledger.ScriptHashObj sh <- hotCred -> + | L.ScriptHashObj sh <- hotCred -> "Hot committee authorization" .= object [ "script hash" .= sh] - | Ledger.KeyHashObj ck@Ledger.KeyHash{} <- coldCred - , Ledger.KeyHashObj hk@Ledger.KeyHash{} <- hotCred -> + | L.KeyHashObj ck@L.KeyHash{} <- coldCred + , L.KeyHashObj hk@L.KeyHash{} <- hotCred -> "Constitutional committee member hot key registration" .= object [ "cold key hash" .= ck , "hot key hash" .= hk ] - Ledger.ResignCommitteeColdTxCert cred anchor -> case cred of - Ledger.ScriptHashObj sh -> + L.ResignCommitteeColdTxCert cred anchor -> case cred of + L.ScriptHashObj sh -> "Cold committee resignation" .= object [ "script hash" .= sh , "anchor" .= anchor ] - Ledger.KeyHashObj ck@Ledger.KeyHash{} -> + L.KeyHashObj ck@L.KeyHash{} -> "Constitutional committee cold key resignation" .= object [ "cold key hash" .= ck ] - Ledger.RegTxCert stakeCredential -> + L.RegTxCert stakeCredential -> "Stake address registration" .= object [ "stake credential" .= stakeCredential ] - Ledger.UnRegTxCert stakeCredential -> + L.UnRegTxCert stakeCredential -> "Stake address deregistration" .= object [ "stake credential" .= stakeCredential ] - Ledger.RegDepositTxCert stakeCredential deposit -> + L.RegDepositTxCert stakeCredential deposit -> "Stake address registration" .= object [ "stake credential" .= stakeCredential , "deposit" .= deposit ] - Ledger.UnRegDepositTxCert stakeCredential refund -> + L.UnRegDepositTxCert stakeCredential refund -> "Stake address deregistration" .= object [ "stake credential" .= stakeCredential , "refund" .= refund ] - Ledger.DelegTxCert stakeCredential delegatee -> + L.DelegTxCert stakeCredential delegatee -> "Stake address delegation" .= object [ "stake credential" .= stakeCredential , "delegatee" .= delegateeJson sbe delegatee ] - Ledger.RegDepositDelegTxCert stakeCredential delegatee deposit -> + L.RegDepositDelegTxCert stakeCredential delegatee deposit -> "Stake address registration and delegation" .= object [ "stake credential" .= stakeCredential , "delegatee" .= delegateeJson sbe delegatee , "deposit" .= deposit ] - Ledger.RegPoolTxCert poolParams -> + L.RegPoolTxCert poolParams -> "Pool registration" .= object [ "pool params" .= poolParams ] - Ledger.RetirePoolTxCert kh@Ledger.KeyHash{} epoch -> + L.RetirePoolTxCert kh@L.KeyHash{} epoch -> "Pool retirement" .= object [ "stake pool key hash" .= kh , "epoch" .= epoch ] - Ledger.UpdateDRepTxCert drepCredential mbAnchor -> + L.UpdateDRepTxCert drepCredential mbAnchor -> "Drep certificate update" .= object [ "Drep credential" .= drepCredential , "anchor " .= mbAnchor @@ -476,49 +476,49 @@ renderCertificate sbe = \case where conwayToObject :: () => ConwayEraOnwards era - -> Ledger.Credential 'Ledger.DRepRole (Ledger.EraCrypto (ShelleyLedgerEra era)) + -> L.Credential 'L.DRepRole (L.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value conwayToObject w' = conwayEraOnwardsConstraints w' $ object . \case - Ledger.ScriptHashObj sHash -> ["scriptHash" .= sHash] - Ledger.KeyHashObj keyHash -> ["keyHash" .= keyHash] + L.ScriptHashObj sHash -> ["scriptHash" .= sHash] + L.KeyHashObj keyHash -> ["keyHash" .= keyHash] - delegateeJson :: ( Ledger.EraCrypto (ShelleyLedgerEra era) ~ Ledger.StandardCrypto) - => ShelleyBasedEra era -> Ledger.Delegatee (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value + delegateeJson :: ( L.EraCrypto (ShelleyLedgerEra era) ~ L.StandardCrypto) + => ShelleyBasedEra era -> L.Delegatee (L.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Value delegateeJson _ = object . \case - Ledger.DelegStake hk@Ledger.KeyHash{} -> + L.DelegStake hk@L.KeyHash{} -> [ "delegatee type" .= String "stake" , "key hash" .= hk ] - Ledger.DelegVote drep -> do + L.DelegVote drep -> do ["delegatee type" .= String "vote", "DRep" .= drep] - Ledger.DelegStakeVote kh drep -> + L.DelegStakeVote kh drep -> ["delegatee type" .= String "stake vote" , "key hash" .= kh , "DRep" .= drep ] -friendlyMirTarget :: ShelleyBasedEra era -> Ledger.MIRTarget (Ledger.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Pair +friendlyMirTarget :: ShelleyBasedEra era -> L.MIRTarget (L.EraCrypto (ShelleyLedgerEra era)) -> Aeson.Pair friendlyMirTarget sbe = \case - Ledger.StakeAddressesMIR addresses -> + L.StakeAddressesMIR addresses -> "target stake addresses" .= [ object [ friendlyStakeCredential credential - , "amount" .= friendlyLovelace (toShelleyLovelace (Lovelace 0) `Ledger.addDeltaCoin` lovelace) + , "amount" .= friendlyLovelace (toShelleyLovelace (Lovelace 0) `L.addDeltaCoin` lovelace) ] | (credential, lovelace) <- Map.toList (shelleyBasedEraConstraints sbe addresses) ] - Ledger.SendToOppositePotMIR amount -> "MIR amount" .= friendlyLovelace amount + L.SendToOppositePotMIR amount -> "MIR amount" .= friendlyLovelace amount -- TODO: Conway era. Replace cardano-api's StakeCredential definition with -- the ledger's StakeCredential definition. friendlyStakeCredential - :: Ledger.Credential Ledger.Staking Ledger.StandardCrypto -> Aeson.Pair + :: L.Credential L.Staking L.StandardCrypto -> Aeson.Pair friendlyStakeCredential = \case - Ledger.KeyHashObj keyHash -> + L.KeyHashObj keyHash -> "stake credential key hash" .= keyHash - Ledger.ScriptHashObj scriptHash -> + L.ScriptHashObj scriptHash -> "stake credential script hash" .= scriptHash friendlyPaymentCredential :: PaymentCredential -> Aeson.Pair @@ -528,10 +528,10 @@ friendlyPaymentCredential = \case PaymentCredentialByScript scriptHash -> "payment credential script hash" .= scriptHash -friendlyMirPot :: Ledger.MIRPot -> Aeson.Value +friendlyMirPot :: L.MIRPot -> Aeson.Value friendlyMirPot = \case - Ledger.ReservesMIR -> "reserves" - Ledger.TreasuryMIR -> "treasury" + L.ReservesMIR -> "reserves" + L.TreasuryMIR -> "treasury" friendlyRational :: Rational -> Aeson.Value @@ -548,8 +548,8 @@ friendlyFee :: TxFee era -> Aeson.Value friendlyFee = \case TxFeeExplicit _ fee -> friendlyLovelace $ toShelleyLovelace fee -friendlyLovelace :: Ledger.Coin -> Aeson.Value -friendlyLovelace (Ledger.Coin value) = String $ textShow value <> " Lovelace" +friendlyLovelace :: L.Coin -> Aeson.Value +friendlyLovelace (L.Coin value) = String $ textShow value <> " Lovelace" friendlyMintValue :: TxMintValue ViewTx era -> Aeson.Value friendlyMintValue = \case @@ -563,7 +563,7 @@ friendlyTxOutValue = \case friendlyLedgerValue :: () => ShelleyBasedEra era - -> Ledger.Value (ShelleyLedgerEra era) + -> L.Value (ShelleyLedgerEra era) -> Aeson.Value friendlyLedgerValue sbe v = friendlyValue sbe $ Api.fromLedgerValue sbe v diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs index 9a1c5ea27d..59b1d4fa28 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs @@ -10,7 +10,7 @@ module Cardano.CLI.Legacy.Run.Governance ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Shelley import qualified Cardano.CLI.EraBased.Commands.Governance.Poll as Cmd @@ -96,7 +96,7 @@ runLegacyGovernanceVerifyPoll pollFile txFile mOutFile = runLegacyGovernanceMIRCertificatePayStakeAddrs :: EraInEon ShelleyToBabbageEra - -> Ledger.MIRPot + -> L.MIRPot -> [StakeAddress] -- ^ Stake addresses -> [Lovelace] -- ^ Corresponding reward amounts (same length) -> File () Out diff --git a/cardano-cli/src/Cardano/CLI/Types/Output.hs b/cardano-cli/src/Cardano/CLI/Types/Output.hs index 18f4507bc4..da9387b675 100644 --- a/cardano-cli/src/Cardano/CLI/Types/Output.hs +++ b/cardano-cli/src/Cardano/CLI/Types/Output.hs @@ -13,7 +13,7 @@ module Cardano.CLI.Types.Output ) where import Cardano.Api -import qualified Cardano.Api.Ledger as Ledger +import qualified Cardano.Api.Ledger as L import Cardano.Api.Pretty import Cardano.Api.Shelley @@ -260,7 +260,7 @@ instance ToJSON ScriptCostOutput where data PlutusScriptCostError = PlutusScriptCostErrPlutusScriptNotFound ScriptWitnessIndex | PlutusScriptCostErrExecError ScriptWitnessIndex (Maybe ScriptHash) ScriptExecutionError - | PlutusScriptCostErrRationalExceedsBound Ledger.Prices ExecutionUnits + | PlutusScriptCostErrRationalExceedsBound L.Prices ExecutionUnits | PlutusScriptCostErrRefInputNoScript TxIn | PlutusScriptCostErrRefInputNotInUTxO TxIn deriving Show @@ -283,7 +283,7 @@ instance Error PlutusScriptCostError where renderScriptCosts :: UTxO era - -> Ledger.Prices + -> L.Prices -> [(ScriptWitnessIndex, AnyScriptWitness era)] -- ^ Initial mapping of script witness index to actual script. -- We need this in order to know which script corresponds to the