| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Plutus.Data
Synopsis
- newtype PlutusData era = PlutusData Data
- newtype 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 ∷ Data era → BinaryData era
- data Datum era
- = NoDatum
- | DatumHash !DataHash
- | Datum !(BinaryData era)
- mkInlineDatum ∷ Era era ⇒ Data → Datum era
- mkHashedDatum ∷ Era era ⇒ Data → Datum 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
Constructors
| PlutusData Data |
Instances
Constructors
| MkData (MemoBytes (PlutusData era)) |
Instances
| Typeable era ⇒ ToCBOR (Data era) Source # | |||||
| Era era ⇒ DecCBOR (Annotator (Data era)) Source # | |||||
| Typeable era ⇒ DecCBOR (Data era) Source # | |||||
| Typeable era ⇒ EncCBOR (Data era) Source # | Encodes memoized bytes created upon construction. | ||||
| SafeToHash (Data era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods originalBytes ∷ Data era → ByteString Source # originalBytesSize ∷ Data era → Int Source # makeHashWithExplicitProxys ∷ Proxy i → Data era → SafeHash i Source # | |||||
| Memoized (Data era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Associated Types
Methods getMemoBytes ∷ Data era → MemoBytes (RawType (Data era)) wrapMemoBytes ∷ MemoBytes (RawType (Data era)) → Data era | |||||
| NFData (Data era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data | |||||
| Generic (Data era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Associated Types
| |||||
| Show (Data era) Source # | |||||
| Eq (Data era) Source # | |||||
| Typeable era ⇒ NoThunks (Data era) Source # | |||||
| HashAnnotated (Data era) EraIndependentData Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods hashAnnotated ∷ Data era → SafeHash EraIndependentData Source # | |||||
| type RawType (Data era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data | |||||
| type Rep (Data era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data type Rep (Data era) = D1 ('MetaData "Data" "Cardano.Ledger.Plutus.Data" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "MkData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MemoBytes (PlutusData era))))) | |||||
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
| Era era ⇒ DecCBOR (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data | |||||
| EncCBOR (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods encCBOR ∷ BinaryData era → Encoding Source # | |||||
| SafeToHash (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods originalBytes ∷ BinaryData era → ByteString Source # originalBytesSize ∷ BinaryData era → Int Source # makeHashWithExplicitProxys ∷ Proxy i → BinaryData era → SafeHash i Source # | |||||
| Generic (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Associated Types
Methods from ∷ BinaryData era → Rep (BinaryData era) x # to ∷ Rep (BinaryData era) x → BinaryData era # | |||||
| Show (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods showsPrec ∷ Int → BinaryData era → ShowS # show ∷ BinaryData era → String # showList ∷ [BinaryData era] → ShowS # | |||||
| Eq (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods (==) ∷ BinaryData era → BinaryData era → Bool # (/=) ∷ BinaryData era → BinaryData era → Bool # | |||||
| Ord (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods compare ∷ BinaryData era → BinaryData era → Ordering # (<) ∷ BinaryData era → BinaryData era → Bool # (<=) ∷ BinaryData era → BinaryData era → Bool # (>) ∷ BinaryData era → BinaryData era → Bool # (>=) ∷ BinaryData era → BinaryData era → Bool # max ∷ BinaryData era → BinaryData era → BinaryData era # min ∷ BinaryData era → BinaryData era → BinaryData era # | |||||
| MemPack (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data | |||||
| NoThunks (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data | |||||
| HashAnnotated (BinaryData era) EraIndependentData Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Methods hashAnnotated ∷ BinaryData era → SafeHash EraIndependentData Source # | |||||
| type Rep (BinaryData era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data type Rep (BinaryData era) = D1 ('MetaData "BinaryData" "Cardano.Ledger.Plutus.Data" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "BinaryData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString))) | |||||
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 ∷ 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.
Constructors
| NoDatum | |
| DatumHash !DataHash | |
| Datum !(BinaryData era) |
Instances
| Era era ⇒ ToJSON (Datum era) Source # | |||||
| Era era ⇒ DecCBOR (Datum era) Source # | |||||
| Era era ⇒ EncCBOR (Datum era) Source # | |||||
| Generic (Datum era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data Associated Types
| |||||
| Show (Datum era) Source # | |||||
| Eq (Datum era) Source # | |||||
| Ord (Datum era) Source # | |||||
Defined in Cardano.Ledger.Plutus.Data | |||||
| Era era ⇒ MemPack (Datum era) Source # | |||||
| 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.19.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 #