{-# OPTIONS_GHC -Wno-orphans #-}
module Cardano.Api.Serialise.Raw
( module Cardano.Keys.Serialise.Raw
, parseRawBytesHex
)
where
import Cardano.Api.Error (Error (..), failEitherError)
import Cardano.Api.Parser.Text qualified as P
import Cardano.Keys.Serialise.Raw
import Data.ByteString.Char8 qualified as BSC
parseRawBytesHex :: SerialiseAsRawBytes a => P.Parser a
parseRawBytesHex :: forall a. SerialiseAsRawBytes a => Parser a
parseRawBytesHex = do
input <- ParsecT Text () Identity Char -> ParsecT Text () Identity [Char]
forall a.
ParsecT Text () Identity a -> ParsecT Text () Identity [a]
forall (f :: * -> *) a. Alternative f => f a -> f [a]
P.many ParsecT Text () Identity Char
forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
P.hexDigit
failEitherError . deserialiseFromRawBytesHex $ BSC.pack input
instance Error RawBytesHexError where
prettyError :: forall ann. RawBytesHexError -> Doc ann
prettyError = RawBytesHexError -> Doc ann
forall ann. RawBytesHexError -> Doc ann
renderRawBytesHexError
instance Error SerialiseAsRawBytesError where
prettyError :: forall ann. SerialiseAsRawBytesError -> Doc ann
prettyError = SerialiseAsRawBytesError -> Doc ann
forall ann. SerialiseAsRawBytesError -> Doc ann
renderSerialiseAsRawBytesError