-
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.
- Loading branch information
Showing
49 changed files
with
1,094 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
|
||
module Cardano.CLI.EraBased.Commands.Address | ||
( AddressCmds (..) | ||
, renderAddressCmds | ||
) where | ||
|
||
import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..)) | ||
|
||
import Cardano.CLI.Types.Common | ||
import Cardano.CLI.Types.Key | ||
|
||
import Prelude | ||
|
||
import Data.Text (Text) | ||
|
||
data AddressCmds era | ||
= AddressKeyGen | ||
KeyOutputFormat | ||
AddressKeyType | ||
(VerificationKeyFile Out) | ||
(SigningKeyFile Out) | ||
| AddressKeyHash | ||
VerificationKeyTextOrFile | ||
(Maybe (File () Out)) | ||
| AddressBuild | ||
PaymentVerifier | ||
(Maybe StakeIdentifier) | ||
NetworkId | ||
(Maybe (File () Out)) | ||
| AddressInfo | ||
Text | ||
(Maybe (File () Out)) | ||
deriving Show | ||
|
||
renderAddressCmds :: AddressCmds era -> Text | ||
renderAddressCmds = \case | ||
AddressKeyGen {} -> "address key-gen" | ||
AddressKeyHash {} -> "address key-hash" | ||
AddressBuild {} -> "address build" | ||
AddressInfo {} -> "address info" |
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,63 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module Cardano.CLI.EraBased.Options.Address | ||
( pAddressCmds | ||
) where | ||
|
||
import Cardano.Api | ||
|
||
import Cardano.CLI.Environment (EnvCli (..)) | ||
import Cardano.CLI.EraBased.Commands.Address | ||
import Cardano.CLI.EraBased.Options.Common | ||
|
||
import Data.Foldable | ||
import Options.Applicative hiding (help, str) | ||
import qualified Options.Applicative as Opt | ||
|
||
pAddressCmds :: CardanoEra era -> EnvCli -> Parser (AddressCmds era) | ||
pAddressCmds _ envCli = | ||
asum | ||
[ subParser "key-gen" | ||
$ Opt.info pAddressKeyGen | ||
$ Opt.progDesc "Create an address key pair." | ||
, subParser "key-hash" | ||
$ Opt.info pAddressKeyHash | ||
$ Opt.progDesc "Print the hash of an address key." | ||
, subParser "build" | ||
$ Opt.info (pAddressBuild envCli) | ||
$ Opt.progDesc "Build a Shelley payment address, with optional delegation to a stake address." | ||
, subParser "info" | ||
$ Opt.info pAddressInfo | ||
$ Opt.progDesc "Print information about an address." | ||
] | ||
|
||
pAddressKeyGen :: Parser (AddressCmds era) | ||
pAddressKeyGen = | ||
AddressKeyGen | ||
<$> pKeyOutputFormat | ||
<*> pAddressKeyType | ||
<*> pVerificationKeyFileOut | ||
<*> pSigningKeyFileOut | ||
|
||
pAddressKeyHash :: Parser (AddressCmds era) | ||
pAddressKeyHash = | ||
AddressKeyHash | ||
<$> pPaymentVerificationKeyTextOrFile | ||
<*> pMaybeOutputFile | ||
|
||
pAddressBuild :: EnvCli -> Parser (AddressCmds era) | ||
pAddressBuild envCli = | ||
AddressBuild | ||
<$> pPaymentVerifier | ||
<*> Opt.optional pStakeIdentifier | ||
<*> pNetworkId envCli | ||
<*> pMaybeOutputFile | ||
|
||
pAddressInfo :: Parser (AddressCmds era) | ||
pAddressInfo = | ||
AddressInfo | ||
<$> pAddress | ||
<*> pMaybeOutputFile |
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.