From 67fd850322afe8b9097245671d41ced072bcee75 Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Wed, 6 Sep 2023 15:09:17 +0200 Subject: [PATCH] #221 Update description fields on delegation certificates --- .../src/Cardano/CLI/EraBased/Run/Governance/DRep.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs index c74866051a..aa244a5b05 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -78,8 +78,7 @@ runGovernanceDelegationCertificateCmd stakeIdentifier delegationTarget outFp = d delegatee <- toLedgerDelegatee target let req = StakeDelegationRequirementsConwayOnwards cOnwards stakeCred delegatee delegCert = makeStakeAddressDelegationCertificate req - -- TODO: Conway era - update description to say if its delegating voting stake or "regular" stake - description = Just @TextEnvelopeDescr "Stake Address Delegation Certificate" + description = Just $ toDelegateeEnvelope delegatee firstExceptT DelegationCertificateWriteFileError . newExceptT $ writeLazyByteStringFile outFp @@ -125,6 +124,12 @@ toLedgerDelegatee t = conwayEraOnwardsConstraints cOn $ right $ Ledger.DelegVote $ Ledger.DRepCredential $ Ledger.ScriptHashObj scriptHash +toDelegateeEnvelope :: Ledger.Delegatee ledgerera -> TextEnvelopeDescr +toDelegateeEnvelope = \case + Ledger.DelegStake{} -> "Stake Delegation Certificate" + Ledger.DelegVote{} -> "Vote Delegation Certificate" + Ledger.DelegStakeVote{} -> "Stake and Vote Delegation Certificate" + runGovernanceDRepIdCmd :: () => ConwayEraOnwards era -> VerificationKeyOrFile DRepKey