cardano-ledger-api-1.9.1.0: Public API for the cardano ledger codebase
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Api.Scripts

Contents

Synopsis

Documentation

class (Era era, Show (Script era), Eq (Script era), EqRaw (Script era), ToCBOR (Script era), EncCBOR (Script era), DecCBOR (Annotator (Script era)), NoThunks (Script era), SafeToHash (Script era), Eq (NativeScript era), Show (NativeScript era), NFData (NativeScript era), NoThunks (NativeScript era), EncCBOR (NativeScript era), DecCBOR (Annotator (NativeScript era))) ⇒ EraScript era Source #

Typeclass for script data types. Allows for script validation and hashing. You must understand the role of SafeToHash and scriptPrefixTag to make new instances. scriptPrefixTag is a magic number representing the tag of the script language. For each new script language defined, a new tag is chosen and the tag is included in the script hash for a script. The safeToHash constraint ensures that Scripts are never reserialised.

Associated Types

type Script era = (r ∷ Type) | r → era Source #

Scripts which may lock transaction outputs in this era

type NativeScript era = (r ∷ Type) | r → era Source #

data ScriptHash c Source #

Instances

Instances details
Crypto c ⇒ FromJSON (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Crypto c ⇒ FromJSONKey (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Crypto c ⇒ ToJSON (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Crypto c ⇒ ToJSONKey (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Generic (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Associated Types

type Rep (ScriptHash c) ∷ TypeType Source #

Methods

fromScriptHash c → Rep (ScriptHash c) x Source #

toRep (ScriptHash c) x → ScriptHash c Source #

Show (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Crypto c ⇒ FromCBOR (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Crypto c ⇒ ToCBOR (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

toCBORScriptHash c → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (ScriptHash c) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [ScriptHash c] → Size Source #

Crypto c ⇒ DecCBOR (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Crypto c ⇒ EncCBOR (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

encCBORScriptHash c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (ScriptHash c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ScriptHash c] → Size Source #

NFData (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

rnfScriptHash c → () Source #

Eq (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

Methods

(==)ScriptHash c → ScriptHash c → Bool Source #

(/=)ScriptHash c → ScriptHash c → Bool Source #

Ord (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

NoThunks (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep (ScriptHash c) 
Instance details

Defined in Cardano.Ledger.Hashes

type Rep (ScriptHash c) = D1 ('MetaData "ScriptHash" "Cardano.Ledger.Hashes" "cardano-ledger-core-1.12.0.0-inplace" 'True) (C1 ('MetaCons "ScriptHash" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash (ADDRHASH c) EraIndependentScript))))

upgradeScriptEraScript era ⇒ Script (PreviousEra era) → Script era Source #

Every era, except Shelley, must be able to upgrade a Script from a previous era.

Warning - Important to note that any memoized binary representation will not be preserved, you need to retain underlying bytes you can use translateEraThroughCBOR

hashScriptEraScript era ⇒ Script era → ScriptHash (EraCrypto era) Source #

Compute ScriptHash of a Script for a particular era.

validateNativeScriptEraTx era ⇒ Tx era → NativeScript era → Bool Source #

Using information from the transaction validate the supplied native script.

data ValidityInterval Source #

ValidityInterval is a half open interval. Closed on the bottom, open on the top. A SNothing on the bottom is negative infinity, and a SNothing on the top is positive infinity

Instances

Instances details
ToJSON ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

Generic ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

Associated Types

type Rep ValidityIntervalTypeType Source #

Show ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

DecCBOR ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

EncCBOR ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

NFData ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

Methods

rnfValidityInterval → () Source #

Eq ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

Ord ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

NoThunks ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

type Rep ValidityInterval 
Instance details

Defined in Cardano.Ledger.Allegra.Scripts

type Rep ValidityInterval = D1 ('MetaData "ValidityInterval" "Cardano.Ledger.Allegra.Scripts" "cardano-ledger-allegra-1.4.1.0-inplace" 'False) (C1 ('MetaCons "ValidityInterval" 'PrefixI 'True) (S1 ('MetaSel ('Just "invalidBefore") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMaybe SlotNo)) :*: S1 ('MetaSel ('Just "invalidHereafter") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictMaybe SlotNo))))

Alonzo

class (EraScript era, Eq (PlutusScript era), Ord (PlutusScript era), Show (PlutusScript era), NoThunks (PlutusScript era), NFData (PlutusScript era), SafeToHash (PlutusScript era), Eq (PlutusPurpose AsItem era), Show (PlutusPurpose AsItem era), EncCBOR (PlutusPurpose AsItem era), DecCBOR (PlutusPurpose AsItem era), NoThunks (PlutusPurpose AsItem era), NFData (PlutusPurpose AsItem era), Eq (PlutusPurpose AsIx era), Ord (PlutusPurpose AsIx era), Show (PlutusPurpose AsIx era), EncCBOR (PlutusPurpose AsIx era), DecCBOR (PlutusPurpose AsIx era), EncCBORGroup (PlutusPurpose AsIx era), DecCBORGroup (PlutusPurpose AsIx era), NoThunks (PlutusPurpose AsIx era), NFData (PlutusPurpose AsIx era), Eq (PlutusPurpose AsIxItem era), Show (PlutusPurpose AsIxItem era), NoThunks (PlutusPurpose AsIxItem era), NFData (PlutusPurpose AsIxItem era)) ⇒ AlonzoEraScript era where Source #

Associated Types

data PlutusScript era Source #

type PlutusPurpose (f ∷ TypeTypeType) era = (r ∷ Type) | r → era Source #

Instances

Instances details
Crypto c ⇒ AlonzoEraScript (AlonzoEra c) 
Instance details

Defined in Cardano.Ledger.Alonzo.Scripts

Associated Types

data PlutusScript (AlonzoEra c) Source #

type PlutusPurpose f (AlonzoEra c) = (r ∷ Type) Source #

Methods

eraMaxLanguageLanguage Source #

toPlutusScriptScript (AlonzoEra c) → Maybe (PlutusScript (AlonzoEra c)) Source #

fromPlutusScriptPlutusScript (AlonzoEra c) → Script (AlonzoEra c) Source #

mkPlutusScript ∷ ∀ (l ∷ Language). PlutusLanguage l ⇒ Plutus l → Maybe (PlutusScript (AlonzoEra c)) Source #

withPlutusScriptPlutusScript (AlonzoEra c) → (∀ (l ∷ Language). PlutusLanguage l ⇒ Plutus l → a) → a Source #

hoistPlutusPurpose ∷ (∀ ix it. g ix it → f ix it) → PlutusPurpose g (AlonzoEra c) → PlutusPurpose f (AlonzoEra c) Source #

mkSpendingPurpose ∷ f Word32 (TxIn (EraCrypto (AlonzoEra c))) → PlutusPurpose f (AlonzoEra c) Source #

toSpendingPurposePlutusPurpose f (AlonzoEra c) → Maybe (f Word32 (TxIn (EraCrypto (AlonzoEra c)))) Source #

mkMintingPurpose ∷ f Word32 (PolicyID (EraCrypto (AlonzoEra c))) → PlutusPurpose f (AlonzoEra c) Source #

toMintingPurposePlutusPurpose f (AlonzoEra c) → Maybe (f Word32 (PolicyID (EraCrypto (AlonzoEra c)))) Source #

mkCertifyingPurpose ∷ f Word32 (TxCert (AlonzoEra c)) → PlutusPurpose f (AlonzoEra c) Source #

toCertifyingPurposePlutusPurpose f (AlonzoEra c) → Maybe (f Word32 (TxCert (AlonzoEra c))) Source #

mkRewardingPurpose ∷ f Word32 (RewardAccount (EraCrypto (AlonzoEra c))) → PlutusPurpose f (AlonzoEra c) Source #

toRewardingPurposePlutusPurpose f (AlonzoEra c) → Maybe (f Word32 (RewardAccount (EraCrypto (AlonzoEra c)))) Source #

upgradePlutusPurposeAsIxPlutusPurpose AsIx (PreviousEra (AlonzoEra c)) → PlutusPurpose AsIx (AlonzoEra c) Source #

pattern SpendingPurposeAlonzoEraScript era ⇒ f Word32 (TxIn (EraCrypto era)) → PlutusPurpose f era Source #

pattern CertifyingPurposeAlonzoEraScript era ⇒ f Word32 (TxCert era) → PlutusPurpose f era Source #

data CostModels Source #

For a known version of Plutus, attempting to construct a cost model with too few parameters (depending on the version) will result in an error. CostModelApplyError exists to collect these errors in the CostModels type. The CostModels type itself needs to be flexible enough to accept any map of Word8 to '[Int64]', so that cost models can be placed in the protocol parameters ahead of changes to the Plutus evaluation context. In this way, serializing a cost model, updating software, and deserializing can result in errors going away.

Additionally, CostModels needs to be able to store cost models for future version of Plutus, which we cannot yet even validate. These are stored in costModelsUnknown.

Instances

Instances details
FromJSON CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

ToJSON CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Monoid CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Semigroup CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Generic CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Associated Types

type Rep CostModelsTypeType Source #

Show CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

DecCBOR CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

EncCBOR CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Methods

encCBORCostModelsEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy CostModelsSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [CostModels] → Size Source #

NFData CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Methods

rnfCostModels → () Source #

Eq CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

Ord CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

NoThunks CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

type Rep CostModels 
Instance details

Defined in Cardano.Ledger.Plutus.CostModels

type Rep CostModels = D1 ('MetaData "CostModels" "Cardano.Ledger.Plutus.CostModels" "cardano-ledger-core-1.12.0.0-inplace" 'False) (C1 ('MetaCons "CostModels" 'PrefixI 'True) (S1 ('MetaSel ('Just "_costModelsValid") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map Language CostModel)) :*: S1 ('MetaSel ('Just "_costModelsUnknown") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map Word8 [Int64]))))

Conway

pattern VotingPurposeConwayEraScript era ⇒ f Word32 (Voter (EraCrypto era)) → PlutusPurpose f era Source #