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 2fc2bbd809..21adf14809 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs @@ -3,6 +3,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} @@ -123,7 +124,7 @@ runGovernanceDRepRegistrationCertificateCmd makeDrepRegistrationCertificate req (pcaAnchor <$> mAnchor) - description = Just @TextEnvelopeDescr "DRep Key Registration Certificate" + description = Just $ hashSourceToDescription drepHashSource "Registration Certificate" firstExceptT RegistrationWriteFileError . newExceptT @@ -145,11 +146,10 @@ runGovernanceDRepRetirementCertificateCmd conwayEraOnwardsConstraints w $ do drepCredential <- modifyError GovernanceCmdKeyReadError $ readDRepCredential drepHashSource makeDrepUnregistrationCertificate (DRepUnregistrationRequirements w drepCredential deposit) - & writeFileTextEnvelope outFile (Just genKeyDelegCertDesc) + & writeFileTextEnvelope + outFile + (Just $ hashSourceToDescription drepHashSource "Retirement Certificate") & modifyError GovernanceCmdTextEnvWriteError . newExceptT - where - genKeyDelegCertDesc :: TextEnvelopeDescr - genKeyDelegCertDesc = "DRep Retirement Certificate" runGovernanceDRepUpdateCertificateCmd :: () @@ -172,7 +172,10 @@ runGovernanceDRepUpdateCertificateCmd (DRepUpdateRequirements w drepCredential) (pcaAnchor <$> mAnchor) firstExceptT GovernanceCmdTextEnvWriteError . newExceptT $ - writeFileTextEnvelope outFile (Just "DRep Update Certificate") updateCertificate + writeFileTextEnvelope + outFile + (Just $ hashSourceToDescription drepHashSource "Update Certificate") + updateCertificate runGovernanceDRepMetadataHashCmd :: () @@ -211,3 +214,12 @@ runGovernanceDRepMetadataHashCmd fetchURLToGovernanceCmdError :: ExceptT FetchURLError IO ByteString -> ExceptT GovernanceCmdError IO ByteString fetchURLToGovernanceCmdError = withExceptT GovernanceCmdFetchURLError + +hashSourceToDescription :: DRepHashSource -> TextEnvelopeDescr -> TextEnvelopeDescr +hashSourceToDescription source what = + ( case source of + DRepHashSourceScript _ -> "DRep Script" + DRepHashSourceVerificationKey _ -> "DRep Key" + ) + <> " " + <> what diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_registration_certificate_script.json b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_registration_certificate_script.json index 21cd0d468e..011be4033a 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_registration_certificate_script.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_registration_certificate_script.json @@ -1,5 +1,5 @@ { "type": "CertificateConway", - "description": "DRep Key Registration Certificate", + "description": "DRep Script Registration Certificate", "cborHex": "84108201581c0000000000000000000000000000000000000000000000000000000300826964756d6d792d75726c582052e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_retirement_cert b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_retirement_cert index 9fb04088b6..a98aaf5eb0 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_retirement_cert +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_retirement_cert @@ -1,5 +1,5 @@ { "type": "CertificateConway", - "description": "DRep Retirement Certificate", + "description": "DRep Key Retirement Certificate", "cborHex": "83118200581ceb09d5556a8bce421074e394d02c79ced96741657b4cf7ca8995294d1a000f4240" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate.json b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate.json index 9e65a9d789..52d437d2b9 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate.json @@ -1,5 +1,5 @@ { "type": "CertificateConway", - "description": "DRep Update Certificate", + "description": "DRep Key Update Certificate", "cborHex": "83128200581ceb09d5556a8bce421074e394d02c79ced96741657b4cf7ca8995294d826964756d6d792d75726c582052e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2" } diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate_script_hash.json b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate_script_hash.json index 8780106717..e76d48dd00 100644 --- a/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate_script_hash.json +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/drep/drep_update_certificate_script_hash.json @@ -1,5 +1,5 @@ { "type": "CertificateConway", - "description": "DRep Update Certificate", + "description": "DRep Script Update Certificate", "cborHex": "83128201581c8f33600845940d65bdbc7ea7a247a7997aa8558649128fa82c4c046882785e68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f63617264616e6f2d666f756e646174696f6e2f434950732f6d61737465722f4349502d303131392f6578616d706c65732f647265702e6a736f6e6c645820fecc1773db89b45557d82e07719c275f6877a6cadfd2469f4dc5a7df5b38b4a4" }