-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stake address registration and delegation certificate and stake p…
…ool delegation certificate commands to compatible.
- Loading branch information
1 parent
63d001a
commit 859a1fe
Showing
61 changed files
with
2,368 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE RankNTypes #-} | ||
|
||
module Cardano.CLI.Compatible.Governance.Run | ||
( runCompatibleGovernanceCmds | ||
) | ||
where | ||
|
||
import Cardano.Api | ||
|
||
import Cardano.CLI.Compatible.Exception | ||
import Cardano.CLI.Compatible.Governance.Command | ||
import Cardano.CLI.EraBased.Governance.Run | ||
import Cardano.CLI.Type.Error.CmdError | ||
|
||
runCompatibleGovernanceCmds :: CompatibleGovernanceCmds era -> ExceptT CmdError IO () | ||
runCompatibleGovernanceCmds :: CompatibleGovernanceCmds era -> CIO e () | ||
runCompatibleGovernanceCmds = \case | ||
CreateCompatibleProtocolUpdateCmd cmd -> runGovernanceCmds cmd | ||
CreateCompatibleProtocolUpdateCmd cmd -> fromExceptTCli $ runGovernanceCmds cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
cardano-cli/src/Cardano/CLI/Compatible/StakeAddress/Command.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
|
||
module Cardano.CLI.Compatible.StakeAddress.Command | ||
( CompatibleStakeAddressCmds (..) | ||
, renderCompatibleStakeAddressCmds | ||
) | ||
where | ||
|
||
import Cardano.Api.Ledger (Coin) | ||
import Cardano.Api.Shelley | ||
|
||
import Cardano.CLI.Type.Key | ||
|
||
import Prelude | ||
|
||
import Data.Text (Text) | ||
|
||
data CompatibleStakeAddressCmds era | ||
= CompatibleStakeAddressRegistrationCertificateCmd | ||
(ShelleyBasedEra era) | ||
StakeIdentifier | ||
(Maybe Coin) | ||
(File () Out) | ||
| CompatibleStakeAddressStakeDelegationCertificateCmd | ||
(ShelleyBasedEra era) | ||
StakeIdentifier | ||
(VerificationKeyOrHashOrFile StakePoolKey) | ||
(File () Out) | ||
deriving Show | ||
|
||
renderCompatibleStakeAddressCmds :: CompatibleStakeAddressCmds era -> Text | ||
renderCompatibleStakeAddressCmds = | ||
(<>) "stake-address " . \case | ||
CompatibleStakeAddressRegistrationCertificateCmd{} -> "registration-certificate" | ||
CompatibleStakeAddressStakeDelegationCertificateCmd{} -> "stake-delegation-certificate" |
80 changes: 80 additions & 0 deletions
80
cardano-cli/src/Cardano/CLI/Compatible/StakeAddress/Option.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE GADTs #-} | ||
|
||
module Cardano.CLI.Compatible.StakeAddress.Option | ||
( pCompatibleStakeAddressCmds | ||
) | ||
where | ||
|
||
import Cardano.Api | ||
|
||
import Cardano.CLI.Compatible.StakeAddress.Command | ||
import Cardano.CLI.EraBased.Common.Option | ||
import Cardano.CLI.Parser | ||
|
||
import Options.Applicative | ||
import Options.Applicative qualified as Opt | ||
|
||
pCompatibleStakeAddressCmds | ||
:: () | ||
=> ShelleyBasedEra era | ||
-> Maybe (Parser (CompatibleStakeAddressCmds era)) | ||
pCompatibleStakeAddressCmds era = | ||
subInfoParser | ||
"stake-address" | ||
( Opt.progDesc $ | ||
mconcat | ||
[ "Stake address commands." | ||
] | ||
) | ||
[ Just $ pStakeAddressRegistrationCertificateCmd era | ||
, Just $ pStakeAddressStakeDelegationCertificateCmd era | ||
] | ||
|
||
pStakeAddressRegistrationCertificateCmd | ||
:: () | ||
=> ShelleyBasedEra era | ||
-> Parser (CompatibleStakeAddressCmds era) | ||
pStakeAddressRegistrationCertificateCmd sbe = do | ||
caseShelleyToBabbageOrConwayEraOnwards | ||
( const $ | ||
subParser "registration-certificate" $ | ||
Opt.info | ||
( CompatibleStakeAddressRegistrationCertificateCmd sbe | ||
<$> pStakeIdentifier Nothing | ||
<*> pure Nothing | ||
<*> pOutputFile | ||
) | ||
desc | ||
) | ||
( const $ | ||
subParser "registration-certificate" $ | ||
Opt.info | ||
( CompatibleStakeAddressRegistrationCertificateCmd sbe | ||
<$> pStakeIdentifier Nothing | ||
<*> fmap Just pKeyRegistDeposit | ||
<*> pOutputFile | ||
) | ||
desc | ||
) | ||
sbe | ||
where | ||
desc = Opt.progDesc "Create a stake address registration certificate" | ||
|
||
pStakeAddressStakeDelegationCertificateCmd | ||
:: () | ||
=> ShelleyBasedEra era | ||
-> Parser (CompatibleStakeAddressCmds era) | ||
pStakeAddressStakeDelegationCertificateCmd sbe = do | ||
subParser "stake-delegation-certificate" | ||
$ Opt.info | ||
( CompatibleStakeAddressStakeDelegationCertificateCmd sbe | ||
<$> pStakeIdentifier Nothing | ||
<*> pStakePoolVerificationKeyOrHashOrFile Nothing | ||
<*> pOutputFile | ||
) | ||
$ Opt.progDesc | ||
$ mconcat | ||
[ "Create a stake address stake delegation certificate, which when submitted in a transaction " | ||
, "delegates stake to a stake pool." | ||
] |
Oops, something went wrong.