plutus-ledger-api-1.30.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusLedgerApi.Common.SerialisedScript

Synopsis

Documentation

type SerialisedScript = ShortByteString Source #

Scripts to the ledger are serialised bytestrings.

serialiseCompiledCode ∷ ∀ a. CompiledCode a → SerialisedScript Source #

Turns a program which was compiled using the 'PlutusTx' toolchain into a binary format that is understood by the network and can be stored on-chain.

serialiseUPLCProgram DeBruijn DefaultUni DefaultFun () → SerialisedScript Source #

Turns a program's AST (most likely manually constructed) into a binary format that is understood by the network and can be stored on-chain.

uncheckedDeserialiseUPLCSerialisedScriptProgram DeBruijn DefaultUni DefaultFun () Source #

Deserialises a SerialisedScript back into an AST. Does *not* do ledger-language-version-specific checks like for allowable builtins.

scriptCBORDecoderPlutusLedgerLanguageMajorProtocolVersion → Decoder s ScriptNamedDeBruijn Source #

This decoder decodes the names directly into NamedDeBruijns rather than DeBruijns. This is needed because the CEK machine expects NameDeBruijns, but there are obviously no names in the serialised form of a Script. Rather than traversing the term and inserting fake names after deserialising, this lets us do at the same time as deserialising.

newtype ScriptNamedDeBruijn Source #

A script with named de-bruijn indices.

data ScriptForEvaluation Source #

A Plutus script ready to be evaluated on-chain, via evaluateScriptRestricting.

Instances

Instances details
Generic ScriptForEvaluation Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

Associated Types

type Rep ScriptForEvaluationTypeType Source #

Show ScriptForEvaluation Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

NFData ScriptForEvaluation Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

Methods

rnfScriptForEvaluation → () Source #

Eq ScriptForEvaluation Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

NoThunks ScriptForEvaluation Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

Methods

noThunks ∷ Context → ScriptForEvaluationIO (Maybe ThunkInfo)

wNoThunks ∷ Context → ScriptForEvaluationIO (Maybe ThunkInfo)

showTypeOfProxy ScriptForEvaluationString

type Rep ScriptForEvaluation Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

type Rep ScriptForEvaluation = D1 ('MetaData "ScriptForEvaluation" "PlutusLedgerApi.Common.SerialisedScript" "plutus-ledger-api-1.30.0.0-inplace" 'False) (C1 ('MetaCons "UnsafeScriptForEvaluation" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SerialisedScript) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ScriptNamedDeBruijn)))

data ScriptDecodeError Source #

An error that occurred during script deserialization.

Constructors

CBORDeserialiseError !DeserialiseFailureInfo

an error from the underlying CBOR/serialise library

RemainderError !ByteString

Script was successfully parsed, but more (runaway) bytes encountered after script's position

LedgerLanguageNotAvailableError

the plutus version of the given script is not enabled yet

Fields

PlutusCoreLanguageNotAvailableError 

Fields

Instances

Instances details
Exception ScriptDecodeError Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

Show ScriptDecodeError Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

Eq ScriptDecodeError Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

AsScriptDecodeError ScriptDecodeError Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

Pretty ScriptDecodeError Source # 
Instance details

Defined in PlutusLedgerApi.Common.SerialisedScript

Methods

prettyScriptDecodeErrorDoc ann #

prettyList ∷ [ScriptDecodeError] → Doc ann #

class AsScriptDecodeError r where Source #

Minimal complete definition

_ScriptDecodeError

data DeserialiseFailureInfo Source #

Similar to DeserialiseFailure, with the difference that plain string reason messages are turned into the datatype: DeserialiseFailureReason.

Constructors

DeserialiseFailureInfo 

Fields

data DeserialiseFailureReason Source #

The reason of the cbor failure as a datatype, not as a plain string.

Constructors

EndOfInput

Not enough input provided

ExpectedBytes

The bytes inside the input are malformed.

OtherReason String

This is either a cbor failure that we (plutus) are not aware of, or an underlying flat failure. We use whatever message cborg or flat returns.

deserialiseScript Source #

Arguments

∷ ∀ m. MonadError ScriptDecodeError m 
PlutusLedgerLanguage

the Plutus ledger language of the script.

MajorProtocolVersion

which major protocol version the script was submitted in.

SerialisedScript

the script to deserialise.

→ m ScriptForEvaluation 

The deserialization from a serialised script into a ScriptForEvaluation, ready to be evaluated on-chain. Called inside phase-1 validation (i.e., deserialisation error is a phase-1 error).