diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 6b0d08b817..1b668ca6d6 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -65,14 +65,17 @@ library Cardano.Api.Byron Cardano.Api.Certificate Cardano.Api.Compatible + Cardano.Api.Compatible.Certificate Cardano.Api.Compatible.Tx Cardano.Api.Consensus Cardano.Api.Crypto.Ed25519Bip32 Cardano.Api.Era Cardano.Api.Error Cardano.Api.Experimental + Cardano.Api.Experimental.Certificate Cardano.Api.Experimental.Era Cardano.Api.Experimental.Plutus + Cardano.Api.Experimental.Serialise.TextEnvelope Cardano.Api.Experimental.Simple.Script Cardano.Api.Experimental.Tx Cardano.Api.Genesis @@ -224,9 +227,12 @@ library Cardano.Api.Experimental.Plutus.Internal.Script Cardano.Api.Experimental.Plutus.Internal.ScriptWitness Cardano.Api.Experimental.Plutus.Internal.Shim.LegacyScripts + Cardano.Api.Experimental.Serialise.TextEnvelope.Internal Cardano.Api.Experimental.Tx.Internal.AnyWitness Cardano.Api.Experimental.Tx.Internal.Body Cardano.Api.Experimental.Tx.Internal.Certificate + Cardano.Api.Experimental.Tx.Internal.Certificate.Compatible + Cardano.Api.Experimental.Tx.Internal.Certificate.Type Cardano.Api.Experimental.Tx.Internal.Compatible Cardano.Api.Experimental.Tx.Internal.Fee Cardano.Api.Experimental.Tx.Internal.TxScriptWitnessRequirements diff --git a/cardano-api/gen/Test/Gen/Cardano/Api/Orphans.hs b/cardano-api/gen/Test/Gen/Cardano/Api/Orphans.hs index 1d1caf5c6b..65f8f83042 100644 --- a/cardano-api/gen/Test/Gen/Cardano/Api/Orphans.hs +++ b/cardano-api/gen/Test/Gen/Cardano/Api/Orphans.hs @@ -15,7 +15,7 @@ module Test.Gen.Cardano.Api.Orphans (obtainArbitraryConstraints) where -import Cardano.Api hiding (txIns) +import Cardano.Api hiding (DijkstraEra, txIns) import Cardano.Api.Ledger qualified as L import Cardano.Crypto.Hash.Class (hashWith) diff --git a/cardano-api/src/Cardano/Api/Certificate.hs b/cardano-api/src/Cardano/Api/Certificate.hs index 73c70245ba..b8dec3c02f 100644 --- a/cardano-api/src/Cardano/Api/Certificate.hs +++ b/cardano-api/src/Cardano/Api/Certificate.hs @@ -31,9 +31,6 @@ module Cardano.Api.Certificate , makeDrepUpdateCertificate , makeStakeAddressAndDRepDelegationCertificate - -- * Registering DReps - , DRepMetadataReference (..) - -- * Special certificates , GenesisKeyDelegationRequirements (..) , MirCertificateRequirements (..) @@ -48,8 +45,6 @@ module Cardano.Api.Certificate , getAnchorDataFromCertificate -- * Internal conversion functions - , toShelleyCertificate - , fromShelleyCertificate , toShelleyPoolParams , fromShelleyPoolParams diff --git a/cardano-api/src/Cardano/Api/Certificate/Internal.hs b/cardano-api/src/Cardano/Api/Certificate/Internal.hs index 7924d9bf69..08b18aa96c 100644 --- a/cardano-api/src/Cardano/Api/Certificate/Internal.hs +++ b/cardano-api/src/Cardano/Api/Certificate/Internal.hs @@ -46,9 +46,6 @@ module Cardano.Api.Certificate.Internal , makeDrepUpdateCertificate , makeStakeAddressAndDRepDelegationCertificate - -- * Registering DReps - , DRepMetadataReference (..) - -- * Special certificates , GenesisKeyDelegationRequirements (..) , MirCertificateRequirements (..) @@ -70,13 +67,11 @@ module Cardano.Api.Certificate.Internal , fromShelleyStakePoolState -- * Data family instances - , AsType (..) + , AsType (AsCertificate, AsTxId) -- * Internal functions - , certificateToTxCert , filterUnRegCreds , filterUnRegDRepCreds - , getTxCertWitness , isDRepRegOrUpdateCert ) where @@ -87,22 +82,18 @@ import Cardano.Api.Certificate.Internal.StakePoolMetadata import Cardano.Api.Era import Cardano.Api.Error (Error (..)) import Cardano.Api.Experimental.Tx.Internal.Certificate qualified as Exp -import Cardano.Api.Governance.Internal.Action.VotingProcedure +import Cardano.Api.Experimental.Tx.Internal.Certificate.Compatible (getTxCertWitness) import Cardano.Api.HasTypeProxy import Cardano.Api.Internal.Utils (noInlineMaybeToStrictMaybe) import Cardano.Api.Key.Internal import Cardano.Api.Key.Internal.Praos import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger -import Cardano.Api.Plutus.Internal.Script import Cardano.Api.Pretty (Doc) import Cardano.Api.Serialise.Cbor import Cardano.Api.Serialise.TextEnvelope.Internal -import Cardano.Api.Value.Internal -import Cardano.Ledger.Api qualified as L import Cardano.Ledger.BaseTypes (strictMaybe) import Cardano.Ledger.Coin qualified as L -import Cardano.Ledger.Keys qualified as Ledger import Cardano.Ledger.State qualified as Ledger import Control.Monad @@ -228,21 +219,6 @@ instance ConwayCertificate _ (Ledger.ConwayTxCertPool Ledger.RegPool{}) -> "Pool registration" ConwayCertificate _ (Ledger.ConwayTxCertPool Ledger.RetirePool{}) -> "Pool retirement" -certificateToTxCert :: Certificate era -> L.TxCert (ShelleyLedgerEra era) -certificateToTxCert c = - case c of - ShelleyRelatedCertificate eon cert -> - case eon of - ShelleyToBabbageEraShelley -> cert - ShelleyToBabbageEraAllegra -> cert - ShelleyToBabbageEraMary -> cert - ShelleyToBabbageEraAlonzo -> cert - ShelleyToBabbageEraBabbage -> cert - ConwayCertificate eon cert -> - case eon of - ConwayEraOnwardsConway -> cert - ConwayEraOnwardsDijkstra -> error "certificateToTxCert: Dijkstra era is not yet supported" - -- ---------------------------------------------------------------------------- -- Stake pool parameters -- @@ -285,21 +261,15 @@ data StakePoolMetadataReference } deriving (Eq, Show) --- ---------------------------------------------------------------------------- --- DRep parameters --- - -data DRepMetadataReference - = DRepMetadataReference - { drepMetadataURL :: Text - , drepMetadataHash :: Hash DRepMetadata - } - deriving (Eq, Show) - -- ---------------------------------------------------------------------------- -- Constructor functions -- +{-# DEPRECATED + StakeAddressRequirements + "Use Cardano.Api.Experimental's makeStakeAddressRegistrationCertificate instead" + #-} + data StakeAddressRequirements era where StakeAddrRegistrationConway :: ConwayEraOnwards era @@ -311,6 +281,11 @@ data StakeAddressRequirements era where -> StakeCredential -> StakeAddressRequirements era +{-# DEPRECATED + makeStakeAddressRegistrationCertificate + "If you need compatibility with all shelley based eras use Cardano.Api.Compatible.Certificate's \ + \ makeStakeAddressRegistrationCertificate. Otherwise use Cardano.Api.Experimental.Certificate's makeStakeAddressRegistrationCertificate" + #-} makeStakeAddressRegistrationCertificate :: StakeAddressRequirements era -> Certificate era makeStakeAddressRegistrationCertificate = \case StakeAddrRegistrationPreConway w scred -> @@ -323,6 +298,11 @@ makeStakeAddressRegistrationCertificate = \case ConwayCertificate cOnwards $ Ledger.mkRegDepositTxCert (toShelleyStakeCredential scred) deposit +{-# DEPRECATED + makeStakeAddressUnregistrationCertificate + "If you need compatibility with all shelley based eras use Cardano.Api.Compatible.Certificate's \ + \ makeStakeAddressUnregistrationCertificate. Otherwise use Cardano.Api.Experimental.Certificate's makeStakeAddressUnregistrationCertificate" + #-} makeStakeAddressUnregistrationCertificate :: StakeAddressRequirements era -> Certificate era makeStakeAddressUnregistrationCertificate req = case req of @@ -336,6 +316,12 @@ makeStakeAddressUnregistrationCertificate req = Ledger.mkUnRegTxCert $ toShelleyStakeCredential scred +{-# DEPRECATED + StakeDelegationRequirements + "If you need compatibility with all shelley based eras use Cardano.Api.Compatible.Certificate's \ + \ makeStakeAddressDelegationCertificate. Otherwise use Cardano.Api.Experimental.Certificate's makeStakeAddressDelegationCertificate" + #-} + data StakeDelegationRequirements era where StakeDelegationRequirementsConwayOnwards :: ConwayEraOnwards era @@ -348,6 +334,11 @@ data StakeDelegationRequirements era where -> PoolId -> StakeDelegationRequirements era +{-# DEPRECATED + makeStakeAddressDelegationCertificate + "If you need compatibility with all shelley based eras use Cardano.Api.Compatible.Certificate's \ + \ makeStakeAddressDelegationCertificate. Otherwise use Cardano.Api.Experimental.Certificate's makeStakeAddressDelegationCertificate" + #-} makeStakeAddressDelegationCertificate :: StakeDelegationRequirements era -> Certificate era makeStakeAddressDelegationCertificate = \case StakeDelegationRequirementsConwayOnwards cOnwards scred delegatee -> @@ -369,6 +360,11 @@ data StakePoolRegistrationRequirements era where -> Ledger.PoolParams -> StakePoolRegistrationRequirements era +{-# DEPRECATED + makeStakePoolRegistrationCertificate + "If you need compatibility with all shelley based eras use Cardano.Api.Compatible.Certificate's \ + \ makeStakePoolRegistrationCertificate. Otherwise use Cardano.Api.Experimental.Certificate's makeStakePoolRegistrationCertificate" + #-} makeStakePoolRegistrationCertificate :: () => StakePoolRegistrationRequirements era @@ -383,6 +379,12 @@ makeStakePoolRegistrationCertificate = \case ShelleyRelatedCertificate atMostBab $ Ledger.mkRegPoolTxCert poolParams +{-# DEPRECATED + StakePoolRetirementRequirements + "If you need compatibility with all shelley based eras use Cardano.Api.Compatible.Certificate's \ + \ makeStakePoolRetirementCertificate. Otherwise use Cardano.Api.Experimental.Certificate's makeStakePoolRetirementCertificate" + #-} + data StakePoolRetirementRequirements era where StakePoolRetirementRequirementsConwayOnwards :: ConwayEraOnwards era @@ -395,6 +397,11 @@ data StakePoolRetirementRequirements era where -> Ledger.EpochNo -> StakePoolRetirementRequirements era +{-# DEPRECATED + makeStakePoolRetirementCertificate + "If you need compatibility with all shelley based eras use Cardano.Api.Compatible.Certificate's \ + \ makeStakePoolRetirementCertificate. Otherwise use Cardano.Api.Experimental.Certificate's makeStakePoolRetirementCertificate" + #-} makeStakePoolRetirementCertificate :: () => StakePoolRetirementRequirements era @@ -410,6 +417,11 @@ makeStakePoolRetirementCertificate req = ConwayCertificate atMostBab $ Ledger.mkRetirePoolTxCert (unStakePoolKeyHash poolId) retirementEpoch +{-# DEPRECATED + GenesisKeyDelegationRequirements + "Use Cardano.Api.Compatible.Certificate's makeGenesisKeyDelegationCertificate instead" + #-} + data GenesisKeyDelegationRequirements era where GenesisKeyDelegationRequirements :: ShelleyToBabbageEra era @@ -418,6 +430,10 @@ data GenesisKeyDelegationRequirements era where -> Hash VrfKey -> GenesisKeyDelegationRequirements era +{-# DEPRECATED + makeGenesisKeyDelegationCertificate + "Use Cardano.Api.Compatible.Certificate's makeGenesisKeyDelegationCertificate instead" + #-} makeGenesisKeyDelegationCertificate :: Typeable era => GenesisKeyDelegationRequirements era -> Certificate era makeGenesisKeyDelegationCertificate @@ -432,6 +448,11 @@ makeGenesisKeyDelegationCertificate Ledger.ShelleyTxCertGenesisDeleg $ Ledger.GenesisDelegCert hGenKey hGenDelegKey (Ledger.toVRFVerKeyHash hVrfKey) +{-# DEPRECATED + MirCertificateRequirements + "Use Cardano.Api.Compatible.Certificate's makeMIRCertificate instead" + #-} + data MirCertificateRequirements era where MirCertificateRequirements :: ShelleyToBabbageEra era @@ -439,6 +460,10 @@ data MirCertificateRequirements era where -> Ledger.MIRTarget -> MirCertificateRequirements era +{-# DEPRECATED + makeMIRCertificate + "Use Cardano.Api.Compatible.Certificate's makeMIRCertificate instead" + #-} makeMIRCertificate :: Typeable era => MirCertificateRequirements era @@ -448,6 +473,11 @@ makeMIRCertificate (MirCertificateRequirements atMostEra mirPot mirTarget) = Ledger.ShelleyTxCertMir $ Ledger.MIRCert mirPot mirTarget +{-# DEPRECATED + DRepRegistrationRequirements + "Use Cardano.Api.Experimental.Certificate's makeDrepRegistrationCertificate instead" + #-} + data DRepRegistrationRequirements era where DRepRegistrationRequirements :: ConwayEraOnwards era @@ -455,6 +485,10 @@ data DRepRegistrationRequirements era where -> L.Coin -> DRepRegistrationRequirements era +{-# DEPRECATED + makeDrepRegistrationCertificate + "Use Cardano.Api.Experimental.Certificate's makeDrepRegistrationCertificate instead" + #-} makeDrepRegistrationCertificate :: Typeable era => DRepRegistrationRequirements era @@ -472,6 +506,10 @@ data CommitteeHotKeyAuthorizationRequirements era where -> Ledger.Credential Ledger.HotCommitteeRole -> CommitteeHotKeyAuthorizationRequirements era +{-# DEPRECATED + makeCommitteeHotKeyAuthorizationCertificate + "Use Cardano.Api.Experimental.Certificate's makeCommitteeHotKeyAuthorizationCertificate instead" + #-} makeCommitteeHotKeyAuthorizationCertificate :: Typeable era => CommitteeHotKeyAuthorizationRequirements era @@ -481,6 +519,11 @@ makeCommitteeHotKeyAuthorizationCertificate (CommitteeHotKeyAuthorizationRequire . Ledger.ConwayTxCertGov $ Ledger.ConwayAuthCommitteeHotKey coldKeyCredential hotKeyCredential +{-# DEPRECATED + CommitteeColdkeyResignationRequirements + "Use Cardano.Api.Experimental.Certificate's makeCommitteeColdkeyResignationCertificate instead" + #-} + data CommitteeColdkeyResignationRequirements era where CommitteeColdkeyResignationRequirements :: ConwayEraOnwards era @@ -488,6 +531,10 @@ data CommitteeColdkeyResignationRequirements era where -> Maybe Ledger.Anchor -> CommitteeColdkeyResignationRequirements era +{-# DEPRECATED + makeCommitteeColdkeyResignationCertificate + "Use Cardano.Api.Experimental.Certificate's makeCommitteeColdkeyResignationCertificate instead" + #-} makeCommitteeColdkeyResignationCertificate :: Typeable era => CommitteeColdkeyResignationRequirements era @@ -499,6 +546,11 @@ makeCommitteeColdkeyResignationCertificate (CommitteeColdkeyResignationRequireme coldKeyCred (noInlineMaybeToStrictMaybe anchor) +{-# DEPRECATED + DRepUnregistrationRequirements + "Use Cardano.Api.Experimental.Certificate's makeDrepUnregistrationCertificate instead" + #-} + data DRepUnregistrationRequirements era where DRepUnregistrationRequirements :: ConwayEraOnwards era @@ -506,6 +558,10 @@ data DRepUnregistrationRequirements era where -> L.Coin -> DRepUnregistrationRequirements era +{-# DEPRECATED + makeDrepUnregistrationCertificate + "Use Cardano.Api.Experimental.Certificate's makeDrepUnregistrationCertificate instead" + #-} makeDrepUnregistrationCertificate :: Typeable era => DRepUnregistrationRequirements era @@ -515,6 +571,10 @@ makeDrepUnregistrationCertificate (DRepUnregistrationRequirements conwayOnwards . Ledger.ConwayTxCertGov $ Ledger.ConwayUnRegDRep vcred deposit +{-# DEPRECATED + makeStakeAddressAndDRepDelegationCertificate + "Use Cardano.Api.Experimental.Certificate's makeStakeAddressAndDRepDelegationCertificate instead" + #-} makeStakeAddressAndDRepDelegationCertificate :: () => ConwayEraOnwards era @@ -527,12 +587,21 @@ makeStakeAddressAndDRepDelegationCertificate w cred delegatee deposit = ConwayCertificate w $ Ledger.mkRegDepositDelegTxCert (toShelleyStakeCredential cred) delegatee deposit +{-# DEPRECATED + DRepUpdateRequirements + "Use Cardano.Api.Experimental.Certificate's makeDrepUpdateCertificate instead" + #-} + data DRepUpdateRequirements era where DRepUpdateRequirements :: ConwayEraOnwards era -> Ledger.Credential Ledger.DRepRole -> DRepUpdateRequirements era +{-# DEPRECATED + makeDrepUpdateCertificate + "Use Cardano.Api.Experimental.Certificate's makeDrepUpdateCertificate instead" + #-} makeDrepUpdateCertificate :: Typeable era => DRepUpdateRequirements era @@ -547,19 +616,12 @@ makeDrepUpdateCertificate (DRepUpdateRequirements conwayOnwards vcred) mAnchor = -- Helper functions -- -getTxCertWitness - :: ShelleyBasedEra era - -> Ledger.TxCert (ShelleyLedgerEra era) - -> Maybe StakeCredential -getTxCertWitness sbe ledgerCert = shelleyBasedEraConstraints sbe $ - case Ledger.getVKeyWitnessTxCert ledgerCert of - Just keyHash -> Just $ StakeCredentialByKey $ StakeKeyHash $ Ledger.coerceKeyRole keyHash - Nothing -> - StakeCredentialByScript . fromShelleyScriptHash - <$> Ledger.getScriptWitnessTxCert ledgerCert - -- | Get the stake credential witness for a certificate that requires it. -- Only stake address deregistration and delegation requires witnessing (witness can be script or key). +{-# DEPRECATED + selectStakeCredentialWitness + "Use Cardano.Api.Certificate's selectStakeCredentialWitness instead" + #-} selectStakeCredentialWitness :: Certificate era -> Maybe StakeCredential diff --git a/cardano-api/src/Cardano/Api/Compatible/Certificate.hs b/cardano-api/src/Cardano/Api/Compatible/Certificate.hs new file mode 100644 index 0000000000..1b95ca2c1f --- /dev/null +++ b/cardano-api/src/Cardano/Api/Compatible/Certificate.hs @@ -0,0 +1,29 @@ +module Cardano.Api.Compatible.Certificate + ( -- * Types that vary across the hardfork boundary + Delegatee + + -- * Registering stake address and delegating + , makeStakeAddressDelegationCertificate + , makeStakeAddressRegistrationCertificate + , makeStakeAddressUnregistrationCertificate + , StakeCredentialAndDeposit (..) + , StakeRegistrationRequirements + + -- * Registering stake pools + , makeStakePoolRegistrationCertificate + , makeStakePoolRetirementCertificate + + -- * Special certificates + , makeMIRCertificate + , makeGenesisKeyDelegationCertificate + , Ledger.MIRTarget (..) + , Ledger.MIRPot (..) + , selectStakeCredentialWitness + + -- * Internal + , getTxCertWitness + ) +where + +import Cardano.Api.Experimental.Tx.Internal.Certificate.Compatible +import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger diff --git a/cardano-api/src/Cardano/Api/Era.hs b/cardano-api/src/Cardano/Api/Era.hs index 7f01910dfd..d8ceb0abbe 100644 --- a/cardano-api/src/Cardano/Api/Era.hs +++ b/cardano-api/src/Cardano/Api/Era.hs @@ -8,6 +8,7 @@ module Cardano.Api.Era , AlonzoEra , BabbageEra , ConwayEra + , DijkstraEra -- * Eons , module Cardano.Api.Era.Internal.Eon.ShelleyBasedEra diff --git a/cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs b/cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs index 4c5492eeaa..4717ebefc0 100644 --- a/cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs +++ b/cardano-api/src/Cardano/Api/Era/Internal/Eon/ShelleyBasedEra.hs @@ -227,6 +227,7 @@ type ShelleyBasedEraConstraints era = , L.EraPParams (ShelleyLedgerEra era) , L.EraTx (ShelleyLedgerEra era) , L.EraTxBody (ShelleyLedgerEra era) + , L.EraTxCert (ShelleyLedgerEra era) , L.EraTxOut (ShelleyLedgerEra era) , L.EraUTxO (ShelleyLedgerEra era) , L.EraTxWits (ShelleyLedgerEra era) diff --git a/cardano-api/src/Cardano/Api/Experimental.hs b/cardano-api/src/Cardano/Api/Experimental.hs index 73581f7c84..ecc4e5996b 100644 --- a/cardano-api/src/Cardano/Api/Experimental.hs +++ b/cardano-api/src/Cardano/Api/Experimental.hs @@ -21,7 +21,6 @@ module Cardano.Api.Experimental , obtainCommonConstraints , hashTxBody , evaluateTransactionExecutionUnitsShelley - , Certificate (..) , AnchorDataFromCertificateError (..) , getAnchorDataFromCertificate , mkTxCertificates @@ -60,6 +59,29 @@ module Cardano.Api.Experimental , PlutusScriptDatum (..) , NoScriptDatum (..) + -- ** Certificate related + , Certificate (..) + + -- * Registering stake address and delegating + , makeStakeAddressDelegationCertificate + , makeStakeAddressRegistrationCertificate + , makeStakeAddressUnregistrationCertificate + + -- * Registering stake pools + , makeStakePoolRegistrationCertificate + , makeStakePoolRetirementCertificate + + -- * Governance related certificates + , makeCommitteeColdkeyResignationCertificate + , makeCommitteeHotKeyAuthorizationCertificate + , makeDrepRegistrationCertificate + , makeDrepUnregistrationCertificate + , makeDrepUpdateCertificate + , makeStakeAddressAndDRepDelegationCertificate + + -- * Data family instances + , AsType (..) + -- ** Internal , getAnyWitnessRedeemerPointerMap , toPlutusScriptPurpose @@ -70,6 +92,7 @@ module Cardano.Api.Experimental ) where +import Cardano.Api.Experimental.Certificate import Cardano.Api.Experimental.Era import Cardano.Api.Experimental.Plutus.Internal.IndexedPlutusScriptWitness import Cardano.Api.Experimental.Plutus.Internal.Script @@ -77,7 +100,6 @@ import Cardano.Api.Experimental.Plutus.Internal.ScriptWitness import Cardano.Api.Experimental.Plutus.Internal.Shim.LegacyScripts import Cardano.Api.Experimental.Simple.Script import Cardano.Api.Experimental.Tx -import Cardano.Api.Experimental.Tx.Internal.Certificate import Cardano.Api.Experimental.Tx.Internal.Compatible import Cardano.Api.Experimental.Tx.Internal.Fee import Cardano.Api.Tx.Internal.Fee (evaluateTransactionExecutionUnitsShelley) diff --git a/cardano-api/src/Cardano/Api/Experimental/Certificate.hs b/cardano-api/src/Cardano/Api/Experimental/Certificate.hs new file mode 100644 index 0000000000..45498f0929 --- /dev/null +++ b/cardano-api/src/Cardano/Api/Experimental/Certificate.hs @@ -0,0 +1,71 @@ +module Cardano.Api.Experimental.Certificate + ( Certificate (..) + + -- * Registering stake address and delegating + , makeStakeAddressDelegationCertificate + , makeStakeAddressRegistrationCertificate + , makeStakeAddressUnregistrationCertificate + , PoolId + + -- * Registering stake pools + , makeStakePoolRegistrationCertificate + , makeStakePoolRetirementCertificate + , StakePoolParameters (..) + , StakePoolRelay (..) + , StakePoolMetadataReference (..) + + -- * Conway specific certificates + , makeCommitteeColdkeyResignationCertificate + , makeCommitteeHotKeyAuthorizationCertificate + , makeDrepRegistrationCertificate + , makeDrepUnregistrationCertificate + , makeDrepUpdateCertificate + , makeStakeAddressAndDRepDelegationCertificate + + -- * Anchor data + , AnchorDataFromCertificateError (..) + , getAnchorDataFromCertificate + + -- * Internal conversion functions + , toShelleyPoolParams + , fromShelleyPoolParams + + -- * Data family instances + , AsType (AsCertificate) + + -- * DRep and Stake Pool Ids + , Hash (..) + + -- * Operational Certificates + , OperationalCertificate (..) + , OperationalCertificateIssueCounter (..) + , KESPeriod (..) + , OperationalCertIssueError (..) + , getHotKey + , getKesPeriod + , getOpCertCount + , issueOperationalCertificate + + -- * DRep off-chain metadata + , DRepMetadata (..) + , hashDRepMetadata + + -- * Stake pool off-chain metadata + , StakePoolMetadata (..) + , validateAndHashStakePoolMetadata + , StakePoolMetadataValidationError (..) + ) +where + +import Cardano.Api.Certificate.Internal + ( PoolId + , StakePoolMetadataReference (..) + , StakePoolParameters (..) + , StakePoolRelay (..) + , fromShelleyPoolParams + , toShelleyPoolParams + ) +import Cardano.Api.Certificate.Internal.DRepMetadata +import Cardano.Api.Certificate.Internal.OperationalCertificate +import Cardano.Api.Certificate.Internal.StakePoolMetadata +import Cardano.Api.Experimental.Tx.Internal.Certificate diff --git a/cardano-api/src/Cardano/Api/Experimental/Era.hs b/cardano-api/src/Cardano/Api/Experimental/Era.hs index fc05d4debe..71eb35e377 100644 --- a/cardano-api/src/Cardano/Api/Experimental/Era.hs +++ b/cardano-api/src/Cardano/Api/Experimental/Era.hs @@ -310,7 +310,8 @@ type EraCommonConstraints era = , L.EraTxOut (LedgerEra era) , L.EraUTxO (LedgerEra era) , FromCBOR (ChainDepState (ConsensusProtocol era)) - , L.NativeScript (LedgerEra era) ~ L.Timelock (LedgerEra era) + , -- , FromCBOR (L.TxCert (LedgerEra era)) + L.NativeScript (LedgerEra era) ~ L.Timelock (LedgerEra era) , PraosProtocolSupportsNode (ConsensusProtocol era) , ShelleyLedgerEra era ~ LedgerEra era , ToJSON (ChainDepState (ConsensusProtocol era)) diff --git a/cardano-api/src/Cardano/Api/Experimental/Serialise/TextEnvelope.hs b/cardano-api/src/Cardano/Api/Experimental/Serialise/TextEnvelope.hs new file mode 100644 index 0000000000..7f20524f20 --- /dev/null +++ b/cardano-api/src/Cardano/Api/Experimental/Serialise/TextEnvelope.hs @@ -0,0 +1,6 @@ +module Cardano.Api.Experimental.Serialise.TextEnvelope + ( textEnvelopeToJSONEra + ) +where + +import Cardano.Api.Experimental.Serialise.TextEnvelope.Internal diff --git a/cardano-api/src/Cardano/Api/Experimental/Serialise/TextEnvelope/Internal.hs b/cardano-api/src/Cardano/Api/Experimental/Serialise/TextEnvelope/Internal.hs new file mode 100644 index 0000000000..787c5c742b --- /dev/null +++ b/cardano-api/src/Cardano/Api/Experimental/Serialise/TextEnvelope/Internal.hs @@ -0,0 +1,22 @@ +module Cardano.Api.Experimental.Serialise.TextEnvelope.Internal + ( textEnvelopeToJSONEra + ) +where + +import Cardano.Api.Experimental.Era +import Cardano.Api.Serialise.TextEnvelope.Internal + ( HasTextEnvelope + , TextEnvelopeDescr + , textEnvelopeToJSON + ) + +import Data.ByteString.Lazy qualified as LBS + +textEnvelopeToJSONEra + :: HasTextEnvelope (f (LedgerEra era)) + => Era era + -> Maybe TextEnvelopeDescr + -> f (LedgerEra era) + -> LBS.ByteString +textEnvelopeToJSONEra era mDesc c = + obtainCommonConstraints era $ textEnvelopeToJSON mDesc c diff --git a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs index 7ec62384d4..43f728eeb0 100644 --- a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs +++ b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate.hs @@ -1,73 +1,191 @@ +{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE InstanceSigs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module Cardano.Api.Experimental.Tx.Internal.Certificate ( Certificate (..) + + -- * Registering stake address and delegating + , makeStakeAddressDelegationCertificate + , makeStakeAddressRegistrationCertificate + , makeStakeAddressUnregistrationCertificate + + -- * Registering stake pools + , makeStakePoolRegistrationCertificate + , makeStakePoolRetirementCertificate + + -- * Governance related certificates + , makeCommitteeColdkeyResignationCertificate + , makeCommitteeHotKeyAuthorizationCertificate + , makeDrepRegistrationCertificate + , makeDrepUnregistrationCertificate + , makeDrepUpdateCertificate + , makeStakeAddressAndDRepDelegationCertificate + + -- * Anchor data , AnchorDataFromCertificateError (..) , getAnchorDataFromCertificate + + -- * Data family instances + , AsType (..) ) where +import Cardano.Api.Address import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra import Cardano.Api.Error import Cardano.Api.Experimental.Era +import Cardano.Api.Experimental.Tx.Internal.Certificate.Compatible (Delegatee) +import Cardano.Api.Experimental.Tx.Internal.Certificate.Type import Cardano.Api.HasTypeProxy -import Cardano.Api.Ledger qualified as L +import Cardano.Api.Hash qualified as Api +import Cardano.Api.Internal.Utils +import Cardano.Api.Key.Internal qualified as Api import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger import Cardano.Api.Pretty -import Cardano.Api.Serialise.Cbor import Cardano.Api.Serialise.TextEnvelope.Internal -import Cardano.Binary qualified as CBOR import Cardano.Ledger.BaseTypes (strictMaybe) -import Control.Monad.Error.Class +import Control.Monad.Except (MonadError (..)) import Data.ByteString (ByteString) -import Data.String -import Data.Typeable +import Data.String (IsString (fromString)) -data Certificate era where - Certificate :: L.EraTxCert era => L.TxCert era -> Certificate era +makeStakeAddressDelegationCertificate + :: forall era + . IsEra era + => StakeCredential + -> Delegatee era + -> Certificate (LedgerEra era) +makeStakeAddressDelegationCertificate sCred delegatee = + case useEra @era of + e@ConwayEra -> + obtainCommonConstraints e $ + Certificate $ + Ledger.mkDelegTxCert (toShelleyStakeCredential sCred) delegatee + e@DijkstraEra -> + obtainCommonConstraints e $ + Certificate $ + Ledger.mkDelegTxCert (toShelleyStakeCredential sCred) delegatee -deriving instance Show (Certificate era) +makeStakeAddressRegistrationCertificate + :: forall era. IsEra era => StakeCredential -> Ledger.Coin -> Certificate (LedgerEra era) +makeStakeAddressRegistrationCertificate scred deposit = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkRegDepositTxCert (toShelleyStakeCredential scred) deposit -deriving instance Eq (Certificate era) +makeStakeAddressUnregistrationCertificate + :: forall era. IsEra era => StakeCredential -> Ledger.Coin -> Certificate (LedgerEra era) +makeStakeAddressUnregistrationCertificate scred deposit = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkUnRegDepositTxCert (toShelleyStakeCredential scred) deposit -deriving instance Ord (Certificate era) +makeStakePoolRegistrationCertificate + :: forall era + . IsEra era + => Ledger.PoolParams + -> Certificate (LedgerEra era) +makeStakePoolRegistrationCertificate poolParams = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkRegPoolTxCert poolParams -instance - ( Typeable ledgerera - , IsShelleyBasedEra era - , ShelleyLedgerEra era ~ ledgerera - ) - => HasTextEnvelope (Certificate ledgerera) - where - textEnvelopeType _ = "Certificate" - -instance Typeable era => HasTypeProxy (Certificate era) where - data AsType (Certificate era) = AsCertificate - proxyToAsType _ = AsCertificate - -instance - ( Typeable ledgerera - , IsShelleyBasedEra era - , ShelleyLedgerEra era ~ ledgerera - ) - => SerialiseAsCBOR (Certificate ledgerera) - where - serialiseToCBOR (Certificate cert) = - CBOR.serialize' cert - deserialiseFromCBOR _ bs = - shelleyBasedEraConstraints (shelleyBasedEra @era) $ Certificate <$> CBOR.decodeFull' bs +makeStakePoolRetirementCertificate + :: forall era + . IsShelleyBasedEra era + => Api.Hash Api.StakePoolKey + -> Ledger.EpochNo + -> Certificate (ShelleyLedgerEra era) +makeStakePoolRetirementCertificate poolId retirementEpoch = + shelleyBasedEraConstraints (shelleyBasedEra @era) $ + Certificate $ + Ledger.mkRetirePoolTxCert (Api.unStakePoolKeyHash poolId) retirementEpoch + +makeCommitteeColdkeyResignationCertificate + :: forall era + . IsEra era + => Ledger.Credential Ledger.ColdCommitteeRole + -> Maybe Ledger.Anchor + -> Certificate (LedgerEra era) +makeCommitteeColdkeyResignationCertificate coldKeyCred anchor = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkResignCommitteeColdTxCert + coldKeyCred + (noInlineMaybeToStrictMaybe anchor) + +makeCommitteeHotKeyAuthorizationCertificate + :: forall era + . IsEra era + => Ledger.Credential Ledger.ColdCommitteeRole + -> Ledger.Credential Ledger.HotCommitteeRole + -> Certificate (LedgerEra era) +makeCommitteeHotKeyAuthorizationCertificate coldKeyCredential hotKeyCredential = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkAuthCommitteeHotKeyTxCert coldKeyCredential hotKeyCredential + +makeDrepRegistrationCertificate + :: forall era + . IsEra era + => Ledger.Credential Ledger.DRepRole + -> Ledger.Coin + -> Maybe Ledger.Anchor + -> Certificate (LedgerEra era) +makeDrepRegistrationCertificate vcred deposit anchor = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkRegDRepTxCert vcred deposit (noInlineMaybeToStrictMaybe anchor) + +makeDrepUnregistrationCertificate + :: forall era + . IsEra era + => Ledger.Credential Ledger.DRepRole + -> Ledger.Coin + -> Certificate (LedgerEra era) +makeDrepUnregistrationCertificate vcred deposit = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkUnRegDRepTxCert + vcred + deposit + +makeDrepUpdateCertificate + :: forall era + . IsEra era + => Ledger.Credential Ledger.DRepRole + -> Maybe Ledger.Anchor + -> Certificate (LedgerEra era) +makeDrepUpdateCertificate vcred mAnchor = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkUpdateDRepTxCert vcred (noInlineMaybeToStrictMaybe mAnchor) + +makeStakeAddressAndDRepDelegationCertificate + :: forall era + . IsEra era + => StakeCredential + -> Ledger.Delegatee + -> Ledger.Coin + -> Certificate (LedgerEra era) +makeStakeAddressAndDRepDelegationCertificate cred delegatee deposit = + obtainCommonConstraints (useEra @era) $ + Certificate $ + Ledger.mkRegDepositDelegTxCert + (toShelleyStakeCredential cred) + delegatee + deposit + +-- ------------------------------------- getAnchorDataFromCertificate :: Era era diff --git a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Compatible.hs b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Compatible.hs new file mode 100644 index 0000000000..ab1b1b4920 --- /dev/null +++ b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Compatible.hs @@ -0,0 +1,203 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} + +module Cardano.Api.Experimental.Tx.Internal.Certificate.Compatible + ( Delegatee + + -- * Registering stake address and delegating + , makeStakeAddressDelegationCertificate + , makeStakeAddressRegistrationCertificate + , makeStakeAddressUnregistrationCertificate + , StakeCredentialAndDeposit (..) + , StakeRegistrationRequirements + + -- * Registering stake pools + , makeStakePoolRegistrationCertificate + , makeStakePoolRetirementCertificate + + -- * Special certificates + , makeMIRCertificate + , makeGenesisKeyDelegationCertificate + , Ledger.MIRTarget (..) + , Ledger.MIRPot (..) + , selectStakeCredentialWitness + + -- * Internal + , getTxCertWitness + ) +where + +import Cardano.Api.Address +import Cardano.Api.Era.Internal.Core +import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra +import Cardano.Api.Experimental.Tx.Internal.Certificate.Type +import Cardano.Api.Hash qualified as Api +import Cardano.Api.Key.Internal qualified as Api +import Cardano.Api.Key.Internal.Praos qualified as Api +import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger +import Cardano.Api.Plutus.Internal.Script + +import Cardano.Ledger.Keys qualified as Ledger + +type family Delegatee era where + Delegatee DijkstraEra = Ledger.Delegatee + Delegatee ConwayEra = Ledger.Delegatee + Delegatee BabbageEra = Api.Hash Api.StakePoolKey + Delegatee AlonzoEra = Api.Hash Api.StakePoolKey + Delegatee MaryEra = Api.Hash Api.StakePoolKey + Delegatee AllegraEra = Api.Hash Api.StakePoolKey + Delegatee ShelleyEra = Api.Hash Api.StakePoolKey + +makeStakeAddressDelegationCertificate + :: forall era + . IsShelleyBasedEra era + => StakeCredential + -> Delegatee era + -> Certificate (ShelleyLedgerEra era) +makeStakeAddressDelegationCertificate sCred delegatee = + case shelleyBasedEra @era of + ShelleyBasedEraConway -> + Certificate $ + Ledger.mkDelegTxCert (toShelleyStakeCredential sCred) delegatee + e@ShelleyBasedEraBabbage -> cert e delegatee + e@ShelleyBasedEraAlonzo -> cert e delegatee + e@ShelleyBasedEraMary -> cert e delegatee + e@ShelleyBasedEraAllegra -> cert e delegatee + e@ShelleyBasedEraShelley -> cert e delegatee + ShelleyBasedEraDijkstra -> error "TODO: makeStakeAddressDelegationCertificate DijkstraEra" + where + cert + :: Delegatee era ~ Api.Hash Api.StakePoolKey + => ShelleyBasedEra era -> Delegatee era -> Certificate (ShelleyLedgerEra era) + cert e delegatee' = + shelleyBasedEraConstraints e $ + Certificate $ + Ledger.mkDelegStakeTxCert (toShelleyStakeCredential sCred) (Api.unStakePoolKeyHash delegatee') + +data StakeCredentialAndDeposit = StakeCredentialAndDeposit StakeCredential Ledger.Coin + +type family StakeRegistrationRequirements era where + StakeRegistrationRequirements DijkstraEra = StakeCredentialAndDeposit + StakeRegistrationRequirements ConwayEra = StakeCredentialAndDeposit + StakeRegistrationRequirements BabbageEra = StakeCredential + StakeRegistrationRequirements AlonzoEra = StakeCredential + StakeRegistrationRequirements MaryEra = StakeCredential + StakeRegistrationRequirements AllegraEra = StakeCredential + StakeRegistrationRequirements ShelleyEra = StakeCredential + +makeStakeAddressRegistrationCertificate + :: forall era + . IsShelleyBasedEra era + => StakeRegistrationRequirements era + -> Certificate (ShelleyLedgerEra era) +makeStakeAddressRegistrationCertificate scred = + case shelleyBasedEra @era of + ShelleyBasedEraDijkstra -> + createRegCertWithDeposit scred + ShelleyBasedEraConway -> + createRegCertWithDeposit scred + ShelleyBasedEraBabbage -> + createRegCertNoDeposit scred + ShelleyBasedEraAlonzo -> + createRegCertNoDeposit scred + ShelleyBasedEraMary -> + createRegCertNoDeposit scred + ShelleyBasedEraAllegra -> + createRegCertNoDeposit scred + ShelleyBasedEraShelley -> + createRegCertNoDeposit scred + where + createRegCertWithDeposit stakeCredWithDeposit = + let StakeCredentialAndDeposit cred dep = stakeCredWithDeposit + in Certificate $ + Ledger.mkRegDepositTxCert (toShelleyStakeCredential cred) dep + createRegCertNoDeposit stakeCredential = + Certificate $ + Ledger.mkRegTxCert $ + toShelleyStakeCredential stakeCredential + +makeStakeAddressUnregistrationCertificate + :: forall era + . IsShelleyBasedEra era + => StakeCredential -> Certificate (ShelleyLedgerEra era) +makeStakeAddressUnregistrationCertificate scred = + shelleyBasedEraConstraints (shelleyBasedEra @era) $ + Certificate $ + Ledger.mkUnRegTxCert $ + toShelleyStakeCredential scred + +makeStakePoolRegistrationCertificate + :: forall era + . IsShelleyBasedEra era + => Ledger.PoolParams + -> Certificate (ShelleyLedgerEra era) +makeStakePoolRegistrationCertificate poolParams = + shelleyBasedEraConstraints (shelleyBasedEra @era) $ + Certificate $ + Ledger.mkRegPoolTxCert poolParams + +makeStakePoolRetirementCertificate + :: forall era + . IsShelleyBasedEra era + => Api.Hash Api.StakePoolKey + -> Ledger.EpochNo + -> Certificate (ShelleyLedgerEra era) +makeStakePoolRetirementCertificate poolId retirementEpoch = + shelleyBasedEraConstraints (shelleyBasedEra @era) $ + Certificate $ + Ledger.mkRetirePoolTxCert (Api.unStakePoolKeyHash poolId) retirementEpoch + +-- This is only used by QA and only exists up until the Babbage era. +-- The serialization does not change from Shelley -> Babbage therefore +-- we hardcode the Babbage era here to simplify the type signature. +makeMIRCertificate + :: Ledger.MIRPot + -> Ledger.MIRTarget + -> Certificate (ShelleyLedgerEra BabbageEra) +makeMIRCertificate mirPot mirTarget = + Certificate $ + Ledger.ShelleyTxCertMir $ + Ledger.MIRCert mirPot mirTarget + +-- This is only used by QA and only exists up until the Babbage era. +-- The serialization does not change from Shelley -> Babbage therefore +-- we hardcode the Babbage era here to simplify the type signature. +makeGenesisKeyDelegationCertificate + :: Api.Hash Api.GenesisKey + -> Api.Hash Api.GenesisDelegateKey + -> Api.Hash Api.VrfKey + -> Certificate (ShelleyLedgerEra BabbageEra) +makeGenesisKeyDelegationCertificate + (Api.GenesisKeyHash hGenKey) + (Api.GenesisDelegateKeyHash hGenDelegKey) + (Api.VrfKeyHash hVrfKey) = + Certificate $ + Ledger.mkGenesisDelegTxCert $ + Ledger.GenesisDelegCert hGenKey hGenDelegKey (Ledger.toVRFVerKeyHash hVrfKey) + +-- | Get the stake credential witness for a certificate that requires it. +-- Only stake address deregistration and delegation requires witnessing (witness can be script or key). +selectStakeCredentialWitness + :: IsShelleyBasedEra era + => Certificate (ShelleyLedgerEra era) + -> Maybe StakeCredential +selectStakeCredentialWitness (Certificate cert) = + getTxCertWitness shelleyBasedEra cert + +getTxCertWitness + :: ShelleyBasedEra era + -> Ledger.TxCert (ShelleyLedgerEra era) + -> Maybe StakeCredential +getTxCertWitness sbe ledgerCert = shelleyBasedEraConstraints sbe $ + case Ledger.getVKeyWitnessTxCert ledgerCert of + Just keyHash -> Just $ StakeCredentialByKey $ Api.StakeKeyHash $ Ledger.coerceKeyRole keyHash + Nothing -> + StakeCredentialByScript . fromShelleyScriptHash + <$> Ledger.getScriptWitnessTxCert ledgerCert diff --git a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Type.hs b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Type.hs new file mode 100644 index 0000000000..38c85e8993 --- /dev/null +++ b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Certificate/Type.hs @@ -0,0 +1,55 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} + +module Cardano.Api.Experimental.Tx.Internal.Certificate.Type + ( Certificate (..) + , AsType (AsCertificate) + ) +where + +import Cardano.Api.HasTypeProxy +import Cardano.Api.Ledger qualified as L +import Cardano.Api.Serialise.Cbor +import Cardano.Api.Serialise.TextEnvelope.Internal + +import Cardano.Binary qualified as CBOR + +import Data.Typeable + +data Certificate era where + Certificate :: L.EraTxCert era => L.TxCert era -> Certificate era + +deriving instance Show (Certificate era) + +deriving instance Eq (Certificate era) + +deriving instance Ord (Certificate era) + +instance + ( Typeable ledgerera + , L.EraTxCert ledgerera + ) + => HasTextEnvelope (Certificate ledgerera) + where + textEnvelopeType _ = "Certificate" + +instance Typeable era => HasTypeProxy (Certificate era) where + data AsType (Certificate era) = AsCertificate + proxyToAsType _ = AsCertificate + +instance + ( Typeable ledgerera + , L.EraTxCert ledgerera + ) + => SerialiseAsCBOR (Certificate ledgerera) + where + serialiseToCBOR (Certificate cert) = + CBOR.serialize' cert + deserialiseFromCBOR _ bs = + Certificate <$> CBOR.decodeFull' bs diff --git a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Compatible.hs b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Compatible.hs index 497811fda5..c6e248828d 100644 --- a/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Compatible.hs +++ b/cardano-api/src/Cardano/Api/Experimental/Tx/Internal/Compatible.hs @@ -9,7 +9,6 @@ module Cardano.Api.Experimental.Tx.Internal.Compatible where import Cardano.Api.Address qualified as Api -import Cardano.Api.Certificate.Internal qualified as Api import Cardano.Api.Era.Internal.Eon.Convert import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra import Cardano.Api.Experimental.Era @@ -18,6 +17,7 @@ import Cardano.Api.Experimental.Plutus.Internal.ScriptWitness qualified as Exp import Cardano.Api.Experimental.Simple.Script qualified as Exp import Cardano.Api.Experimental.Tx.Internal.AnyWitness import Cardano.Api.Experimental.Tx.Internal.Certificate qualified as Exp +import Cardano.Api.Experimental.Tx.Internal.Certificate.Compatible qualified as Api import Cardano.Api.Ledger.Internal.Reexport qualified as L import Cardano.Api.Plutus.Internal.Script (fromAllegraTimelock, sbeToSimpleScriptLanguageInEra) import Cardano.Api.Plutus.Internal.Script qualified as Api diff --git a/cardano-api/src/Cardano/Api/Serialise/TextEnvelope/Internal.hs b/cardano-api/src/Cardano/Api/Serialise/TextEnvelope/Internal.hs index 3cad1945a7..f63dc39231 100644 --- a/cardano-api/src/Cardano/Api/Serialise/TextEnvelope/Internal.hs +++ b/cardano-api/src/Cardano/Api/Serialise/TextEnvelope/Internal.hs @@ -186,6 +186,7 @@ legacyComparison (TextEnvelopeType expectedType) (TextEnvelopeType actualType) = ("Tx BabbageEra", "Unwitnessed Tx BabbageEra") -> True ("Tx ConwayEra", "Unwitnessed Tx ConwayEra") -> True ("Certificate", "CertificateConway") -> True + ("Certificate", "CertificateShelley") -> True (expectedOther, expectedActual) -> expectedOther == expectedActual -- ---------------------------------------------------------------------------- diff --git a/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs b/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs index 7dcc5e4e5b..8d89606ec7 100644 --- a/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs +++ b/cardano-api/src/Cardano/Api/Tx/Internal/Body.hs @@ -233,7 +233,6 @@ where import Cardano.Api.Address import Cardano.Api.Byron.Internal.Key import Cardano.Api.Certificate -import Cardano.Api.Certificate.Internal import Cardano.Api.Era.Internal.Case import Cardano.Api.Era.Internal.Core import Cardano.Api.Era.Internal.Eon.AllegraEraOnwards @@ -253,6 +252,7 @@ import Cardano.Api.Experimental.Plutus.Internal.IndexedPlutusScriptWitness ) import Cardano.Api.Experimental.Plutus.Internal.Shim.LegacyScripts import Cardano.Api.Experimental.Tx.Internal.Certificate qualified as Exp +import Cardano.Api.Experimental.Tx.Internal.Certificate.Compatible (getTxCertWitness) import Cardano.Api.Experimental.Tx.Internal.TxScriptWitnessRequirements import Cardano.Api.Governance.Internal.Action.ProposalProcedure import Cardano.Api.Governance.Internal.Action.VotingProcedure