@@ -24,13 +24,15 @@ import Cardano.Ledger.Binary (
2424 DecShareCBOR (.. ),
2525 EncCBOR (.. ),
2626 Interns ,
27+ TokenType (.. ),
28+ peekTokenType ,
2729 )
2830import Cardano.Ledger.Coin (Coin (.. ), CompactForm (.. ))
2931import Cardano.Ledger.Conway.Era
3032import Cardano.Ledger.Conway.TxOut ()
3133import Cardano.Ledger.Core
3234import Cardano.Ledger.Credential
33- import Cardano.Ledger.State
35+ import Cardano.Ledger.Shelley. State
3436import qualified Cardano.Ledger.UMap as UM
3537import Control.DeepSeq (NFData )
3638import Data.Aeson (KeyValue , ToJSON (.. ), object , pairs , (.=) )
@@ -50,7 +52,15 @@ newtype ConwayInstantStake era = ConwayInstantStake
5052
5153instance DecShareCBOR (ConwayInstantStake era ) where
5254 type Share (ConwayInstantStake era ) = Interns (Credential 'Staking)
53- decShareCBOR credInterns = ConwayInstantStake <$> decShareCBOR (credInterns, mempty )
55+ decShareCBOR credInterns = do
56+ peekTokenType >>= \ case
57+ TypeListLen -> toConwayInstantStake <$> decShareCBOR credInterns
58+ TypeListLen64 -> toConwayInstantStake <$> decShareCBOR credInterns
59+ TypeListLenIndef -> toConwayInstantStake <$> decShareCBOR credInterns
60+ _ -> ConwayInstantStake <$> decShareCBOR (credInterns, mempty )
61+ where
62+ toConwayInstantStake :: ShelleyInstantStake era -> ConwayInstantStake era
63+ toConwayInstantStake = ConwayInstantStake . sisCredentialStake
5464
5565instance Semigroup (ConwayInstantStake era ) where
5666 ConwayInstantStake cs1 <> ConwayInstantStake cs2 =
0 commit comments