Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Data era where
- getPlutusData ∷ Data era → Data
- type DataHash = SafeHash EraIndependentData
- hashData ∷ Data era → DataHash
- data Datum era
- = NoDatum
- | DatumHash !DataHash
- | Datum !(BinaryData era)
- datumDataHash ∷ Datum era → StrictMaybe DataHash
- data BinaryData era
- makeBinaryData ∷ Era era ⇒ ShortByteString → Either String (BinaryData era)
- hashBinaryData ∷ BinaryData era → DataHash
- binaryDataToData ∷ Era era ⇒ BinaryData era → Data era
- dataToBinaryData ∷ Era era ⇒ Data era → BinaryData era
Plutus Data
Instances
getPlutusData ∷ Data era → Data Source #
type DataHash = SafeHash EraIndependentData Source #
Inline Datum
Datum can be described by a either a data hash or binary data, but not both. It can also be neither one of them.
NoDatum | |
DatumHash !DataHash | |
Datum !(BinaryData era) |
Instances
Era era ⇒ ToJSON (Datum era) | |
Generic (Datum era) | |
Show (Datum era) | |
Era era ⇒ DecCBOR (Datum era) | |
Era era ⇒ EncCBOR (Datum era) | |
Eq (Datum era) | |
Ord (Datum era) | |
Defined in Cardano.Ledger.Plutus.Data | |
NoThunks (Datum era) | |
type Rep (Datum era) | |
Defined in Cardano.Ledger.Plutus.Data type Rep (Datum era) = D1 ('MetaData "Datum" "Cardano.Ledger.Plutus.Data" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "NoDatum" 'PrefixI 'False) (U1 ∷ Type → Type) :+: (C1 ('MetaCons "DatumHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DataHash)) :+: C1 ('MetaCons "Datum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 (BinaryData era))))) |
datumDataHash ∷ Datum era → StrictMaybe DataHash Source #
Get the Hash of the datum.
BinaryData
data BinaryData era Source #
Inlined data must be stored in the most compact form because it contributes
to the memory overhead of the ledger state. Constructor is intentionally not
exported, in order to prevent invalid creation of data from arbitrary binary
data. Use makeBinaryData
for smart construction.
Instances
makeBinaryData ∷ Era era ⇒ ShortByteString → Either String (BinaryData era) Source #
Construct BinaryData
from a buffer of bytes, while ensuring that it can be later
safely converted to Data
with binaryDataToData
hashBinaryData ∷ BinaryData era → DataHash Source #
binaryDataToData ∷ Era era ⇒ BinaryData era → Data era Source #
It is safe to convert BinaryData
to Data
because the only way to
construct BinaryData
is through the smart constructor makeBinaryData
that
takes care of validation.
dataToBinaryData ∷ Era era ⇒ Data era → BinaryData era Source #