66{-# LANGUAGE GADTs #-}
77{-# LANGUAGE GeneralizedNewtypeDeriving #-}
88{-# LANGUAGE InstanceSigs #-}
9- {-# LANGUAGE LambdaCase #-}
109{-# LANGUAGE MultiParamTypeClasses #-}
1110{-# LANGUAGE RankNTypes #-}
1211{-# LANGUAGE ScopedTypeVariables #-}
@@ -61,7 +60,6 @@ import Cardano.Api.Internal.SerialiseRaw
6160import Cardano.Api.Internal.SerialiseTextEnvelope
6261import Cardano.Api.Internal.SerialiseUsing
6362
64- import Cardano.Binary (DecoderError (DecoderErrorUnknownTag ), cborError )
6563import Cardano.Crypto.DSIGN.Class qualified as Crypto
6664import Cardano.Crypto.Hash.Class qualified as Crypto
6765import Cardano.Crypto.Seed qualified as Crypto
@@ -70,8 +68,6 @@ import Cardano.Ledger.Crypto (StandardCrypto)
7068import Cardano.Ledger.Crypto qualified as Shelley (DSIGN )
7169import Cardano.Ledger.Keys qualified as Shelley
7270
73- import Codec.CBOR.Decoding (Decoder , TokenType (TypeListLen ), decodeListLenOf , peekTokenType )
74- import Codec.CBOR.Encoding (Encoding , encodeListLen )
7571import Data.Aeson.Types
7672 ( ToJSONKey (.. )
7773 , toJSONKeyText
@@ -83,7 +79,6 @@ import Data.ByteString qualified as BS
8379import Data.Either.Combinators (maybeToRight )
8480import Data.Maybe
8581import Data.String (IsString (.. ))
86- import Data.Word (Word8 )
8782
8883--
8984-- Shelley payment keys
@@ -1681,27 +1676,6 @@ data AnyStakePoolVerificationKey
16811676 | AnyStakePoolExtendedVerificationKey (VerificationKey StakePoolExtendedKey )
16821677 deriving (Show , Eq )
16831678
1684- instance ToCBOR AnyStakePoolVerificationKey where
1685- toCBOR :: AnyStakePoolVerificationKey -> Encoding
1686- toCBOR (AnyStakePoolNormalVerificationKey vk) =
1687- encodeListLen 2 <> toCBOR (0 :: Word8 ) <> toCBOR vk
1688- toCBOR (AnyStakePoolExtendedVerificationKey vk) =
1689- encodeListLen 2 <> toCBOR (1 :: Word8 ) <> toCBOR vk
1690-
1691- instance FromCBOR AnyStakePoolVerificationKey where
1692- fromCBOR :: Decoder s AnyStakePoolVerificationKey
1693- fromCBOR =
1694- peekTokenType >>= \ case
1695- TypeListLen ->
1696- decodeListLenOf 2 >> do
1697- tag <- fromCBOR
1698- case tag of
1699- 0 -> AnyStakePoolNormalVerificationKey <$> fromCBOR
1700- 1 -> AnyStakePoolExtendedVerificationKey <$> fromCBOR
1701- _ -> cborError $ DecoderErrorUnknownTag " AnyStakePoolVerificationKey" tag
1702- -- This case is for backwards compatibility (with CBOR encoding that doesn't support extended keys)
1703- _ -> AnyStakePoolNormalVerificationKey <$> fromCBOR
1704-
17051679anyStakePoolVerificationKeyHash :: AnyStakePoolVerificationKey -> Hash StakePoolKey
17061680anyStakePoolVerificationKeyHash (AnyStakePoolNormalVerificationKey vk) = verificationKeyHash vk
17071681anyStakePoolVerificationKeyHash (AnyStakePoolExtendedVerificationKey vk) =
0 commit comments