diff --git a/cardano-api/src/Cardano/Api/Orphans.hs b/cardano-api/src/Cardano/Api/Orphans.hs index e8f9f8b5e6a..9e823279e8f 100644 --- a/cardano-api/src/Cardano/Api/Orphans.hs +++ b/cardano-api/src/Cardano/Api/Orphans.hs @@ -6,7 +6,6 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TypeApplications #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} @@ -40,6 +39,7 @@ import Cardano.Ledger.UnifiedMap (UnifiedMap) import Cardano.Slotting.Slot (SlotNo (..)) import Cardano.Slotting.Time (SystemStart (..)) +import qualified Cardano.Binary as CBOR import qualified Cardano.Crypto.Hash.Class as Crypto import qualified Cardano.Ledger.Alonzo.Data as Alonzo import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo @@ -61,7 +61,6 @@ import qualified Cardano.Ledger.Shelley.Rewards as Shelley import qualified Ouroboros.Consensus.Shelley.Eras as Consensus import Cardano.Api.Script -import Cardano.Api.SerialiseRaw (serialiseToRawBytesHexText) -- Orphan instances involved in the JSON output of the API queries. -- We will remove/replace these as we provide more API wrapper types @@ -241,11 +240,10 @@ instance ( Ledger.Era era SNothing -> Aeson.Null SJust dH -> toJSON $ ScriptDataHash dH -instance ToJSON (Alonzo.Script (Babbage.BabbageEra Consensus.StandardCrypto)) where - toJSON s = Aeson.String . serialiseToRawBytesHexText - $ ScriptHash $ Ledger.hashScript @(Babbage.BabbageEra Consensus.StandardCrypto) s +instance ToJSON (Alonzo.Script (Babbage.BabbageEra Consensus.StandardCrypto)) where + toJSON = Aeson.String . Text.decodeUtf8 . B16.encode . CBOR.serialize' instance Crypto.Crypto crypto => ToJSON (Shelley.DPState crypto) where toJSON dpState = object [ "dstate" .= Shelley.dpsDState dpState