Skip to content

Commit

Permalink
Merge pull request #320 from input-output-hk/mgalazyn/feature/update-…
Browse files Browse the repository at this point in the history
…to-cardano-api-8.24

Update to `cardano-api-8.23.1.0`
  • Loading branch information
newhoggy authored Oct 2, 2023
2 parents 374d2d5 + 5cc2922 commit 1a140f5
Show file tree
Hide file tree
Showing 48 changed files with 173 additions and 826 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-09-27T09:51:59Z
, cardano-haskell-packages 2023-10-01T12:37:02Z

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.22
, cardano-api ^>= 8.23.1
, cardano-binary
, cardano-crypto
, cardano-crypto-class ^>= 2.1.2
Expand Down
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/Byron/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ txSpendGenesisUTxOByronPBFT gc nId sk (ByronAddress bAddr) outs = do
, txFee = TxFeeImplicit ByronEraOnlyByron
, txValidityRange =
( TxValidityNoLowerBound
, TxValidityNoUpperBound ValidityNoUpperBoundInByronEra
, defaultTxValidityUpperBound
)
, txMetadata = TxMetadataNone
, txAuxScripts = TxAuxScriptsNone
Expand Down Expand Up @@ -209,7 +209,7 @@ txSpendUTxOByronPBFT nId sk txIns outs = do
, txFee = TxFeeImplicit ByronEraOnlyByron
, txValidityRange =
( TxValidityNoLowerBound
, TxValidityNoUpperBound ValidityNoUpperBoundInByronEra
, defaultTxValidityUpperBound
)
, txMetadata = TxMetadataNone
, txAuxScripts = TxAuxScriptsNone
Expand Down
30 changes: 7 additions & 23 deletions cardano-cli/src/Cardano/CLI/Environment.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ module Cardano.CLI.Environment
, getEnvSocketPath
) where

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

import Data.Word (Word32)
import qualified System.Environment as IO
Expand All @@ -38,31 +38,15 @@ getEnvCli = do
, envCliAnyCardanoEra = mCardanoEra
}

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

case era of
ByronEra -> Nothing
ShelleyEra -> Just $ AnyShelleyBasedEra ShelleyBasedEraShelley
AllegraEra -> Just $ AnyShelleyBasedEra ShelleyBasedEraAllegra
MaryEra -> Just $ AnyShelleyBasedEra ShelleyBasedEraMary
AlonzoEra -> Just $ AnyShelleyBasedEra ShelleyBasedEraAlonzo
BabbageEra -> Just $ AnyShelleyBasedEra ShelleyBasedEraBabbage
ConwayEra -> Just $ AnyShelleyBasedEra ShelleyBasedEraConway

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

case era of
ByronEra -> Nothing
ShelleyEra -> Just $ AnyShelleyToBabbageEra ShelleyToBabbageEraShelley
AllegraEra -> Just $ AnyShelleyToBabbageEra ShelleyToBabbageEraAllegra
MaryEra -> Just $ AnyShelleyToBabbageEra ShelleyToBabbageEraMary
AlonzoEra -> Just $ AnyShelleyToBabbageEra ShelleyToBabbageEraAlonzo
BabbageEra -> Just $ AnyShelleyToBabbageEra ShelleyToBabbageEraBabbage
ConwayEra -> Nothing
forEraInEonMaybe era AnyEraInEon

-- | 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 :: AnyShelleyBasedEra
defaultShelleyBasedEra = AnyShelleyBasedEra ShelleyBasedEraBabbage
defaultShelleyBasedEra :: AnyEraInEon ShelleyBasedEra
defaultShelleyBasedEra = AnyEraInEon ShelleyBasedEraBabbage

defaultShelleyToBabbageEra :: AnyShelleyToBabbageEra
defaultShelleyToBabbageEra = AnyShelleyToBabbageEra ShelleyToBabbageEraBabbage
defaultShelleyToBabbageEra :: AnyEraInEon ShelleyToBabbageEra
defaultShelleyToBabbageEra = AnyEraInEon ShelleyToBabbageEraBabbage

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

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

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

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

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

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Options/Governance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pGovernanceCmds era envCli =

pCreateMirCertificatesCmds :: CardanoEra era -> Maybe (Parser (GovernanceCmds era))
pCreateMirCertificatesCmds era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "create-mir-certificate"
$ Opt.info (pMIRPayStakeAddresses w <|> mirCertParsers w)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pGovernanceActionNewInfoCmd
:: CardanoEra era
-> Maybe (Parser (GovernanceActionCmds era))
pGovernanceActionNewInfoCmd era = do
cOn <- maybeEonInEra era
cOn <- forEraMaybeEon era
pure
$ subParser "create-info"
$ Opt.info
Expand All @@ -63,7 +63,7 @@ pGovernanceActionNewConstitutionCmd
:: CardanoEra era
-> Maybe (Parser (GovernanceActionCmds era))
pGovernanceActionNewConstitutionCmd era = do
cOn <- maybeEonInEra era
cOn <- forEraMaybeEon era
pure
$ subParser "create-constitution"
$ Opt.info
Expand All @@ -85,7 +85,7 @@ pGovernanceActionNewCommitteeCmd
:: CardanoEra era
-> Maybe (Parser (GovernanceActionCmds era))
pGovernanceActionNewCommitteeCmd era = do
cOn <- maybeEonInEra era
cOn <- forEraMaybeEon era
pure
$ subParser "create-new-committee"
$ Opt.info
Expand Down Expand Up @@ -116,7 +116,7 @@ pGovernanceActionNoConfidenceCmd
:: CardanoEra era
-> Maybe (Parser (GovernanceActionCmds era))
pGovernanceActionNoConfidenceCmd era = do
cOn <- maybeEonInEra era
cOn <- forEraMaybeEon era
pure
$ subParser "create-no-confidence"
$ Opt.info
Expand Down Expand Up @@ -145,7 +145,7 @@ pGovernanceActionProtocolParametersUpdateCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceActionCmds era))
pGovernanceActionProtocolParametersUpdateCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "create-protocol-parameters-update"
$ Opt.info
Expand Down Expand Up @@ -280,7 +280,7 @@ dpGovActionProtocolParametersUpdate = \case

pGovernanceActionTreasuryWithdrawalCmd :: CardanoEra era -> Maybe (Parser (GovernanceActionCmds era))
pGovernanceActionTreasuryWithdrawalCmd era = do
cOn <- maybeEonInEra era
cOn <- forEraMaybeEon era
pure
$ subParser "create-treasury-withdrawal"
$ Opt.info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pGovernanceCommitteeKeyGenColdCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceCommitteeCmds era))
pGovernanceCommitteeKeyGenColdCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "key-gen-cold"
$ Opt.info (pCmd w)
Expand All @@ -54,7 +54,7 @@ pGovernanceCommitteeKeyGenHotCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceCommitteeCmds era))
pGovernanceCommitteeKeyGenHotCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "key-gen-hot"
$ Opt.info (pCmd w)
Expand All @@ -75,7 +75,7 @@ pGovernanceCommitteeKeyHashCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceCommitteeCmds era))
pGovernanceCommitteeKeyHashCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "key-hash"
$ Opt.info
Expand All @@ -91,7 +91,7 @@ pGovernanceCommitteeCreateHotKeyAuthorizationCertificateCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceCommitteeCmds era))
pGovernanceCommitteeCreateHotKeyAuthorizationCertificateCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "create-hot-key-authorization-certificate"
$ Opt.info
Expand All @@ -109,7 +109,7 @@ pGovernanceCommitteeCreateColdKeyResignationCertificateCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceCommitteeCmds era))
pGovernanceCommitteeCreateColdKeyResignationCertificateCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "create-cold-key-resignation-certificate"
$ Opt.info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pGovernanceDRepKeyGenCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceDRepCmds era))
pGovernanceDRepKeyGenCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "key-gen"
$ Opt.info
Expand All @@ -56,7 +56,7 @@ pGovernanceDRepKeyIdCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceDRepCmds era))
pGovernanceDRepKeyIdCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "id"
$ Opt.info
Expand Down Expand Up @@ -85,7 +85,7 @@ pRegistrationCertificateCmd :: ()
=> CardanoEra era
-> Maybe (Parser (GovernanceDRepCmds era))
pRegistrationCertificateCmd era = do
w <- maybeEonInEra era
w <- forEraMaybeEon era
pure
$ subParser "registration-certificate"
$ Opt.info (mkParser w)
Expand Down
Loading

0 comments on commit 1a140f5

Please sign in to comment.