Skip to content

Commit

Permalink
Merge pull request #116 from input-output-hk/newhoggy/use-AnyShelleyT…
Browse files Browse the repository at this point in the history
…oBabbageEra-from-cardano-api-instead

Use AnyShelleyToBabbageEra from cardano-api instead
  • Loading branch information
newhoggy committed Jul 28, 2023
2 parents 8f1d335 + 829bc78 commit 04dd980
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
10 changes: 4 additions & 6 deletions cardano-cli/src/Cardano/CLI/Run/Legacy/StakeAddress.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import Cardano.Api.Shelley

import Cardano.CLI.EraBased.Legacy
import Cardano.CLI.Run.Legacy.Read
import Cardano.CLI.Types.Governance
import Cardano.CLI.Types.Key (DelegationTarget (..), StakeIdentifier (..),
StakeVerifier (..), VerificationKeyOrFile, readVerificationKeyOrFile,
readVerificationKeyOrHashOrFile)
Expand Down Expand Up @@ -237,20 +236,19 @@ createDelegationCertRequirements sbe stakeCred delegatee =
return $ StakeDelegationRequirementsConwayOnwards ConwayEraOnwardsConway stakeCred delegatee

onlySpoDelegatee
:: IsShelleyBasedEra era
=> ShelleyToBabbageEra era
:: ShelleyToBabbageEra era
-> Ledger.Delegatee (Ledger.EraCrypto (ShelleyLedgerEra era))
-> Either StakeAddressDelegationError PoolId
onlySpoDelegatee w ledgerDelegatee =
case ledgerDelegatee of
Ledger.DelegStake stakePoolKeyHash ->
Right $ StakePoolKeyHash $ shelleyToBabbageEraConstraints w stakePoolKeyHash
Ledger.DelegVote{} ->
Left . VoteDelegationNotSupported $ AnyAtMostBabbageEra w
Left . VoteDelegationNotSupported $ AnyShelleyToBabbageEra w
Ledger.DelegStakeVote{} ->
Left . VoteDelegationNotSupported $ AnyAtMostBabbageEra w
Left . VoteDelegationNotSupported $ AnyShelleyToBabbageEra w

newtype StakeAddressDelegationError = VoteDelegationNotSupported AnyAtMostBabbageEra deriving Show
newtype StakeAddressDelegationError = VoteDelegationNotSupported AnyShelleyToBabbageEra deriving Show

runStakeCredentialDeRegistrationCert
:: AnyShelleyBasedEra
Expand Down
7 changes: 0 additions & 7 deletions cardano-cli/src/Cardano/CLI/Types/Governance.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}

module Cardano.CLI.Types.Governance where

Expand Down Expand Up @@ -44,9 +43,3 @@ data VType = VCC -- committee
| VDR -- drep
| VSP -- spo
deriving Show


data AnyAtMostBabbageEra where
AnyAtMostBabbageEra :: IsShelleyBasedEra era => ShelleyToBabbageEra era -> AnyAtMostBabbageEra

deriving instance Show AnyAtMostBabbageEra

0 comments on commit 04dd980

Please sign in to comment.