Skip to content

Commit

Permalink
Update StakeVerifier definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Feb 23, 2024
1 parent 6c49437 commit c61d085
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ pStakeIdentifier prefix = asum

pStakeVerifier :: Maybe String -> Parser StakeVerifier
pStakeVerifier prefix = asum
[ StakeVerifierKey <$> pStakeVerificationKeyOrFile prefix
[ StakeVerifierKey <$> pStakeVerificationKeyOrHashOrFile prefix
, StakeVerifierScriptFile <$> pScriptFor (prefixFlag prefix "stake-script-file") Nothing "Filepath of the staking script."
]

Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Address.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Cardano.CLI.Types.Common
import Cardano.CLI.Types.Errors.AddressCmdError
import Cardano.CLI.Types.Key (PaymentVerifier (..), StakeIdentifier (..),
StakeVerifier (..), VerificationKeyTextOrFile, generateKeyPair,
readVerificationKeyOrFile, readVerificationKeyTextOrFileAnyOf)
readVerificationKeyOrHashOrFile, readVerificationKeyTextOrFileAnyOf)

import qualified Data.ByteString.Char8 as BS
import Data.Function
Expand Down Expand Up @@ -194,10 +194,10 @@ makeStakeAddressRef stakeIdentifier =
StakeIdentifierVerifier stakeVerifier ->
case stakeVerifier of
StakeVerifierKey stkVkeyOrFile -> do
stakeVKey <- firstExceptT AddressCmdReadKeyFileError $
newExceptT $ readVerificationKeyOrFile AsStakeKey stkVkeyOrFile
stakeVKeyHash <- firstExceptT AddressCmdReadKeyFileError $
newExceptT $ readVerificationKeyOrHashOrFile AsStakeKey stkVkeyOrFile

return . StakeAddressByValue . StakeCredentialByKey . verificationKeyHash $ stakeVKey
return . StakeAddressByValue $ StakeCredentialByKey stakeVKeyHash

StakeVerifierScriptFile (ScriptFile fp) -> do
ScriptInAnyLang _lang script <-
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli/src/Cardano/CLI/Read.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,10 +1040,10 @@ getStakeCredentialFromVerifier = \case
pure $ StakeCredentialByScript $ hashScript script

StakeVerifierKey stakeVerKeyOrFile -> do
stakeVerKey <-
ExceptT (readVerificationKeyOrFile AsStakeKey stakeVerKeyOrFile)
stakeVerKeyHash <-
ExceptT (readVerificationKeyOrHashOrFile AsStakeKey stakeVerKeyOrFile)
& firstExceptT StakeCredentialInputDecodeError
pure $ StakeCredentialByKey $ verificationKeyHash stakeVerKey
pure $ StakeCredentialByKey stakeVerKeyHash

getStakeCredentialFromIdentifier :: ()
=> StakeIdentifier
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Types/Key.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ data PaymentVerifier
deriving (Eq, Show)

data StakeVerifier
= StakeVerifierKey (VerificationKeyOrFile StakeKey)
= StakeVerifierKey (VerificationKeyOrHashOrFile StakeKey)
| StakeVerifierScriptFile ScriptFile
deriving (Eq, Show)

Expand Down

0 comments on commit c61d085

Please sign in to comment.