diff --git a/cardano-api/src/Cardano/Api.hs b/cardano-api/src/Cardano/Api.hs index 7e5178c3354..a1f5c11874e 100644 --- a/cardano-api/src/Cardano/Api.hs +++ b/cardano-api/src/Cardano/Api.hs @@ -97,6 +97,7 @@ module Cardano.Api ( StakeAddress, StakeCredential, makeStakeAddress, + stakeAddressCredential, StakeKey, StakeExtendedKey, diff --git a/cardano-api/src/Cardano/Api/Address.hs b/cardano-api/src/Cardano/Api/Address.hs index fd71cc6aa0d..89f8831ee61 100644 --- a/cardano-api/src/Cardano/Api/Address.hs +++ b/cardano-api/src/Cardano/Api/Address.hs @@ -47,6 +47,7 @@ module Cardano.Api.Address ( StakeAddress(..), StakeCredential(..), makeStakeAddress, + stakeAddressCredential, StakeKey, StakeExtendedKey, @@ -718,3 +719,6 @@ fromShelleyStakeReference (Shelley.StakeRefPtr ptr) = fromShelleyStakeReference Shelley.StakeRefNull = NoStakeAddress +-- | Get credential from a stake address. This drops the network information. +stakeAddressCredential :: StakeAddress -> StakeCredential +stakeAddressCredential (StakeAddress _ scred) = fromShelleyStakeCredential scred diff --git a/cardano-cli/src/Cardano/CLI/Shelley/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/Shelley/Run/Governance.hs index 4d54e3e734d..beb79fb7847 100644 --- a/cardano-cli/src/Cardano/CLI/Shelley/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/Shelley/Run/Governance.hs @@ -87,7 +87,7 @@ runGovernanceMIRCertificatePayStakeAddrs mirPot sAddrs rwdAmts (OutputFile oFp) left $ ShelleyGovernanceCmdMIRCertificateKeyRewardMistmach oFp (length sAddrs) (length rwdAmts) - let sCreds = map stakeAddrToStakeCredential sAddrs + let sCreds = map stakeAddressCredential sAddrs mirCert = makeMIRCertificate mirPot (StakeAddressesMIR $ zip sCreds rwdAmts) firstExceptT ShelleyGovernanceCmdTextEnvWriteError @@ -97,11 +97,6 @@ runGovernanceMIRCertificatePayStakeAddrs mirPot sAddrs rwdAmts (OutputFile oFp) mirCertDesc :: TextEnvelopeDescr mirCertDesc = "Move Instantaneous Rewards Certificate" - --TODO: expose a pattern for StakeAddress that give us the StakeCredential - stakeAddrToStakeCredential :: StakeAddress -> StakeCredential - stakeAddrToStakeCredential (StakeAddress _ scred) = - fromShelleyStakeCredential scred - runGovernanceMIRCertificateTransfer :: Lovelace -> OutputFile