diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs index a596fc6028..e98d32973a 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands/StakeAddress.hs @@ -50,7 +50,7 @@ data StakeAddressCmds era | StakeAddressVoteDelegationCertificateCmd (ConwayEraOnwards era) StakeIdentifier - (VerificationKeyOrHashOrFile DRepKey) + VoteDelegationTarget (File () Out) | StakeAddressDeregistrationCertificateCmd (ShelleyBasedEra era) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs index 27848d5a78..a6ba055980 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs @@ -160,7 +160,7 @@ pStakeAddressVoteDelegationCertificateCmd era = do $ Opt.info ( StakeAddressVoteDelegationCertificateCmd w <$> pStakeIdentifier - <*> pDRepVerificationKeyOrHashOrFile + <*> pVoteDelegationTarget <*> pOutputFile ) $ Opt.progDesc diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs index efaaa31f65..2dc13d7df0 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/StakeAddress.hs @@ -25,7 +25,6 @@ import Cardano.Api.Shelley import Cardano.CLI.EraBased.Commands.StakeAddress import Cardano.CLI.Read import Cardano.CLI.Types.Common -import Cardano.CLI.Types.Errors.DelegationError import Cardano.CLI.Types.Errors.StakeAddressCmdError import Cardano.CLI.Types.Errors.StakeAddressRegistrationError import Cardano.CLI.Types.Governance @@ -54,10 +53,10 @@ runStakeAddressCmds = \case runStakeAddressRegistrationCertificateCmd sbe stakeIdentifier mDeposit outputFp StakeAddressStakeDelegationCertificateCmd sbe stakeIdentifier stkPoolVerKeyHashOrFp outputFp -> runStakeAddressStakeDelegationCertificateCmd sbe stakeIdentifier stkPoolVerKeyHashOrFp outputFp - StakeAddressStakeAndVoteDelegationCertificateCmd w stakeIdentifier stakePoolVerificationKeyHashSource drepVerificationKeyHashSource outputFp -> - runStakeAddressStakeAndVoteDelegationCertificateCmd w stakeIdentifier stakePoolVerificationKeyHashSource drepVerificationKeyHashSource outputFp - StakeAddressVoteDelegationCertificateCmd w stakeIdentifier drepVerificationKeyHashSource outputFp -> - runStakeAddressVoteDelegationCertificateCmd w stakeIdentifier drepVerificationKeyHashSource outputFp + StakeAddressStakeAndVoteDelegationCertificateCmd w stakeIdentifier stakePoolVerificationKeyHashSource voteDelegationTarget outputFp -> + runStakeAddressStakeAndVoteDelegationCertificateCmd w stakeIdentifier stakePoolVerificationKeyHashSource voteDelegationTarget outputFp + StakeAddressVoteDelegationCertificateCmd w stakeIdentifier voteDelegationTarget outputFp -> + runStakeAddressVoteDelegationCertificateCmd w stakeIdentifier voteDelegationTarget outputFp StakeAddressDeregistrationCertificateCmd sbe stakeIdentifier mDeposit outputFp -> runStakeAddressDeregistrationCertificateCmd sbe stakeIdentifier mDeposit outputFp @@ -245,23 +244,22 @@ runStakeAddressStakeAndVoteDelegationCertificateCmd w stakeVerifier poolVKeyOrHa runStakeAddressVoteDelegationCertificateCmd :: () => ConwayEraOnwards era -> StakeIdentifier - -- ^ Delegator stake verification key, verification key file or script file. - -> VerificationKeyOrHashOrFile DRepKey + -- ^ Delegatee stake pool verification key or verification key file or + -> VoteDelegationTarget -- ^ Delegatee stake pool verification key or verification key file or verification key hash. -> File () Out -> ExceptT StakeAddressCmdError IO () -runStakeAddressVoteDelegationCertificateCmd w stakeVerifier drepVKeyOrHashOrFile outFp = +runStakeAddressVoteDelegationCertificateCmd w stakeVerifier voteDelegationTarget outFp = conwayEraOnwardsConstraints w $ do stakeCredential <- getStakeCredentialFromIdentifier stakeVerifier & firstExceptT StakeAddressCmdStakeCredentialError - DRepKeyHash drepKeyHash <- - lift (readVerificationKeyOrHashOrTextEnvFile AsDRepKey drepVKeyOrHashOrFile) - & onLeft (left . StakeAddressCmdDelegationError . DelegationDRepReadError) + drep <- + readVoteDelegationTarget voteDelegationTarget + & firstExceptT StakeAddressCmdDelegationError - let drepCred = Ledger.DRepCredential $ Ledger.KeyHashObj drepKeyHash - let delegatee = Ledger.DelegVote (conwayEraOnwardsConstraints w drepCred) + let delegatee = Ledger.DelegVote drep let certificate = ConwayCertificate w diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli index c07b6a434d..329cbcd869 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help.cli @@ -6847,9 +6847,12 @@ Usage: cardano-cli conway stake-address vote-delegation-certificate | --stake-script-file FILE | --stake-address ADDRESS ) - ( --drep-verification-key STRING + ( --drep-script-hash HASH + | --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence ) --out-file FILE diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_vote-delegation-certificate.cli b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_vote-delegation-certificate.cli index 5490ba3938..af481af0d9 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_vote-delegation-certificate.cli +++ b/cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-address_vote-delegation-certificate.cli @@ -4,9 +4,12 @@ Usage: cardano-cli conway stake-address vote-delegation-certificate | --stake-script-file FILE | --stake-address ADDRESS ) - ( --drep-verification-key STRING + ( --drep-script-hash HASH + | --drep-verification-key STRING | --drep-verification-key-file FILE | --drep-key-hash HASH + | --always-abstain + | --always-no-confidence ) --out-file FILE @@ -20,6 +23,7 @@ Available options: Filepath of the staking verification key. --stake-script-file FILE Filepath of the staking script. --stake-address ADDRESS Target stake address (bech32 format). + --drep-script-hash HASH DRep script hash (hex-encoded). --drep-verification-key STRING DRep verification key (Bech32 or hex-encoded). --drep-verification-key-file FILE @@ -27,5 +31,7 @@ Available options: --drep-key-hash HASH DRep verification key hash (either Bech32-encoded or hex-encoded). Zero or more occurences of this option is allowed. + --always-abstain Abstain from voting on all proposals. + --always-no-confidence Always vote no confidence --out-file FILE The output file. -h,--help Show this help text