Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.Serialise.TextEnvelope
Synopsis
- class SerialiseAsCBOR a => HasTextEnvelope a where
- textEnvelopeTypeInEra :: HasTextEnvelope (f era) => CardanoEra era -> AsType (f era) -> TextEnvelopeType
- data TextEnvelope = TextEnvelope {}
- newtype TextEnvelopeType = TextEnvelopeType String
- newtype TextEnvelopeDescr = TextEnvelopeDescr String
- textEnvelopeRawCBOR :: TextEnvelope -> ByteString
- data TextEnvelopeError
- serialiseToTextEnvelope :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> TextEnvelope
- deserialiseFromTextEnvelope :: HasTextEnvelope a => TextEnvelope -> Either TextEnvelopeError a
- readFileTextEnvelope :: HasTextEnvelope a => File content 'In -> IO (Either (FileError TextEnvelopeError) a)
- writeFileTextEnvelope :: HasTextEnvelope a => File content 'Out -> Maybe TextEnvelopeDescr -> a -> IO (Either (FileError ()) ())
- readTextEnvelopeFromFile :: FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope)
- readTextEnvelopeOfTypeFromFile :: TextEnvelopeType -> FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope)
- textEnvelopeToJSON :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> ByteString
- serialiseTextEnvelope :: TextEnvelope -> ByteString
- legacyComparison :: TextEnvelopeType -> TextEnvelopeType -> Bool
- data FromSomeType (c :: Type -> Constraint) b where
- FromSomeType :: forall (c :: Type -> Constraint) a b. c a => AsType a -> (a -> b) -> FromSomeType c b
- deserialiseFromTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> TextEnvelope -> Either TextEnvelopeError b
- readFileTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> File content 'In -> IO (Either (FileError TextEnvelopeError) b)
- data family AsType t
- data TextEnvelopeCddlError
- data FromSomeTypeCDDL c b where
- FromCDDLTx :: forall b. Text -> (InAnyShelleyBasedEra Tx -> b) -> FromSomeTypeCDDL TextEnvelope b
- FromCDDLWitness :: forall b. Text -> (InAnyShelleyBasedEra KeyWitness -> b) -> FromSomeTypeCDDL TextEnvelope b
- cddlTypeToEra :: Text -> Either TextEnvelopeCddlError AnyShelleyBasedEra
- readFileTextEnvelopeCddlAnyOf :: [FromSomeTypeCDDL TextEnvelope b] -> FilePath -> IO (Either (FileError TextEnvelopeCddlError) b)
- deserialiseFromTextEnvelopeCddlAnyOf :: [FromSomeTypeCDDL TextEnvelope b] -> TextEnvelope -> Either TextEnvelopeCddlError b
- writeTxFileTextEnvelopeCddl :: ShelleyBasedEra era -> File content 'Out -> Tx era -> IO (Either (FileError ()) ())
- writeTxFileTextEnvelopeCanonicalCddl :: ShelleyBasedEra era -> File content 'Out -> Tx era -> IO (Either (FileError ()) ())
- writeTxWitnessFileTextEnvelopeCddl :: ShelleyBasedEra era -> File () 'Out -> KeyWitness era -> IO (Either (FileError ()) ())
- deserialiseByronTxCddl :: TextEnvelope -> Either TextEnvelopeCddlError (ATxAux ByteString)
- serialiseWitnessLedgerCddl :: ShelleyBasedEra era -> KeyWitness era -> TextEnvelope
- deserialiseWitnessLedgerCddl :: ShelleyBasedEra era -> TextEnvelope -> Either TextEnvelopeCddlError (KeyWitness era)
- serializeByronTx :: ATxAux ByteString -> TextEnvelope
- writeByronTxFileTextEnvelopeCddl :: File content 'Out -> ATxAux ByteString -> IO (Either (FileError ()) ())
TextEnvelope Serialisation
class SerialiseAsCBOR a => HasTextEnvelope a where Source #
Minimal complete definition
Methods
textEnvelopeType :: AsType a -> TextEnvelopeType Source #
Instances
textEnvelopeTypeInEra :: HasTextEnvelope (f era) => CardanoEra era -> AsType (f era) -> TextEnvelopeType Source #
data TextEnvelope Source #
A TextEnvelope
is a structured envelope for serialised binary values
with an external format with a semi-readable textual format.
It contains a "type" field, e.g. "PublicKeyByron" or "TxSignedShelley" to indicate the type of the encoded data. This is used as a sanity check and to help readers.
It also contains a "title" field which is free-form, and could be used to indicate the role or purpose to a reader.
Constructors
TextEnvelope | |
Fields |
Instances
FromJSON TextEnvelope Source # | |||||
Defined in Cardano.Api.Serialise.TextEnvelope.Internal | |||||
ToJSON TextEnvelope Source # | |||||
Defined in Cardano.Api.Serialise.TextEnvelope.Internal Methods toJSON :: TextEnvelope -> Value # toEncoding :: TextEnvelope -> Encoding # toJSONList :: [TextEnvelope] -> Value # toEncodingList :: [TextEnvelope] -> Encoding # omitField :: TextEnvelope -> Bool # | |||||
Show TextEnvelope Source # | |||||
Defined in Cardano.Api.Serialise.TextEnvelope.Internal | |||||
HasTypeProxy TextEnvelope Source # | |||||
Defined in Cardano.Api.Serialise.TextEnvelope.Internal Associated Types
Methods proxyToAsType :: Proxy TextEnvelope -> AsType TextEnvelope Source # | |||||
Eq TextEnvelope Source # | |||||
Defined in Cardano.Api.Serialise.TextEnvelope.Internal Methods (==) :: TextEnvelope -> TextEnvelope -> Bool Source # (/=) :: TextEnvelope -> TextEnvelope -> Bool Source # | |||||
data AsType TextEnvelope Source # | |||||
Defined in Cardano.Api.Serialise.TextEnvelope.Internal |
newtype TextEnvelopeType Source #
Constructors
TextEnvelopeType String |
Instances
newtype TextEnvelopeDescr Source #
Constructors
TextEnvelopeDescr String |
Instances
data TextEnvelopeError Source #
The errors that the pure TextEnvelope
parsing/decoding functions can return.
Constructors
TextEnvelopeTypeError ![TextEnvelopeType] !TextEnvelopeType | expected, actual |
TextEnvelopeDecodeError !DecoderError | |
TextEnvelopeAesonDecodeError !String |
Instances
serialiseToTextEnvelope :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> TextEnvelope Source #
deserialiseFromTextEnvelope :: HasTextEnvelope a => TextEnvelope -> Either TextEnvelopeError a Source #
readFileTextEnvelope :: HasTextEnvelope a => File content 'In -> IO (Either (FileError TextEnvelopeError) a) Source #
writeFileTextEnvelope :: HasTextEnvelope a => File content 'Out -> Maybe TextEnvelopeDescr -> a -> IO (Either (FileError ()) ()) Source #
readTextEnvelopeFromFile :: FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope) Source #
readTextEnvelopeOfTypeFromFile :: TextEnvelopeType -> FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope) Source #
textEnvelopeToJSON :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> ByteString Source #
serialiseTextEnvelope :: TextEnvelope -> ByteString Source #
Serialise text envelope to pretty JSON
legacyComparison :: TextEnvelopeType -> TextEnvelopeType -> Bool Source #
This is a backwards-compatibility patch to ensure that old envelopes
generated by serialiseTxLedgerCddl
can be deserialised after switching
to the serialiseToTextEnvelope
.
Reading one of several key types
data FromSomeType (c :: Type -> Constraint) b where Source #
Constructors
FromSomeType :: forall (c :: Type -> Constraint) a b. c a => AsType a -> (a -> b) -> FromSomeType c b |
deserialiseFromTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> TextEnvelope -> Either TextEnvelopeError b Source #
readFileTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> File content 'In -> IO (Either (FileError TextEnvelopeError) b) Source #
Data family instances
A family of singleton types used in this API to indicate which type to use where it would otherwise be ambiguous or merely unclear.
Values of this type are passed to deserialisation functions for example.
Instances
CDDL Serialisation
data TextEnvelopeCddlError Source #
Constructors
Instances
data FromSomeTypeCDDL c b where Source #
This GADT allows us to deserialise a tx or key witness without having to provide the era.
Constructors
FromCDDLTx | |
Fields
| |
FromCDDLWitness | |
Fields
|
Reading one of several transaction or key witness types
readFileTextEnvelopeCddlAnyOf :: [FromSomeTypeCDDL TextEnvelope b] -> FilePath -> IO (Either (FileError TextEnvelopeCddlError) b) Source #
deserialiseFromTextEnvelopeCddlAnyOf :: [FromSomeTypeCDDL TextEnvelope b] -> TextEnvelope -> Either TextEnvelopeCddlError b Source #
writeTxFileTextEnvelopeCddl :: ShelleyBasedEra era -> File content 'Out -> Tx era -> IO (Either (FileError ()) ()) Source #
writeTxFileTextEnvelopeCanonicalCddl :: ShelleyBasedEra era -> File content 'Out -> Tx era -> IO (Either (FileError ()) ()) Source #
Write transaction in the text envelope format. The CBOR will be in canonical format according to RFC 7049. It is also a requirement of CIP-21, which is not fully implemented.
writeTxWitnessFileTextEnvelopeCddl :: ShelleyBasedEra era -> File () 'Out -> KeyWitness era -> IO (Either (FileError ()) ()) Source #
serialiseWitnessLedgerCddl :: ShelleyBasedEra era -> KeyWitness era -> TextEnvelope Source #
deserialiseWitnessLedgerCddl :: ShelleyBasedEra era -> TextEnvelope -> Either TextEnvelopeCddlError (KeyWitness era) Source #
Byron tx serialization
writeByronTxFileTextEnvelopeCddl :: File content 'Out -> ATxAux ByteString -> IO (Either (FileError ()) ()) Source #