From a394707092c99934e6afaee1ee0eb1773a93491e Mon Sep 17 00:00:00 2001 From: Mateusz Galazyn Date: Fri, 8 Mar 2024 17:09:23 +0100 Subject: [PATCH] Add script support when making hot key authorization certificates --- cardano-api/internal/Cardano/Api/Certificate.hs | 10 ++++------ cardano-api/internal/Cardano/Api/Monad/Error.hs | 6 ++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/Certificate.hs b/cardano-api/internal/Cardano/Api/Certificate.hs index bf9c83bcbf..52a7021127 100644 --- a/cardano-api/internal/Cardano/Api/Certificate.hs +++ b/cardano-api/internal/Cardano/Api/Certificate.hs @@ -410,19 +410,17 @@ makeDrepRegistrationCertificate (DRepRegistrationRequirements conwayOnwards vcre data CommitteeHotKeyAuthorizationRequirements era where CommitteeHotKeyAuthorizationRequirements :: ConwayEraOnwards era - -> Ledger.KeyHash Ledger.ColdCommitteeRole (EraCrypto (ShelleyLedgerEra era)) - -> Ledger.KeyHash Ledger.HotCommitteeRole (EraCrypto (ShelleyLedgerEra era)) + -> Ledger.Credential Ledger.ColdCommitteeRole (EraCrypto (ShelleyLedgerEra era)) + -> Ledger.Credential Ledger.HotCommitteeRole (EraCrypto (ShelleyLedgerEra era)) -> CommitteeHotKeyAuthorizationRequirements era makeCommitteeHotKeyAuthorizationCertificate :: () => CommitteeHotKeyAuthorizationRequirements era -> Certificate era -makeCommitteeHotKeyAuthorizationCertificate (CommitteeHotKeyAuthorizationRequirements cOnwards coldKeyHash hotKeyHash) = +makeCommitteeHotKeyAuthorizationCertificate (CommitteeHotKeyAuthorizationRequirements cOnwards coldKeyCredential hotKeyCredential) = ConwayCertificate cOnwards . Ledger.ConwayTxCertGov - $ Ledger.ConwayAuthCommitteeHotKey - (Ledger.KeyHashObj coldKeyHash) - (Ledger.KeyHashObj hotKeyHash) + $ Ledger.ConwayAuthCommitteeHotKey coldKeyCredential hotKeyCredential data CommitteeColdkeyResignationRequirements era where CommitteeColdkeyResignationRequirements diff --git a/cardano-api/internal/Cardano/Api/Monad/Error.hs b/cardano-api/internal/Cardano/Api/Monad/Error.hs index edd710fe53..8df1372f66 100644 --- a/cardano-api/internal/Cardano/Api/Monad/Error.hs +++ b/cardano-api/internal/Cardano/Api/Monad/Error.hs @@ -13,6 +13,7 @@ module Cardano.Api.Monad.Error , modifyError , handleIOExceptionsWith , handleIOExceptionsLiftWith + , hoistIOEither , module Control.Monad.Except , module Control.Monad.IO.Class @@ -81,3 +82,8 @@ liftExceptT :: MonadTransError e t m -> t m a liftExceptT = modifyError id + +hoistIOEither :: MonadIOTransError e t m + => IO (Either e a) + -> t m a +hoistIOEither = liftExceptT . ExceptT . liftIO