Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.Script
Synopsis
- data SimpleScript'
- data PlutusScriptV1
- data PlutusScriptV2
- data PlutusScriptV3
- data ScriptLanguage lang where
- data PlutusScriptVersion lang where
- data AnyScriptLanguage where
- AnyScriptLanguage :: ScriptLanguage lang -> AnyScriptLanguage
- data AnyPlutusScriptVersion where
- class IsScriptLanguage lang => IsPlutusScriptLanguage lang where
- class HasTypeProxy lang => IsScriptLanguage lang where
- scriptLanguage :: ScriptLanguage lang
- data Script lang where
- SimpleScript :: !SimpleScript -> Script SimpleScript'
- PlutusScript :: !(PlutusScriptVersion lang) -> !(PlutusScript lang) -> Script lang
- data ScriptInAnyLang where
- ScriptInAnyLang :: ScriptLanguage lang -> Script lang -> ScriptInAnyLang
- toScriptInAnyLang :: Script lang -> ScriptInAnyLang
- data ScriptInEra era where
- ScriptInEra :: ScriptLanguageInEra lang era -> Script lang -> ScriptInEra era
- toScriptInEra :: ShelleyBasedEra era -> ScriptInAnyLang -> Maybe (ScriptInEra era)
- eraOfScriptInEra :: ScriptInEra era -> ShelleyBasedEra era
- data ReferenceScript era where
- ReferenceScript :: BabbageEraOnwards era -> ScriptInAnyLang -> ReferenceScript era
- ReferenceScriptNone :: ReferenceScript era
- refScriptToShelleyScript :: ShelleyBasedEra era -> ReferenceScript era -> StrictMaybe (Script (ShelleyLedgerEra era))
- data WitCtxTxIn
- data WitCtxMint
- data WitCtxStake
- data WitCtx witctx where
- data ScriptWitness witctx era where
- SimpleScriptWitness :: ScriptLanguageInEra SimpleScript' era -> SimpleScriptOrReferenceInput SimpleScript' -> ScriptWitness witctx era
- PlutusScriptWitness :: ScriptLanguageInEra lang era -> PlutusScriptVersion lang -> PlutusScriptOrReferenceInput lang -> ScriptDatum witctx -> ScriptRedeemer -> ExecutionUnits -> ScriptWitness witctx era
- data Witness witctx era where
- KeyWitness :: KeyWitnessInCtx witctx -> Witness witctx era
- ScriptWitness :: ScriptWitnessInCtx witctx -> ScriptWitness witctx era -> Witness witctx era
- data KeyWitnessInCtx witctx where
- data ScriptWitnessInCtx witctx where
- class IsScriptWitnessInCtx ctx where
- data ScriptDatum witctx where
- type ScriptRedeemer = HashableScriptData
- scriptWitnessScript :: ScriptWitness witctx era -> Maybe (ScriptInEra era)
- data ScriptLanguageInEra lang era where
- SimpleScriptInShelley :: ScriptLanguageInEra SimpleScript' ShelleyEra
- SimpleScriptInAllegra :: ScriptLanguageInEra SimpleScript' AllegraEra
- SimpleScriptInMary :: ScriptLanguageInEra SimpleScript' MaryEra
- SimpleScriptInAlonzo :: ScriptLanguageInEra SimpleScript' AlonzoEra
- SimpleScriptInBabbage :: ScriptLanguageInEra SimpleScript' BabbageEra
- SimpleScriptInConway :: ScriptLanguageInEra SimpleScript' ConwayEra
- PlutusScriptV1InAlonzo :: ScriptLanguageInEra PlutusScriptV1 AlonzoEra
- PlutusScriptV1InBabbage :: ScriptLanguageInEra PlutusScriptV1 BabbageEra
- PlutusScriptV1InConway :: ScriptLanguageInEra PlutusScriptV1 ConwayEra
- PlutusScriptV2InBabbage :: ScriptLanguageInEra PlutusScriptV2 BabbageEra
- PlutusScriptV2InConway :: ScriptLanguageInEra PlutusScriptV2 ConwayEra
- PlutusScriptV3InConway :: ScriptLanguageInEra PlutusScriptV3 ConwayEra
- scriptLanguageSupportedInEra :: ShelleyBasedEra era -> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
- languageOfScriptLanguageInEra :: ScriptLanguageInEra lang era -> ScriptLanguage lang
- eraOfScriptLanguageInEra :: ScriptLanguageInEra lang era -> ShelleyBasedEra era
- data SimpleScript
- data SimpleScriptOrReferenceInput lang
- data PlutusScript lang where
- PlutusScriptSerialised :: ShortByteString -> PlutusScript lang
- data PlutusScriptOrReferenceInput lang
- = PScript (PlutusScript lang)
- | PReferenceScript TxIn (Maybe ScriptHash)
- examplePlutusScriptAlwaysSucceeds :: WitCtx witctx -> PlutusScript PlutusScriptV1
- examplePlutusScriptAlwaysFails :: WitCtx witctx -> PlutusScript PlutusScriptV1
- data ScriptData
- = ScriptDataConstructor Integer [ScriptData]
- | ScriptDataMap [(ScriptData, ScriptData)]
- | ScriptDataList [ScriptData]
- | ScriptDataNumber Integer
- | ScriptDataBytes ByteString
- data ExecutionUnits = ExecutionUnits {}
- newtype ScriptHash = ScriptHash (ScriptHash StandardCrypto)
- hashScript :: Script lang -> ScriptHash
- toShelleyScript :: ScriptInEra era -> Script (ShelleyLedgerEra era)
- fromShelleyBasedScript :: ShelleyBasedEra era -> Script (ShelleyLedgerEra era) -> ScriptInEra era
- toShelleyMultiSig :: forall era. (Era era, EraCrypto era ~ StandardCrypto) => SimpleScript -> Either MultiSigError (MultiSig era)
- fromShelleyMultiSig :: (Era era, EraCrypto era ~ StandardCrypto) => MultiSig era -> SimpleScript
- toAllegraTimelock :: forall era. (Era era, EraCrypto era ~ StandardCrypto) => SimpleScript -> Timelock era
- fromAllegraTimelock :: (Era era, EraCrypto era ~ StandardCrypto) => Timelock era -> SimpleScript
- toAlonzoExUnits :: ExecutionUnits -> ExUnits
- fromAlonzoExUnits :: ExUnits -> ExecutionUnits
- toShelleyScriptHash :: ScriptHash -> ScriptHash StandardCrypto
- fromShelleyScriptHash :: ScriptHash StandardCrypto -> ScriptHash
- toPlutusData :: ScriptData -> Data
- fromPlutusData :: Data -> ScriptData
- toAlonzoData :: Era ledgerera => HashableScriptData -> Data ledgerera
- fromAlonzoData :: Data ledgerera -> HashableScriptData
- toAlonzoLanguage :: AnyPlutusScriptVersion -> Language
- fromAlonzoLanguage :: Language -> AnyPlutusScriptVersion
- fromShelleyScriptToReferenceScript :: ShelleyBasedEra era -> Script (ShelleyLedgerEra era) -> ReferenceScript era
- scriptInEraToRefScript :: ScriptInEra era -> ReferenceScript era
- data family AsType t
- data family Hash keyrole :: Type
Languages
data SimpleScript' Source #
Instances
HasTypeProxy SimpleScript' Source # | |
Defined in Cardano.Api.Script Associated Types data AsType SimpleScript' Source # Methods proxyToAsType :: Proxy SimpleScript' -> AsType SimpleScript' Source # | |
IsScriptLanguage SimpleScript' Source # | |
Defined in Cardano.Api.Script Methods | |
data AsType SimpleScript' Source # | |
Defined in Cardano.Api.Script |
data PlutusScriptV1 Source #
The original simple script language which supports
- require a signature from a given key (by verification key hash)
- n-way and combinator
- n-way or combinator
- m-of-n combinator
This version of the language was introduced in the ShelleyEra
.
The second version of the simple script language. It has all the features of the original simple script language plus new atomic predicates:
- require the time be before a given slot number
- require the time be after a given slot number
This version of the language was introduced in the AllegraEra
.
However we opt for a single type level tag SimpleScript'
as the second version of
of the language introduced in the Allegra era is a superset of the language introduced
in the Shelley era.
Place holder type to show what the pattern is to extend to multiple languages, not just multiple versions of a single language.
Instances
HasTypeProxy PlutusScriptV1 Source # | |
Defined in Cardano.Api.Script Associated Types data AsType PlutusScriptV1 Source # Methods proxyToAsType :: Proxy PlutusScriptV1 -> AsType PlutusScriptV1 Source # | |
IsPlutusScriptLanguage PlutusScriptV1 Source # | |
Defined in Cardano.Api.Script | |
IsScriptLanguage PlutusScriptV1 Source # | |
Defined in Cardano.Api.Script Methods | |
data AsType PlutusScriptV1 Source # | |
Defined in Cardano.Api.Script |
data PlutusScriptV2 Source #
Instances
HasTypeProxy PlutusScriptV2 Source # | |
Defined in Cardano.Api.Script Associated Types data AsType PlutusScriptV2 Source # Methods proxyToAsType :: Proxy PlutusScriptV2 -> AsType PlutusScriptV2 Source # | |
IsPlutusScriptLanguage PlutusScriptV2 Source # | |
Defined in Cardano.Api.Script | |
IsScriptLanguage PlutusScriptV2 Source # | |
Defined in Cardano.Api.Script Methods | |
data AsType PlutusScriptV2 Source # | |
Defined in Cardano.Api.Script |
data PlutusScriptV3 Source #
Instances
HasTypeProxy PlutusScriptV3 Source # | |
Defined in Cardano.Api.Script Associated Types data AsType PlutusScriptV3 Source # Methods proxyToAsType :: Proxy PlutusScriptV3 -> AsType PlutusScriptV3 Source # | |
IsPlutusScriptLanguage PlutusScriptV3 Source # | |
Defined in Cardano.Api.Script | |
IsScriptLanguage PlutusScriptV3 Source # | |
Defined in Cardano.Api.Script Methods | |
data AsType PlutusScriptV3 Source # | |
Defined in Cardano.Api.Script |
data ScriptLanguage lang where Source #
Constructors
SimpleScriptLanguage :: ScriptLanguage SimpleScript' | |
PlutusScriptLanguage :: PlutusScriptVersion lang -> ScriptLanguage lang |
Instances
Eq (ScriptLanguage lang) Source # | |
Defined in Cardano.Api.Script Methods (==) :: ScriptLanguage lang -> ScriptLanguage lang -> Bool Source # (/=) :: ScriptLanguage lang -> ScriptLanguage lang -> Bool Source # | |
Show (ScriptLanguage lang) Source # | |
Defined in Cardano.Api.Script | |
TestEquality ScriptLanguage Source # | |
Defined in Cardano.Api.Script Methods testEquality :: forall (a :: k) (b :: k). ScriptLanguage a -> ScriptLanguage b -> Maybe (a :~: b) Source # |
data PlutusScriptVersion lang where Source #
Constructors
PlutusScriptV1 :: PlutusScriptVersion PlutusScriptV1 | |
PlutusScriptV2 :: PlutusScriptVersion PlutusScriptV2 | |
PlutusScriptV3 :: PlutusScriptVersion PlutusScriptV3 |
Instances
Eq (PlutusScriptVersion lang) Source # | |
Defined in Cardano.Api.Script Methods (==) :: PlutusScriptVersion lang -> PlutusScriptVersion lang -> Bool Source # (/=) :: PlutusScriptVersion lang -> PlutusScriptVersion lang -> Bool Source # | |
Show (PlutusScriptVersion lang) Source # | |
Defined in Cardano.Api.Script | |
TestEquality PlutusScriptVersion Source # | |
Defined in Cardano.Api.Script Methods testEquality :: forall (a :: k) (b :: k). PlutusScriptVersion a -> PlutusScriptVersion b -> Maybe (a :~: b) Source # |
data AnyScriptLanguage where Source #
Constructors
AnyScriptLanguage :: ScriptLanguage lang -> AnyScriptLanguage |
Instances
data AnyPlutusScriptVersion where Source #
Constructors
AnyPlutusScriptVersion :: PlutusScriptVersion lang -> AnyPlutusScriptVersion |
Instances
class IsScriptLanguage lang => IsPlutusScriptLanguage lang where Source #
Methods
Instances
IsPlutusScriptLanguage PlutusScriptV3 Source # | |
Defined in Cardano.Api.Script | |
IsPlutusScriptLanguage PlutusScriptV2 Source # | |
Defined in Cardano.Api.Script | |
IsPlutusScriptLanguage PlutusScriptV1 Source # | |
Defined in Cardano.Api.Script |
class HasTypeProxy lang => IsScriptLanguage lang where Source #
Methods
scriptLanguage :: ScriptLanguage lang Source #
Instances
IsScriptLanguage PlutusScriptV3 Source # | |
Defined in Cardano.Api.Script Methods | |
IsScriptLanguage PlutusScriptV2 Source # | |
Defined in Cardano.Api.Script Methods | |
IsScriptLanguage PlutusScriptV1 Source # | |
Defined in Cardano.Api.Script Methods | |
IsScriptLanguage SimpleScript' Source # | |
Defined in Cardano.Api.Script Methods |
Scripts in a specific language
data Script lang where Source #
A script in a particular language.
See also ScriptInAnyLang
for a script in any of the known languages.
See also ScriptInEra
for a script in a language that is available within
a particular era.
Note that some but not all scripts have an external JSON syntax, hence this
type has no JSON serialisation instances. The SimpleScript
family of
languages do have a JSON syntax and thus have ToJSON
/FromJSON
instances.
Constructors
SimpleScript :: !SimpleScript -> Script SimpleScript' | |
PlutusScript :: !(PlutusScriptVersion lang) -> !(PlutusScript lang) -> Script lang |
Instances
Eq (Script lang) Source # | |
Show (Script lang) Source # | |
HasTypeProxy lang => HasTypeProxy (Script lang) Source # | |
IsScriptLanguage lang => SerialiseAsCBOR (Script lang) Source # | |
Defined in Cardano.Api.Script | |
IsScriptLanguage lang => HasTextEnvelope (Script lang) Source # | |
Defined in Cardano.Api.Script Methods textEnvelopeType :: AsType (Script lang) -> TextEnvelopeType Source # textEnvelopeDefaultDescr :: Script lang -> TextEnvelopeDescr Source # | |
data AsType (Script lang) Source # | |
Defined in Cardano.Api.Script |
Scripts in any language
data ScriptInAnyLang where Source #
Sometimes it is necessary to handle all languages without making static type distinctions between languages. For example, when reading external input, or before the era context is known.
Use toScriptInEra
to convert to a script in the context of an era.
Constructors
ScriptInAnyLang :: ScriptLanguage lang -> Script lang -> ScriptInAnyLang |
Instances
Eq ScriptInAnyLang Source # | |
Defined in Cardano.Api.Script Methods (==) :: ScriptInAnyLang -> ScriptInAnyLang -> Bool Source # (/=) :: ScriptInAnyLang -> ScriptInAnyLang -> Bool Source # | |
Show ScriptInAnyLang Source # | |
Defined in Cardano.Api.Script | |
FromJSON ScriptInAnyLang Source # | |
Defined in Cardano.Api.Script Methods parseJSON :: Value -> Parser ScriptInAnyLang # parseJSONList :: Value -> Parser [ScriptInAnyLang] # | |
ToJSON ScriptInAnyLang Source # | |
Defined in Cardano.Api.Script Methods toJSON :: ScriptInAnyLang -> Value # toEncoding :: ScriptInAnyLang -> Encoding # toJSONList :: [ScriptInAnyLang] -> Value # toEncodingList :: [ScriptInAnyLang] -> Encoding # omitField :: ScriptInAnyLang -> Bool # | |
HasTypeProxy ScriptInAnyLang Source # | |
Defined in Cardano.Api.Script Associated Types data AsType ScriptInAnyLang Source # Methods proxyToAsType :: Proxy ScriptInAnyLang -> AsType ScriptInAnyLang Source # | |
data AsType ScriptInAnyLang Source # | |
Defined in Cardano.Api.Script |
toScriptInAnyLang :: Script lang -> ScriptInAnyLang Source #
Convert a script in a specific statically-known language to a
ScriptInAnyLang
.
No inverse to this is provided, just do case analysis on the ScriptLanguage
field within the ScriptInAnyLang
constructor.
Scripts in an era
data ScriptInEra era where Source #
Constructors
ScriptInEra :: ScriptLanguageInEra lang era -> Script lang -> ScriptInEra era |
Instances
Eq (ScriptInEra era) Source # | |
Defined in Cardano.Api.Script Methods (==) :: ScriptInEra era -> ScriptInEra era -> Bool Source # (/=) :: ScriptInEra era -> ScriptInEra era -> Bool Source # | |
Show (ScriptInEra era) Source # | |
Defined in Cardano.Api.Script | |
HasTypeProxy era => HasTypeProxy (ScriptInEra era) Source # | |
Defined in Cardano.Api.Script Associated Types data AsType (ScriptInEra era) Source # Methods proxyToAsType :: Proxy (ScriptInEra era) -> AsType (ScriptInEra era) Source # | |
data AsType (ScriptInEra era) Source # | |
Defined in Cardano.Api.Script |
toScriptInEra :: ShelleyBasedEra era -> ScriptInAnyLang -> Maybe (ScriptInEra era) Source #
Given a target era and a script in some language, check if the language is
supported in that era, and if so return a ScriptInEra
.
eraOfScriptInEra :: ScriptInEra era -> ShelleyBasedEra era Source #
Reference scripts
data ReferenceScript era where Source #
A reference scripts is a script that can exist at a transaction output. This greatly reduces the size of transactions that use scripts as the script no longer has to be added to the transaction, they can now be referenced via a transaction output.
Constructors
ReferenceScript :: BabbageEraOnwards era -> ScriptInAnyLang -> ReferenceScript era | |
ReferenceScriptNone :: ReferenceScript era |
Instances
Eq (ReferenceScript era) Source # | |
Defined in Cardano.Api.Script Methods (==) :: ReferenceScript era -> ReferenceScript era -> Bool Source # (/=) :: ReferenceScript era -> ReferenceScript era -> Bool Source # | |
Show (ReferenceScript era) Source # | |
Defined in Cardano.Api.Script | |
IsCardanoEra era => FromJSON (ReferenceScript era) Source # | |
Defined in Cardano.Api.Script Methods parseJSON :: Value -> Parser (ReferenceScript era) # parseJSONList :: Value -> Parser [ReferenceScript era] # omittedField :: Maybe (ReferenceScript era) # | |
IsCardanoEra era => ToJSON (ReferenceScript era) Source # | |
Defined in Cardano.Api.Script Methods toJSON :: ReferenceScript era -> Value # toEncoding :: ReferenceScript era -> Encoding # toJSONList :: [ReferenceScript era] -> Value # toEncodingList :: [ReferenceScript era] -> Encoding # omitField :: ReferenceScript era -> Bool # |
refScriptToShelleyScript :: ShelleyBasedEra era -> ReferenceScript era -> StrictMaybe (Script (ShelleyLedgerEra era)) Source #
Use of a script in an era as a witness
data WitCtxTxIn Source #
A tag type for the context in which a script is used in a transaction.
This type tags the context as being to witness a transaction input.
Instances
IsScriptWitnessInCtx WitCtxTxIn Source # | |
Defined in Cardano.Api.Script Methods scriptWitnessInCtx :: ScriptWitnessInCtx WitCtxTxIn Source # |
data WitCtxMint Source #
A tag type for the context in which a script is used in a transaction.
This type tags the context as being to witness minting.
Instances
IsScriptWitnessInCtx WitCtxMint Source # | |
Defined in Cardano.Api.Script Methods scriptWitnessInCtx :: ScriptWitnessInCtx WitCtxMint Source # |
data WitCtxStake Source #
A tag type for the context in which a script is used in a transaction.
This type tags the context as being to witness the use of stake addresses in both certificates and withdrawals.
Instances
IsScriptWitnessInCtx WitCtxStake Source # | |
Defined in Cardano.Api.Script Methods scriptWitnessInCtx :: ScriptWitnessInCtx WitCtxStake Source # |
data WitCtx witctx where Source #
This GADT provides a value-level representation of all the witness contexts. This enables pattern matching on the context to allow them to be treated in a non-uniform way.
Constructors
WitCtxTxIn :: WitCtx WitCtxTxIn | |
WitCtxMint :: WitCtx WitCtxMint | |
WitCtxStake :: WitCtx WitCtxStake |
data ScriptWitness witctx era where Source #
A use of a script within a transaction body to witness that something is being used in an authorised manner. That can be
- spending a transaction input
- minting tokens
- using a certificate (stake address certs specifically)
- withdrawing from a reward account
For simple script languages, the use of the script is the same in all contexts. For Plutus scripts, using a script involves supplying a redeemer. In addition, Plutus scripts used for spending inputs must also supply the datum value used when originally creating the TxOut that is now being spent.
Constructors
SimpleScriptWitness :: ScriptLanguageInEra SimpleScript' era -> SimpleScriptOrReferenceInput SimpleScript' -> ScriptWitness witctx era | |
PlutusScriptWitness :: ScriptLanguageInEra lang era -> PlutusScriptVersion lang -> PlutusScriptOrReferenceInput lang -> ScriptDatum witctx -> ScriptRedeemer -> ExecutionUnits -> ScriptWitness witctx era |
Instances
Eq (ScriptWitness witctx era) Source # | |
Defined in Cardano.Api.Script Methods (==) :: ScriptWitness witctx era -> ScriptWitness witctx era -> Bool Source # (/=) :: ScriptWitness witctx era -> ScriptWitness witctx era -> Bool Source # | |
Show (ScriptWitness witctx era) Source # | |
Defined in Cardano.Api.Script |
data Witness witctx era where Source #
Constructors
KeyWitness :: KeyWitnessInCtx witctx -> Witness witctx era | |
ScriptWitness :: ScriptWitnessInCtx witctx -> ScriptWitness witctx era -> Witness witctx era |
data KeyWitnessInCtx witctx where Source #
Constructors
KeyWitnessForSpending :: KeyWitnessInCtx WitCtxTxIn | |
KeyWitnessForStakeAddr :: KeyWitnessInCtx WitCtxStake |
Instances
Eq (KeyWitnessInCtx witctx) Source # | |
Defined in Cardano.Api.Script Methods (==) :: KeyWitnessInCtx witctx -> KeyWitnessInCtx witctx -> Bool Source # (/=) :: KeyWitnessInCtx witctx -> KeyWitnessInCtx witctx -> Bool Source # | |
Show (KeyWitnessInCtx witctx) Source # | |
Defined in Cardano.Api.Script |
data ScriptWitnessInCtx witctx where Source #
Constructors
ScriptWitnessForSpending :: ScriptWitnessInCtx WitCtxTxIn | |
ScriptWitnessForMinting :: ScriptWitnessInCtx WitCtxMint | |
ScriptWitnessForStakeAddr :: ScriptWitnessInCtx WitCtxStake |
Instances
Eq (ScriptWitnessInCtx witctx) Source # | |
Defined in Cardano.Api.Script Methods (==) :: ScriptWitnessInCtx witctx -> ScriptWitnessInCtx witctx -> Bool Source # (/=) :: ScriptWitnessInCtx witctx -> ScriptWitnessInCtx witctx -> Bool Source # | |
Show (ScriptWitnessInCtx witctx) Source # | |
Defined in Cardano.Api.Script |
class IsScriptWitnessInCtx ctx where Source #
Methods
Instances
IsScriptWitnessInCtx WitCtxStake Source # | |
Defined in Cardano.Api.Script Methods scriptWitnessInCtx :: ScriptWitnessInCtx WitCtxStake Source # | |
IsScriptWitnessInCtx WitCtxMint Source # | |
Defined in Cardano.Api.Script Methods scriptWitnessInCtx :: ScriptWitnessInCtx WitCtxMint Source # | |
IsScriptWitnessInCtx WitCtxTxIn Source # | |
Defined in Cardano.Api.Script Methods scriptWitnessInCtx :: ScriptWitnessInCtx WitCtxTxIn Source # |
data ScriptDatum witctx where Source #
Constructors
Instances
Eq (ScriptDatum witctx) Source # | |
Defined in Cardano.Api.Script Methods (==) :: ScriptDatum witctx -> ScriptDatum witctx -> Bool Source # (/=) :: ScriptDatum witctx -> ScriptDatum witctx -> Bool Source # | |
Show (ScriptDatum witctx) Source # | |
Defined in Cardano.Api.Script |
type ScriptRedeemer = HashableScriptData Source #
scriptWitnessScript :: ScriptWitness witctx era -> Maybe (ScriptInEra era) Source #
Languages supported in each era
data ScriptLanguageInEra lang era where Source #
Constructors
Instances
Eq (ScriptLanguageInEra lang era) Source # | |
Defined in Cardano.Api.Script Methods (==) :: ScriptLanguageInEra lang era -> ScriptLanguageInEra lang era -> Bool Source # (/=) :: ScriptLanguageInEra lang era -> ScriptLanguageInEra lang era -> Bool Source # | |
Show (ScriptLanguageInEra lang era) Source # | |
Defined in Cardano.Api.Script | |
ToJSON (ScriptLanguageInEra lang era) Source # | |
Defined in Cardano.Api.Script Methods toJSON :: ScriptLanguageInEra lang era -> Value # toEncoding :: ScriptLanguageInEra lang era -> Encoding # toJSONList :: [ScriptLanguageInEra lang era] -> Value # toEncodingList :: [ScriptLanguageInEra lang era] -> Encoding # omitField :: ScriptLanguageInEra lang era -> Bool # |
scriptLanguageSupportedInEra :: ShelleyBasedEra era -> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era) Source #
Check if a given script language is supported in a given era, and if so return the evidence.
languageOfScriptLanguageInEra :: ScriptLanguageInEra lang era -> ScriptLanguage lang Source #
eraOfScriptLanguageInEra :: ScriptLanguageInEra lang era -> ShelleyBasedEra era Source #
The simple script language
data SimpleScript Source #
Constructors
RequireSignature !(Hash PaymentKey) | |
RequireTimeBefore !SlotNo | |
RequireTimeAfter !SlotNo | |
RequireAllOf ![SimpleScript] | |
RequireAnyOf ![SimpleScript] | |
RequireMOf !Int ![SimpleScript] |
Instances
Eq SimpleScript Source # | |
Defined in Cardano.Api.Script Methods (==) :: SimpleScript -> SimpleScript -> Bool Source # (/=) :: SimpleScript -> SimpleScript -> Bool Source # | |
Show SimpleScript Source # | |
Defined in Cardano.Api.Script | |
FromJSON SimpleScript Source # | |
Defined in Cardano.Api.Script | |
ToJSON SimpleScript Source # | |
Defined in Cardano.Api.Script Methods toJSON :: SimpleScript -> Value # toEncoding :: SimpleScript -> Encoding # toJSONList :: [SimpleScript] -> Value # toEncodingList :: [SimpleScript] -> Encoding # omitField :: SimpleScript -> Bool # |
data SimpleScriptOrReferenceInput lang Source #
Constructors
SScript SimpleScript | |
SReferenceScript TxIn (Maybe ScriptHash) |
Instances
Eq (SimpleScriptOrReferenceInput lang) Source # | |
Defined in Cardano.Api.Script Methods (==) :: SimpleScriptOrReferenceInput lang -> SimpleScriptOrReferenceInput lang -> Bool Source # (/=) :: SimpleScriptOrReferenceInput lang -> SimpleScriptOrReferenceInput lang -> Bool Source # | |
Show (SimpleScriptOrReferenceInput lang) Source # | |
Defined in Cardano.Api.Script |
The Plutus script language
data PlutusScript lang where Source #
Plutus scripts.
Note that Plutus scripts have a binary serialisation but no JSON serialisation.
Constructors
PlutusScriptSerialised :: ShortByteString -> PlutusScript lang |
Instances
data PlutusScriptOrReferenceInput lang Source #
Scripts can now exist in the UTxO at a transaction output. We can reference these scripts via specification of a reference transaction input in order to witness spending inputs, withdrawals, certificates or to mint tokens. This datatype encapsulates this concept.
Constructors
PScript (PlutusScript lang) | |
PReferenceScript TxIn (Maybe ScriptHash) |
Instances
Eq (PlutusScriptOrReferenceInput lang) Source # | |
Defined in Cardano.Api.Script Methods (==) :: PlutusScriptOrReferenceInput lang -> PlutusScriptOrReferenceInput lang -> Bool Source # (/=) :: PlutusScriptOrReferenceInput lang -> PlutusScriptOrReferenceInput lang -> Bool Source # | |
Show (PlutusScriptOrReferenceInput lang) Source # | |
Defined in Cardano.Api.Script |
examplePlutusScriptAlwaysSucceeds :: WitCtx witctx -> PlutusScript PlutusScriptV1 Source #
An example Plutus script that always succeeds, irrespective of inputs.
For example, if one were to use this for a payment address then it would allow anyone to spend from it.
The exact script depends on the context in which it is to be used.
examplePlutusScriptAlwaysFails :: WitCtx witctx -> PlutusScript PlutusScriptV1 Source #
An example Plutus script that always fails, irrespective of inputs.
For example, if one were to use this for a payment address then it would be impossible for anyone to ever spend from it.
The exact script depends on the context in which it is to be used.
Script data
data ScriptData Source #
Constructors
ScriptDataConstructor | |
Fields
| |
ScriptDataMap [(ScriptData, ScriptData)] | Key value pairs |
ScriptDataList [ScriptData] | Elements |
ScriptDataNumber Integer | |
ScriptDataBytes ByteString |
Instances
Script execution units
data ExecutionUnits Source #
The units for how long a script executes for and how much memory it uses. This is used to declare the resources used by a particular use of a script.
This type is also used to describe the limits for the maximum overall execution units per transaction or per block.
Constructors
ExecutionUnits | |
Fields
|
Instances
Script hashes
newtype ScriptHash Source #
We have this type separate from the Hash
type to avoid the script
hash type being parametrised by the era. The representation is era
independent, and there are many places where we want to use a script
hash where we don't want things to be era-parametrised.
Constructors
ScriptHash (ScriptHash StandardCrypto) |
Instances
hashScript :: Script lang -> ScriptHash Source #
Internal conversion functions
toShelleyScript :: ScriptInEra era -> Script (ShelleyLedgerEra era) Source #
fromShelleyBasedScript :: ShelleyBasedEra era -> Script (ShelleyLedgerEra era) -> ScriptInEra era Source #
toShelleyMultiSig :: forall era. (Era era, EraCrypto era ~ StandardCrypto) => SimpleScript -> Either MultiSigError (MultiSig era) Source #
Conversion for the MultiSig
language used by the Shelley era.
fromShelleyMultiSig :: (Era era, EraCrypto era ~ StandardCrypto) => MultiSig era -> SimpleScript Source #
Conversion for the MultiSig
language used by the Shelley era.
toAllegraTimelock :: forall era. (Era era, EraCrypto era ~ StandardCrypto) => SimpleScript -> Timelock era Source #
Conversion for the Timelock
language that is shared between the
Allegra and Mary eras.
fromAllegraTimelock :: (Era era, EraCrypto era ~ StandardCrypto) => Timelock era -> SimpleScript Source #
Conversion for the Timelock
language that is shared between the
Allegra and Mary eras.
toAlonzoExUnits :: ExecutionUnits -> ExUnits Source #
fromAlonzoExUnits :: ExUnits -> ExecutionUnits Source #
toShelleyScriptHash :: ScriptHash -> ScriptHash StandardCrypto Source #
fromShelleyScriptHash :: ScriptHash StandardCrypto -> ScriptHash Source #
toPlutusData :: ScriptData -> Data Source #
fromPlutusData :: Data -> ScriptData Source #
toAlonzoData :: Era ledgerera => HashableScriptData -> Data ledgerera Source #
fromAlonzoData :: Data ledgerera -> HashableScriptData Source #
toAlonzoLanguage :: AnyPlutusScriptVersion -> Language Source #
fromAlonzoLanguage :: Language -> AnyPlutusScriptVersion Source #
fromShelleyScriptToReferenceScript :: ShelleyBasedEra era -> Script (ShelleyLedgerEra era) -> ReferenceScript era Source #
scriptInEraToRefScript :: ScriptInEra era -> ReferenceScript era 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
data family Hash keyrole :: Type Source #