Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype PlutusData era = PlutusData Data
- data Data era where
- unData ∷ Data era → Data
- type DataHash = SafeHash EraIndependentData
- upgradeData ∷ (Era era1, Era era2) ⇒ Data era1 → Data era2
- hashData ∷ Data era → DataHash
- getPlutusData ∷ Data era → Data
- dataHashSize ∷ StrictMaybe DataHash → Integer
- data BinaryData era
- hashBinaryData ∷ BinaryData era → DataHash
- makeBinaryData ∷ Era era ⇒ ShortByteString → Either String (BinaryData era)
- binaryDataToData ∷ Era era ⇒ BinaryData era → Data era
- dataToBinaryData ∷ Era era ⇒ Data era → BinaryData era
- data Datum era
- = NoDatum
- | DatumHash !DataHash
- | Datum !(BinaryData era)
- datumDataHash ∷ Datum era → StrictMaybe DataHash
- translateDatum ∷ Datum era1 → Datum era2
Documentation
newtype PlutusData era Source #
This is a wrapper with a phantom era for PV1.Data, since we need something with kind (* -> *) for MemoBytes
Instances
Instances
type DataHash = SafeHash EraIndependentData Source #
upgradeData ∷ (Era era1, Era era2) ⇒ Data era1 → Data era2 Source #
Upgrade Data
from one era to another. While the underlying data will
remain the same, the memoised serialisation may change to reflect the
versioned serialisation of the new era.
getPlutusData ∷ Data era → Data Source #
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
hashBinaryData ∷ BinaryData era → DataHash Source #
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
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 #
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) Source # | |
Generic (Datum era) Source # | |
Show (Datum era) Source # | |
Era era ⇒ DecCBOR (Datum era) Source # | |
Era era ⇒ EncCBOR (Datum era) Source # | |
Eq (Datum era) Source # | |
Ord (Datum era) Source # | |
Defined in Cardano.Ledger.Plutus.Data | |
NoThunks (Datum era) Source # | |
type Rep (Datum era) Source # | |
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 'DecidedStrict) (Rec0 (BinaryData era))))) |
datumDataHash ∷ Datum era → StrictMaybe DataHash Source #
Get the Hash of the datum.
translateDatum ∷ Datum era1 → Datum era2 Source #