-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement era-based stake-address command group
- Loading branch information
Showing
61 changed files
with
1,809 additions
and
16 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
125 changes: 125 additions & 0 deletions
125
cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.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,125 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE GADTs #-} | ||
|
||
module Cardano.CLI.EraBased.Options.StakeAddress | ||
( pStakeAddressCmds | ||
) where | ||
|
||
import Cardano.Api | ||
|
||
import Cardano.CLI.Environment | ||
import Cardano.CLI.EraBased.Commands.StakeAddress | ||
import Cardano.CLI.EraBased.Options.Common | ||
import Cardano.CLI.Orphans () | ||
|
||
import Options.Applicative | ||
import qualified Options.Applicative as Opt | ||
|
||
pStakeAddressCmds :: () | ||
=> CardanoEra era | ||
-> EnvCli | ||
-> Maybe (Parser (StakeAddressCmds era)) | ||
pStakeAddressCmds era envCli = | ||
subInfoParser "stake-address" | ||
( Opt.progDesc | ||
$ mconcat | ||
[ "Stake address commands." | ||
] | ||
) | ||
[ pStakeAddressKeyGenCmd era | ||
, pStakeAddressKeyHashCmd era | ||
, pStakeAddressBuildCmd era envCli | ||
, pStakeAddressRegistrationCertificateCmd era | ||
, pStakeAddressDeregistrationCertificateCmd era | ||
, pStakeAddressDelegationCertificateCmd era | ||
] | ||
|
||
pStakeAddressKeyGenCmd :: () | ||
=> CardanoEra era | ||
-> Maybe (Parser (StakeAddressCmds era)) | ||
pStakeAddressKeyGenCmd era = do | ||
w <- maybeFeatureInEra era | ||
pure | ||
$ subParser "key-gen" | ||
$ Opt.info | ||
( StakeAddressKeyGen w | ||
<$> pKeyOutputFormat | ||
<*> pVerificationKeyFileOut | ||
<*> pSigningKeyFileOut | ||
) | ||
$ Opt.progDesc "Create a stake address key pair" | ||
|
||
pStakeAddressKeyHashCmd :: () | ||
=> CardanoEra era | ||
-> Maybe (Parser (StakeAddressCmds era)) | ||
pStakeAddressKeyHashCmd era = do | ||
w <- maybeFeatureInEra era | ||
pure | ||
$ subParser "key-hash" | ||
$ Opt.info | ||
( StakeAddressKeyHash w | ||
<$> pStakeVerificationKeyOrFile | ||
<*> pMaybeOutputFile | ||
) | ||
$ Opt.progDesc "Print the hash of a stake address key" | ||
|
||
pStakeAddressBuildCmd :: () | ||
=> CardanoEra era | ||
-> EnvCli | ||
-> Maybe (Parser (StakeAddressCmds era)) | ||
pStakeAddressBuildCmd era envCli = do | ||
w <- maybeFeatureInEra era | ||
pure | ||
$ subParser "build" | ||
$ Opt.info | ||
( StakeAddressBuild w | ||
<$> pStakeVerifier | ||
<*> pNetworkId envCli | ||
<*> pMaybeOutputFile | ||
) | ||
$ Opt.progDesc "Build a stake address" | ||
|
||
pStakeAddressRegistrationCertificateCmd :: () | ||
=> CardanoEra era | ||
-> Maybe (Parser (StakeAddressCmds era)) | ||
pStakeAddressRegistrationCertificateCmd era = do | ||
w <- maybeFeatureInEra era | ||
pure | ||
$ subParser "registration-certificate" | ||
$ Opt.info | ||
( StakeRegistrationCert w | ||
<$> pStakeIdentifier | ||
<*> optional pKeyRegistDeposit | ||
<*> pOutputFile | ||
) | ||
$ Opt.progDesc "Create a stake address registration certificate" | ||
|
||
pStakeAddressDeregistrationCertificateCmd :: () | ||
=> CardanoEra era | ||
-> Maybe (Parser (StakeAddressCmds era)) | ||
pStakeAddressDeregistrationCertificateCmd era = do | ||
w <- maybeFeatureInEra era | ||
pure | ||
$ subParser "deregistration-certificate" | ||
$ Opt.info | ||
( StakeCredentialDeRegistrationCert w | ||
<$> pStakeIdentifier | ||
<*> optional pKeyRegistDeposit | ||
<*> pOutputFile | ||
) | ||
$ Opt.progDesc "Create a stake address deregistration certificate" | ||
|
||
pStakeAddressDelegationCertificateCmd :: () | ||
=> CardanoEra era | ||
-> Maybe (Parser (StakeAddressCmds era)) | ||
pStakeAddressDelegationCertificateCmd era = do | ||
w <- maybeFeatureInEra era | ||
pure | ||
$ subParser "delegation-certificate" | ||
$ Opt.info | ||
( StakeCredentialDelegationCert w | ||
<$> pStakeIdentifier | ||
<*> pDelegationTarget | ||
<*> pOutputFile | ||
) | ||
$ Opt.progDesc "Create a stake address pool delegation certificate" |
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
Oops, something went wrong.