Skip to content

Commit

Permalink
Merge pull request #329 from input-output-hk/newhoggy/uprade-to-carda…
Browse files Browse the repository at this point in the history
…no-api-8.25.0.1

Upgrade to `cardano-api-8.25.0.1`
  • Loading branch information
newhoggy authored Oct 4, 2023
2 parents ddfc37b + 3cb26c3 commit 2f6f50b
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 88 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository cardano-haskell-packages
-- you need to run if you change them
index-state:
, hackage.haskell.org 2023-08-08T19:56:09Z
, cardano-haskell-packages 2023-10-03T08:51:40Z
, cardano-haskell-packages 2023-10-03T23:50:17Z

packages:
cardano-cli
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ library
, binary
, bytestring
, canonical-json
, cardano-api ^>= 8.24
, cardano-api ^>= 8.25
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
Expand Down
10 changes: 5 additions & 5 deletions cardano-cli/src/Cardano/CLI/Environment.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Cardano.CLI.Environment
, getEnvSocketPath
) where

import Cardano.Api (AnyCardanoEra (..), AnyEraInEon (..), CardanoEra (..), NetworkId (..),
import Cardano.Api (AnyCardanoEra (..), CardanoEra (..), EraInEon (..), NetworkId (..),
NetworkMagic (..), ShelleyBasedEra (..), ShelleyToBabbageEra (..),
forEraInEonMaybe)

Expand All @@ -38,15 +38,15 @@ getEnvCli = do
, envCliAnyCardanoEra = mCardanoEra
}

envCliAnyShelleyBasedEra :: EnvCli -> Maybe (AnyEraInEon ShelleyBasedEra)
envCliAnyShelleyBasedEra :: EnvCli -> Maybe (EraInEon ShelleyBasedEra)
envCliAnyShelleyBasedEra envCli = do
AnyCardanoEra era <- envCliAnyCardanoEra envCli
forEraInEonMaybe era AnyEraInEon
forEraInEonMaybe era EraInEon

envCliAnyShelleyToBabbageEra :: EnvCli -> Maybe (AnyEraInEon ShelleyToBabbageEra)
envCliAnyShelleyToBabbageEra :: EnvCli -> Maybe (EraInEon ShelleyToBabbageEra)
envCliAnyShelleyToBabbageEra envCli = do
AnyCardanoEra era <- envCliAnyCardanoEra envCli
forEraInEonMaybe era AnyEraInEon
forEraInEonMaybe era EraInEon

-- | If the environment variable @CARDANO_NODE_NETWORK_ID@ is set, then return the network id therein.
-- Otherwise, return 'Nothing'.
Expand Down
70 changes: 35 additions & 35 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec
import Text.Read (readEither, readMaybe)

defaultShelleyBasedEra :: AnyEraInEon ShelleyBasedEra
defaultShelleyBasedEra = AnyEraInEon ShelleyBasedEraBabbage
defaultShelleyBasedEra :: EraInEon ShelleyBasedEra
defaultShelleyBasedEra = EraInEon ShelleyBasedEraBabbage

defaultShelleyToBabbageEra :: AnyEraInEon ShelleyToBabbageEra
defaultShelleyToBabbageEra = AnyEraInEon ShelleyToBabbageEraBabbage
defaultShelleyToBabbageEra :: EraInEon ShelleyToBabbageEra
defaultShelleyToBabbageEra = EraInEon ShelleyToBabbageEraBabbage

command' :: String -> String -> Parser a -> Mod CommandFields a
command' c descr p =
Expand Down Expand Up @@ -309,113 +309,113 @@ subInfoParser name i mps = case catMaybes mps of
[] -> Nothing
parsers -> Just $ subParser name $ Opt.info (asum parsers) i

pAnyShelleyBasedEra :: EnvCli -> Parser (AnyEraInEon ShelleyBasedEra)
pAnyShelleyBasedEra :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pAnyShelleyBasedEra envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyBasedEraShelley)
[ [ Opt.flag' (EraInEon ShelleyBasedEraShelley)
$ mconcat [Opt.long "shelley-era", Opt.help "Specify the Shelley era"]
, Opt.flag' (AnyEraInEon ShelleyBasedEraAllegra)
, Opt.flag' (EraInEon ShelleyBasedEraAllegra)
$ mconcat [Opt.long "allegra-era", Opt.help "Specify the Allegra era"]
, Opt.flag' (AnyEraInEon ShelleyBasedEraMary)
, Opt.flag' (EraInEon ShelleyBasedEraMary)
$ mconcat [Opt.long "mary-era", Opt.help "Specify the Mary era"]
, Opt.flag' (AnyEraInEon ShelleyBasedEraAlonzo)
, Opt.flag' (EraInEon ShelleyBasedEraAlonzo)
$ mconcat [Opt.long "alonzo-era", Opt.help "Specify the Alonzo era"]
, Opt.flag' (AnyEraInEon ShelleyBasedEraBabbage)
, Opt.flag' (EraInEon ShelleyBasedEraBabbage)
$ mconcat [Opt.long "babbage-era", Opt.help "Specify the Babbage era (default)"]
, Opt.flag' (AnyEraInEon ShelleyBasedEraConway)
, Opt.flag' (EraInEon ShelleyBasedEraConway)
$ mconcat [Opt.long "conway-era", Opt.help "Specify the Conway era"]
]
, maybeToList $ pure <$> envCliAnyShelleyBasedEra envCli
, pure $ pure defaultShelleyBasedEra
]

pAnyShelleyToBabbageEra :: EnvCli -> Parser (AnyEraInEon ShelleyToBabbageEra)
pAnyShelleyToBabbageEra :: EnvCli -> Parser (EraInEon ShelleyToBabbageEra)
pAnyShelleyToBabbageEra envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyToBabbageEraShelley)
[ [ Opt.flag' (EraInEon ShelleyToBabbageEraShelley)
$ mconcat [Opt.long "shelley-era", Opt.help "Specify the Shelley era"]
, Opt.flag' (AnyEraInEon ShelleyToBabbageEraAllegra)
, Opt.flag' (EraInEon ShelleyToBabbageEraAllegra)
$ mconcat [Opt.long "allegra-era", Opt.help "Specify the Allegra era"]
, Opt.flag' (AnyEraInEon ShelleyToBabbageEraMary)
, Opt.flag' (EraInEon ShelleyToBabbageEraMary)
$ mconcat [Opt.long "mary-era", Opt.help "Specify the Mary era"]
, Opt.flag' (AnyEraInEon ShelleyToBabbageEraAlonzo)
, Opt.flag' (EraInEon ShelleyToBabbageEraAlonzo)
$ mconcat [Opt.long "alonzo-era", Opt.help "Specify the Alonzo era"]
, Opt.flag' (AnyEraInEon ShelleyToBabbageEraBabbage)
, Opt.flag' (EraInEon ShelleyToBabbageEraBabbage)
$ mconcat [Opt.long "babbage-era", Opt.help "Specify the Babbage era (default)"]
]
, maybeToList $ pure <$> envCliAnyShelleyToBabbageEra envCli
, pure $ pure defaultShelleyToBabbageEra
]

pShelleyBasedShelley :: EnvCli -> Parser (AnyEraInEon ShelleyBasedEra)
pShelleyBasedShelley :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pShelleyBasedShelley envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyBasedEraShelley)
[ [ Opt.flag' (EraInEon ShelleyBasedEraShelley)
$ mconcat [Opt.long "shelley-era", Opt.help "Specify the Shelley era"]
]
, maybeToList
$ fmap pure
$ mfilter (== AnyEraInEon ShelleyBasedEraShelley)
$ mfilter (== EraInEon ShelleyBasedEraShelley)
$ envCliAnyShelleyBasedEra envCli
]

pShelleyBasedAllegra :: EnvCli -> Parser (AnyEraInEon ShelleyBasedEra)
pShelleyBasedAllegra :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pShelleyBasedAllegra envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyBasedEraAllegra)
[ [ Opt.flag' (EraInEon ShelleyBasedEraAllegra)
$ mconcat [Opt.long "allegra-era", Opt.help "Specify the Allegra era"]
]
, maybeToList
$ fmap pure
$ mfilter (== AnyEraInEon ShelleyBasedEraAllegra)
$ mfilter (== EraInEon ShelleyBasedEraAllegra)
$ envCliAnyShelleyBasedEra envCli
]

pShelleyBasedMary :: EnvCli -> Parser (AnyEraInEon ShelleyBasedEra)
pShelleyBasedMary :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pShelleyBasedMary envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyBasedEraMary)
[ [ Opt.flag' (EraInEon ShelleyBasedEraMary)
$ mconcat [Opt.long "mary-era", Opt.help "Specify the Mary era"]
]
, maybeToList
$ fmap pure
$ mfilter (== AnyEraInEon ShelleyBasedEraMary)
$ mfilter (== EraInEon ShelleyBasedEraMary)
$ envCliAnyShelleyBasedEra envCli
]

pShelleyBasedAlonzo :: EnvCli -> Parser (AnyEraInEon ShelleyBasedEra)
pShelleyBasedAlonzo :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pShelleyBasedAlonzo envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyBasedEraAlonzo)
[ [ Opt.flag' (EraInEon ShelleyBasedEraAlonzo)
$ mconcat [Opt.long "alonzo-era", Opt.help "Specify the Alonzo era"]
]
, maybeToList
$ fmap pure
$ mfilter (== AnyEraInEon ShelleyBasedEraAlonzo)
$ mfilter (== EraInEon ShelleyBasedEraAlonzo)
$ envCliAnyShelleyBasedEra envCli
]

pShelleyBasedBabbage :: EnvCli -> Parser (AnyEraInEon ShelleyBasedEra)
pShelleyBasedBabbage :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pShelleyBasedBabbage envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyBasedEraBabbage)
[ [ Opt.flag' (EraInEon ShelleyBasedEraBabbage)
$ mconcat [Opt.long "babbage-era", Opt.help "Specify the Babbage era (default)"]
]
, maybeToList
$ fmap pure
$ mfilter (== AnyEraInEon ShelleyBasedEraBabbage)
$ mfilter (== EraInEon ShelleyBasedEraBabbage)
$ envCliAnyShelleyBasedEra envCli
]

pShelleyBasedConway :: EnvCli -> Parser (AnyEraInEon ShelleyBasedEra)
pShelleyBasedConway :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pShelleyBasedConway envCli =
asum $ mconcat
[ [ Opt.flag' (AnyEraInEon ShelleyBasedEraConway)
[ [ Opt.flag' (EraInEon ShelleyBasedEraConway)
$ mconcat [Opt.long "conway-era", Opt.help "Specify the Conway era"]
]
, maybeToList
$ fmap pure
$ mfilter (== AnyEraInEon ShelleyBasedEraConway)
$ mfilter (== EraInEon ShelleyBasedEraConway)
$ envCliAnyShelleyBasedEra envCli
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import Cardano.CLI.Read
import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Errors.GovernanceActionsError
import Cardano.CLI.Types.Key
import qualified Cardano.Ledger.Conway.Governance as Ledger

import Control.Monad
import Control.Monad.Except (ExceptT)
Expand Down
16 changes: 8 additions & 8 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ runGovernanceVoteCreateCmd (ConwayOnwardsVote cOnwards voteChoice (govActionTxId
. newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsDRepKey stake
let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h

votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential sbe vStakeCred
votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential cOnwards vStakeCred
let voter = Ledger.DRepVoter (unVotingCredential votingCred)
govActIdentifier = createGovernanceActionId govActionTxId govActionIndex
voteProcedure = createVotingProcedure sbe voteChoice Nothing
votingProcedures = singletonVotingProcedures sbe voter govActIdentifier (unVotingProcedure voteProcedure)
voteProcedure = createVotingProcedure cOnwards voteChoice Nothing
votingProcedures = singletonVotingProcedures cOnwards voter govActIdentifier (unVotingProcedure voteProcedure)
firstExceptT GovernanceVoteCmdWriteError . newExceptT $ writeFileTextEnvelope oFp Nothing votingProcedures

AnyStakePoolVerificationKeyOrHashOrFile stake -> do
Expand All @@ -58,17 +58,17 @@ runGovernanceVoteCreateCmd (ConwayOnwardsVote cOnwards voteChoice (govActionTxId

let voter = Ledger.StakePoolVoter (unStakePoolKeyHash h)
govActIdentifier = createGovernanceActionId govActionTxId govActionIndex
voteProcedure = createVotingProcedure sbe voteChoice Nothing
votingProcedures = singletonVotingProcedures sbe voter govActIdentifier (unVotingProcedure voteProcedure)
voteProcedure = createVotingProcedure cOnwards voteChoice Nothing
votingProcedures = singletonVotingProcedures cOnwards voter govActIdentifier (unVotingProcedure voteProcedure)
firstExceptT GovernanceVoteCmdWriteError . newExceptT $ writeFileTextEnvelope oFp Nothing votingProcedures

AnyCommitteeHotVerificationKeyOrHashOrFile stake -> do
CommitteeHotKeyHash h <- firstExceptT GovernanceVoteCmdReadError
. newExceptT $ readVerificationKeyOrHashOrTextEnvFile AsCommitteeHotKey stake
let vStakeCred = StakeCredentialByKey . StakeKeyHash $ coerceKeyRole h
votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential sbe vStakeCred
votingCred <- hoistEither $ first GovernanceVoteCmdCredentialDecodeError $ toVotingCredential cOnwards vStakeCred
let voter = Ledger.CommitteeVoter (Ledger.coerceKeyRole (unVotingCredential votingCred)) -- TODO Conway - remove coerceKeyRole
govActIdentifier = createGovernanceActionId govActionTxId govActionIndex
voteProcedure = createVotingProcedure sbe voteChoice Nothing
votingProcedures = singletonVotingProcedures sbe voter govActIdentifier (unVotingProcedure voteProcedure)
voteProcedure = createVotingProcedure cOnwards voteChoice Nothing
votingProcedures = singletonVotingProcedures cOnwards voter govActIdentifier (unVotingProcedure voteProcedure)
firstExceptT GovernanceVoteCmdWriteError . newExceptT $ writeFileTextEnvelope oFp Nothing votingProcedures
6 changes: 3 additions & 3 deletions cardano-cli/src/Cardano/CLI/Legacy/Commands/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ import Data.Text (Text)

data LegacyGovernanceCmds
= GovernanceMIRPayStakeAddressesCertificate
(AnyEraInEon ShelleyToBabbageEra)
(EraInEon ShelleyToBabbageEra)
MIRPot
[StakeAddress]
[Lovelace]
(File () Out)
| GovernanceMIRTransfer
(AnyEraInEon ShelleyToBabbageEra)
(EraInEon ShelleyToBabbageEra)
Lovelace
(File () Out)
TransferDirection
| GovernanceGenesisKeyDelegationCertificate
(AnyEraInEon ShelleyBasedEra)
(EraInEon ShelleyBasedEra)
(VerificationKeyOrHashOrFile GenesisKey)
(VerificationKeyOrHashOrFile GenesisDelegateKey)
(VerificationKeyOrHashOrFile VrfKey)
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli/src/Cardano/CLI/Legacy/Commands/StakeAddress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ data LegacyStakeAddressCmds
NetworkId
(Maybe (File () Out))
| StakeAddressRegistrationCertificateCmd
(AnyEraInEon ShelleyBasedEra)
(EraInEon ShelleyBasedEra)
StakeIdentifier
(Maybe Lovelace)
(File () Out)
| StakeAddressDelegationCertificateCmd
(AnyEraInEon ShelleyBasedEra)
(EraInEon ShelleyBasedEra)
StakeIdentifier
(VerificationKeyOrHashOrFile StakePoolKey)
(File () Out)
| StakeAddressDeregistrationCertificateCmd
(AnyEraInEon ShelleyBasedEra)
(EraInEon ShelleyBasedEra)
StakeIdentifier
(Maybe Lovelace)
(File () Out)
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/Legacy/Commands/StakePool.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Data.Text (Text)

data LegacyStakePoolCmds
= StakePoolDeregistrationCertificateCmd
(AnyEraInEon ShelleyBasedEra)
(EraInEon ShelleyBasedEra)
-- ^ Era in which to retire the stake pool.
(VerificationKeyOrFile StakePoolKey)
-- ^ Stake pool verification key.
Expand All @@ -32,7 +32,7 @@ data LegacyStakePoolCmds
(StakePoolMetadataFile In)
(Maybe (File () Out))
| StakePoolRegistrationCertificateCmd
(AnyEraInEon ShelleyBasedEra)
(EraInEon ShelleyBasedEra)
-- ^ Era in which to register the stake pool.
(VerificationKeyOrFile StakePoolKey)
-- ^ Stake pool verification key.
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,6 @@ pLegacyCardanoEra envCli =
, pure $ pure defaultCardanoEra
]
where
defaultCardanoEra = defaultShelleyBasedEra & \(AnyEraInEon era) ->
defaultCardanoEra = defaultShelleyBasedEra & \(EraInEon era) ->
let cera = toCardanoEra era
in cardanoEraConstraints cera (AnyCardanoEra cera)
12 changes: 6 additions & 6 deletions cardano-cli/src/Cardano/CLI/Legacy/Run/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,32 @@ runLegacyGovernanceCmds = \case
runLegacyGovernanceVerifyPoll poll metadata mOutFile

runLegacyGovernanceMIRCertificatePayStakeAddrs
:: AnyEraInEon ShelleyToBabbageEra
:: EraInEon ShelleyToBabbageEra
-> Ledger.MIRPot
-> [StakeAddress] -- ^ Stake addresses
-> [Lovelace] -- ^ Corresponding reward amounts (same length)
-> File () Out
-> ExceptT GovernanceCmdError IO ()
runLegacyGovernanceMIRCertificatePayStakeAddrs (AnyEraInEon w) =
runLegacyGovernanceMIRCertificatePayStakeAddrs (EraInEon w) =
runGovernanceMIRCertificatePayStakeAddrs w

runLegacyGovernanceMIRCertificateTransfer
:: AnyEraInEon ShelleyToBabbageEra
:: EraInEon ShelleyToBabbageEra
-> Lovelace
-> File () Out
-> TransferDirection
-> ExceptT GovernanceCmdError IO ()
runLegacyGovernanceMIRCertificateTransfer (AnyEraInEon w) =
runLegacyGovernanceMIRCertificateTransfer (EraInEon w) =
runGovernanceMIRCertificateTransfer w

runLegacyGovernanceGenesisKeyDelegationCertificate
:: AnyEraInEon ShelleyBasedEra
:: EraInEon ShelleyBasedEra
-> VerificationKeyOrHashOrFile GenesisKey
-> VerificationKeyOrHashOrFile GenesisDelegateKey
-> VerificationKeyOrHashOrFile VrfKey
-> File () Out
-> ExceptT GovernanceCmdError IO ()
runLegacyGovernanceGenesisKeyDelegationCertificate (AnyEraInEon sbe)
runLegacyGovernanceGenesisKeyDelegationCertificate (EraInEon sbe)
genVkOrHashOrFp
genDelVkOrHashOrFp
vrfVkOrHashOrFp
Expand Down
12 changes: 6 additions & 6 deletions cardano-cli/src/Cardano/CLI/Legacy/Run/StakeAddress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,31 @@ runLegacyStakeAddressBuildCmd =
runStakeAddressBuildCmd

runLegacyStakeAddressRegistrationCertificateCmd :: ()
=> AnyEraInEon ShelleyBasedEra
=> EraInEon ShelleyBasedEra
-> StakeIdentifier
-> Maybe Lovelace -- ^ Deposit required in conway era
-> File () Out
-> ExceptT StakeAddressCmdError IO ()
runLegacyStakeAddressRegistrationCertificateCmd (AnyEraInEon sbe) =
runLegacyStakeAddressRegistrationCertificateCmd (EraInEon sbe) =
runStakeAddressRegistrationCertificateCmd sbe

runLegacyStakeAddresslDelegationCertificateCmd :: ()
=> AnyEraInEon ShelleyBasedEra
=> EraInEon ShelleyBasedEra
-> StakeIdentifier
-- ^ Delegator stake verification key, verification key file or script file.
-> VerificationKeyOrHashOrFile StakePoolKey
-- ^ Delegatee stake pool verification key or verification key file or
-- verification key hash.
-> File () Out
-> ExceptT StakeAddressCmdError IO ()
runLegacyStakeAddresslDelegationCertificateCmd (AnyEraInEon sbe) =
runLegacyStakeAddresslDelegationCertificateCmd (EraInEon sbe) =
runStakeAddressStakeDelegationCertificateCmd sbe

runLegacyStakeAddressDeregistrationCertificateCmd :: ()
=> AnyEraInEon ShelleyBasedEra
=> EraInEon ShelleyBasedEra
-> StakeIdentifier
-> Maybe Lovelace -- ^ Deposit required in conway era
-> File () Out
-> ExceptT StakeAddressCmdError IO ()
runLegacyStakeAddressDeregistrationCertificateCmd (AnyEraInEon sbe) =
runLegacyStakeAddressDeregistrationCertificateCmd (EraInEon sbe) =
runStakeAddressDeregistrationCertificateCmd sbe
Loading

0 comments on commit 2f6f50b

Please sign in to comment.