Safe Haskell | None |
---|---|
Language | Haskell2010 |
Plutus.V2.Ledger.Api
Description
The interface to Plutus V2 for the ledger.
Synopsis
- type SerializedScript = ShortByteString
- data Script
- fromCompiledCode :: CompiledCode a -> Script
- isScriptWellFormed :: ProtocolVersion -> SerializedScript -> Bool
- evaluateScriptRestricting :: ProtocolVersion -> VerboseMode -> EvaluationContext -> ExBudget -> SerializedScript -> [ Data ] -> ( LogOutput , Either EvaluationError ExBudget )
- evaluateScriptCounting :: ProtocolVersion -> VerboseMode -> EvaluationContext -> SerializedScript -> [ Data ] -> ( LogOutput , Either EvaluationError ExBudget )
- data ProtocolVersion = ProtocolVersion { }
- data VerboseMode
- type LogOutput = [ Text ]
- data ExBudget = ExBudget { }
- newtype ExCPU = ExCPU CostingInteger
- newtype ExMemory = ExMemory CostingInteger
- data SatInt
- data EvaluationContext
- mkEvaluationContext :: MonadError CostModelApplyError m => CostModelParams -> m EvaluationContext
- data CostModelApplyError
- type CostModelParams = Map Text Integer
- assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m ()
- costModelParamNames :: Set Text
- data ScriptContext = ScriptContext { }
- data ScriptPurpose
- data BuiltinByteString
- toBuiltin :: ToBuiltin a arep => a -> arep
- fromBuiltin :: FromBuiltin arep a => arep -> a
- newtype LedgerBytes = LedgerBytes { }
- fromBytes :: ByteString -> LedgerBytes
- data DCert
- data StakingCredential
- data Credential
- newtype Value = Value { }
- newtype CurrencySymbol = CurrencySymbol { }
- newtype TokenName = TokenName { }
- singleton :: CurrencySymbol -> TokenName -> Integer -> Value
- unionWith :: ( Integer -> Integer -> Integer ) -> Value -> Value -> Value
- adaSymbol :: CurrencySymbol
- adaToken :: TokenName
- newtype POSIXTime = POSIXTime { }
- type POSIXTimeRange = Interval POSIXTime
- data Address = Address { }
- newtype PubKeyHash = PubKeyHash { }
- newtype TxId = TxId { }
-
data
TxInfo
=
TxInfo
{
- txInfoInputs :: [ TxInInfo ]
- txInfoReferenceInputs :: [ TxInInfo ]
- txInfoOutputs :: [ TxOut ]
- txInfoFee :: Value
- txInfoMint :: Value
- txInfoDCert :: [ DCert ]
- txInfoWdrl :: Map StakingCredential Integer
- txInfoValidRange :: POSIXTimeRange
- txInfoSignatories :: [ PubKeyHash ]
- txInfoRedeemers :: Map ScriptPurpose Redeemer
- txInfoData :: Map DatumHash Datum
- txInfoId :: TxId
- data TxOut = TxOut { }
-
data
TxOutRef
=
TxOutRef
{
- txOutRefId :: TxId
- txOutRefIdx :: Integer
- data TxInInfo = TxInInfo { }
- data OutputDatum
-
data
Interval
a =
Interval
{
- ivFrom :: LowerBound a
- ivTo :: UpperBound a
- data Extended a
- type Closure = Bool
- data UpperBound a = UpperBound ( Extended a) Closure
- data LowerBound a = LowerBound ( Extended a) Closure
- always :: Interval a
- from :: a -> Interval a
- to :: a -> Interval a
- lowerBound :: a -> LowerBound a
- upperBound :: a -> UpperBound a
- strictLowerBound :: a -> LowerBound a
- strictUpperBound :: a -> UpperBound a
- data Map k v
- fromList :: [(k, v)] -> Map k v
- newtype Validator = Validator { }
- mkValidatorScript :: CompiledCode ( BuiltinData -> BuiltinData -> BuiltinData -> ()) -> Validator
- unValidatorScript :: Validator -> Script
- newtype ValidatorHash = ValidatorHash BuiltinByteString
- newtype MintingPolicy = MintingPolicy { }
- mkMintingPolicyScript :: CompiledCode ( BuiltinData -> BuiltinData -> ()) -> MintingPolicy
- unMintingPolicyScript :: MintingPolicy -> Script
- newtype MintingPolicyHash = MintingPolicyHash BuiltinByteString
- newtype StakeValidator = StakeValidator { }
- mkStakeValidatorScript :: CompiledCode ( BuiltinData -> BuiltinData -> ()) -> StakeValidator
- unStakeValidatorScript :: StakeValidator -> Script
- newtype StakeValidatorHash = StakeValidatorHash BuiltinByteString
- newtype Redeemer = Redeemer { }
- newtype RedeemerHash = RedeemerHash BuiltinByteString
- newtype Datum = Datum { }
- newtype DatumHash = DatumHash BuiltinByteString
- newtype ScriptHash = ScriptHash { }
- data Data
- data BuiltinData = BuiltinData Data
-
class
ToData
a
where
- toBuiltinData :: a -> BuiltinData
-
class
FromData
a
where
- fromBuiltinData :: BuiltinData -> Maybe a
-
class
UnsafeFromData
a
where
- unsafeFromBuiltinData :: BuiltinData -> a
- toData :: ToData a => a -> Data
- fromData :: FromData a => Data -> Maybe a
- dataToBuiltinData :: Data -> BuiltinData
- builtinDataToData :: BuiltinData -> Data
- data EvaluationError
Scripts
type SerializedScript = ShortByteString Source #
Scripts to the ledger are serialised bytestrings.
A script on the chain. This is an opaque type as far as the chain is concerned.
Instances
Eq Script Source # |
Note [Using Flat inside CBOR instance of Script] `plutus-ledger` uses CBOR for data serialisation and `plutus-core` uses Flat. The choice to use Flat was made to have a more efficient (most wins are in uncompressed size) data serialisation format and use less space on-chain. To make `plutus-ledger` work with scripts serialised with Flat, and keep the CBOR format otherwise we have defined a Serialise instance for Script, which is a wrapper over Programs serialised with Flat. The instance will see programs as an opaque ByteString, which is the result of encoding programs using Flat. Because Flat is not self-describing and it gets used in the encoding of Programs, data structures that include scripts (for example, transactions) no-longer benefit for CBOR's ability to self-describe it's format. |
Ord Script Source # | |
Defined in Plutus.V1.Ledger.Scripts |
|
Show Script Source # | |
Generic Script Source # | |
NFData Script Source # | |
Defined in Plutus.V1.Ledger.Scripts |
|
Serialise Script Source # | |
type Rep Script Source # | |
Defined in Plutus.V1.Ledger.Scripts
type
Rep
Script
=
D1
('
MetaData
"Script" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" '
True
) (
C1
('
MetaCons
"Script" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"unScript") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Program
DeBruijn
DefaultUni
DefaultFun
()))))
|
fromCompiledCode :: CompiledCode a -> Script Source #
Turn a
CompiledCode
(usually produced by
compile
) into a
Script
for use with this package.
Validating scripts
isScriptWellFormed :: ProtocolVersion -> SerializedScript -> Bool Source #
Check if a
Script
is "valid" according to a protocol version. At the moment this means "deserialises correctly", which in particular
implies that it is (almost certainly) an encoded script and the script does not mention any builtins unavailable in the given protocol version.
Running scripts
evaluateScriptRestricting Source #
Arguments
:: ProtocolVersion | |
-> VerboseMode |
Whether to produce log output |
-> EvaluationContext |
The cost model that should already be synced to the most recent cost-model-params coming from the current protocol |
-> ExBudget |
The resource budget which must not be exceeded during evaluation |
-> SerializedScript |
The script to evaluate |
-> [ Data ] |
The arguments to the script |
-> ( LogOutput , Either EvaluationError ExBudget ) |
Evaluates a script, with a cost model and a budget that restricts how many resources it can use according to the cost model. Also returns the budget that was actually used.
Can be used to calculate budgets for scripts, but even in this case you must give a limit to guard against scripts that run for a long time or loop.
evaluateScriptCounting Source #
Arguments
:: ProtocolVersion | |
-> VerboseMode |
Whether to produce log output |
-> EvaluationContext |
The cost model that should already be synced to the most recent cost-model-params coming from the current protocol |
-> SerializedScript |
The script to evaluate |
-> [ Data ] |
The arguments to the script |
-> ( LogOutput , Either EvaluationError ExBudget ) |
Evaluates a script, returning the minimum budget that the script would need
to evaluate successfully. This will take as long as the script takes, if you need to
limit the execution time of the script also, you can use
evaluateScriptRestricting
, which
also returns the used budget.
Protocol version
data ProtocolVersion Source #
This represents the Cardano protocol version, with its major and minor components. This relies on careful understanding between us and the ledger as to what this means.
Constructors
ProtocolVersion | |
Instances
Eq ProtocolVersion Source # | |
Defined in Plutus.ApiCommon Methods (==) :: ProtocolVersion -> ProtocolVersion -> Bool Source # (/=) :: ProtocolVersion -> ProtocolVersion -> Bool Source # |
|
Ord ProtocolVersion Source # | |
Defined in Plutus.ApiCommon Methods compare :: ProtocolVersion -> ProtocolVersion -> Ordering Source # (<) :: ProtocolVersion -> ProtocolVersion -> Bool Source # (<=) :: ProtocolVersion -> ProtocolVersion -> Bool Source # (>) :: ProtocolVersion -> ProtocolVersion -> Bool Source # (>=) :: ProtocolVersion -> ProtocolVersion -> Bool Source # max :: ProtocolVersion -> ProtocolVersion -> ProtocolVersion Source # min :: ProtocolVersion -> ProtocolVersion -> ProtocolVersion Source # |
|
Show ProtocolVersion Source # | |
Defined in Plutus.ApiCommon |
|
Pretty ProtocolVersion Source # | |
Defined in Plutus.ApiCommon Methods pretty :: ProtocolVersion -> Doc ann Source # prettyList :: [ ProtocolVersion ] -> Doc ann Source # |
Verbose mode and log output
data VerboseMode Source #
A simple toggle indicating whether or not we should produce logs.
Instances
Eq VerboseMode Source # | |
Defined in Plutus.ApiCommon Methods (==) :: VerboseMode -> VerboseMode -> Bool Source # (/=) :: VerboseMode -> VerboseMode -> Bool Source # |
Costing-related types
Constructors
ExBudget | |
Fields |
Instances
Eq ExBudget | |
Show ExBudget | |
Generic ExBudget | |
Semigroup ExBudget | |
Monoid ExBudget | |
ToJSON ExBudget | |
FromJSON ExBudget | |
NFData ExBudget | |
Defined in PlutusCore.Evaluation.Machine.ExBudget |
|
NoThunks ExBudget | |
Pretty ExBudget | |
Lift ExBudget | |
PrettyBy config ExBudget | |
type Rep ExBudget | |
Defined in PlutusCore.Evaluation.Machine.ExBudget
type
Rep
ExBudget
=
D1
('
MetaData
"ExBudget" "PlutusCore.Evaluation.Machine.ExBudget" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" '
False
) (
C1
('
MetaCons
"ExBudget" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"exBudgetCPU") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedUnpack
) (
Rec0
ExCPU
)
:*:
S1
('
MetaSel
('
Just
"exBudgetMemory") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedUnpack
) (
Rec0
ExMemory
)))
|
Counts CPU units in picoseconds: maximum value for SatInt is 2^63 ps, or appproximately 106 days.
Constructors
ExCPU CostingInteger |
Instances
Eq ExCPU | |
Num ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory |
|
Ord ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory |
|
Show ExCPU | |
Generic ExCPU | |
Semigroup ExCPU | |
Monoid ExCPU | |
ToJSON ExCPU | |
FromJSON ExCPU | |
NFData ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory |
|
NoThunks ExCPU | |
Pretty ExCPU | |
Lift ExCPU | |
PrettyBy config ExCPU | |
type Rep ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory
type
Rep
ExCPU
=
D1
('
MetaData
"ExCPU" "PlutusCore.Evaluation.Machine.ExMemory" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" '
True
) (
C1
('
MetaCons
"ExCPU" '
PrefixI
'
False
) (
S1
('
MetaSel
('
Nothing
::
Maybe
Symbol
) '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
CostingInteger
)))
|
Counts size in machine words.
Constructors
ExMemory CostingInteger |
Instances
Instances
Cost model
data EvaluationContext Source #
An opaque type that contains all the static parameters that the evaluator needs to evaluate a script. This is so that they can be computed once and cached, rather than recomputed on every evaluation.
There are two sets of parameters: one is with immediate unlifting and the other one is with deferred unlifting. We have to keep both of them, because depending on the language version either one has to be used or the other. We also compile them separately due to all the inlining and optimization that need to happen for things to be efficient.
Instances
Generic EvaluationContext Source # | |
Defined in Plutus.ApiCommon Methods from :: EvaluationContext -> Rep EvaluationContext x Source # to :: Rep EvaluationContext x -> EvaluationContext Source # |
|
NFData EvaluationContext Source # | |
Defined in Plutus.ApiCommon Methods rnf :: EvaluationContext -> () Source # |
|
NoThunks EvaluationContext Source # | |
Defined in Plutus.ApiCommon |
|
type Rep EvaluationContext Source # | |
Defined in Plutus.ApiCommon
type
Rep
EvaluationContext
=
D1
('
MetaData
"EvaluationContext" "Plutus.ApiCommon" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" '
False
) (
C1
('
MetaCons
"EvaluationContext" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"machineParametersImmediate") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedStrict
) (
Rec0
DefaultMachineParameters
)
:*:
S1
('
MetaSel
('
Just
"machineParametersDeferred") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedStrict
) (
Rec0
DefaultMachineParameters
)))
|
mkEvaluationContext :: MonadError CostModelApplyError m => CostModelParams -> m EvaluationContext Source #
Build the
EvaluationContext
.
The input is a
Map
of strings to cost integer values (aka
CostModelParams
,
CostModel
)
See Note [Inlining meanings of builtins].
data CostModelApplyError Source #
The type of errors that
applyParams
can throw.
Constructors
CMUnknownParamError Text |
a costmodel parameter with the give name does not exist in the costmodel to be applied upon |
CMInternalReadError |
internal error when we are transforming the applyParams' input to json (should not happen) |
CMInternalWriteError String |
internal error when we are transforming the applied params from json with given jsonstring error (should not happen) |
Instances
Show CostModelApplyError | |
|
|
Exception CostModelApplyError | |
Defined in PlutusCore.Evaluation.Machine.CostModelInterface Methods toException :: CostModelApplyError -> SomeException Source # fromException :: SomeException -> Maybe CostModelApplyError Source # |
|
Pretty CostModelApplyError | |
Defined in PlutusCore.Evaluation.Machine.CostModelInterface Methods pretty :: CostModelApplyError -> Doc ann Source # prettyList :: [ CostModelApplyError ] -> Doc ann Source # |
assertWellFormedCostModelParams :: MonadError CostModelApplyError m => CostModelParams -> m () Source #
Comparably expensive to
mkEvaluationContext
, so it should only be used sparingly.
costModelParamNames :: Set Text Source #
The set of valid names that a cost model parameter can take for this language version.
It is used for the deserialization of
CostModelParams
.
Context types
data ScriptContext Source #
Constructors
ScriptContext | |
Fields |
Instances
data ScriptPurpose Source #
Purpose of the script that is currently running
Constructors
Minting CurrencySymbol | |
Spending TxOutRef | |
Rewarding StakingCredential | |
Certifying DCert |
Instances
Supporting types used in the context types
ByteStrings
data BuiltinByteString Source #
An opaque type representing Plutus Core ByteStrings.
Instances
fromBuiltin :: FromBuiltin arep a => arep -> a Source #
Bytes
newtype LedgerBytes Source #
Constructors
LedgerBytes | |
Fields |
Instances
fromBytes :: ByteString -> LedgerBytes Source #
Certificates
A representation of the ledger DCert. Some information is digested, and not included
Constructors
DCertDelegRegKey StakingCredential | |
DCertDelegDeRegKey StakingCredential | |
DCertDelegDelegate | |
Fields
|
|
DCertPoolRegister |
A digest of the PoolParams |
Fields
|
|
DCertPoolRetire PubKeyHash Integer |
The retiremant certificate and the Epoch N |
DCertGenesis |
A really terse Digest |
DCertMir |
Another really terse Digest |
Instances
Credentials
data StakingCredential Source #
Staking credential used to assign rewards
Constructors
StakingHash Credential | |
StakingPtr Integer Integer Integer |
Instances
data Credential Source #
Credential required to unlock a transaction output
Constructors
PubKeyCredential PubKeyHash |
The transaction that spends this output must be signed by the private key |
ScriptCredential ValidatorHash |
The transaction that spends this output must include the validator script and be accepted by the validator. |
Instances
Value
A cryptocurrency value. This is a map from
CurrencySymbol
s to a
quantity of that currency.
Operations on currencies are usually implemented
pointwise
. That is,
we apply the operation to the quantities for each currency in turn. So
when we add two
Value
s the resulting
Value
has, for each currency,
the sum of the quantities of
that particular
currency in the argument
Value
. The effect of this is that the currencies in the
Value
are "independent",
and are operated on separately.
Whenever we need to get the quantity of a currency in a
Value
where there
is no explicit quantity of that currency in the
Value
, then the quantity is
taken to be zero.
See note [Currencies] for more details.
Instances
newtype CurrencySymbol Source #
Constructors
CurrencySymbol | |
Fields |
Instances
ByteString of a name of a token, shown as UTF-8 string when possible
Constructors
TokenName | |
Fields |
Instances
singleton :: CurrencySymbol -> TokenName -> Integer -> Value Source #
Make a
Value
containing only the given quantity of the given currency.
adaSymbol :: CurrencySymbol Source #
The
CurrencySymbol
of the
Ada
currency.
Time
POSIX time is measured as the number of milliseconds since 1970-01-01T00:00:00Z
Constructors
POSIXTime | |
Fields |
Instances
Types for representing transactions
Address with two kinds of credentials, normal and staking.
Constructors
Address | |
Instances
newtype PubKeyHash Source #
The hash of a public key. This is frequently used to identify the public key, rather than the key itself.
Constructors
PubKeyHash | |
Fields |
Instances
A transaction ID, using a SHA256 hash as the transaction id.
Constructors
TxId | |
Fields |
Instances
A pending transaction. This is the view as seen by validator scripts, so some details are stripped out.
Constructors
TxInfo | |
Fields
|
Instances
A transaction output, consisting of a target address, a value, optionally a datum/datum hash, and optionally a reference script.
Constructors
TxOut | |
Fields |
Instances
A reference to a transaction output. This is a pair of a transaction reference, and an index indicating which of the outputs of that transaction we are referring to.
Constructors
TxOutRef | |
Fields
|
Instances
An input of a pending transaction.
Constructors
TxInInfo | |
Fields |
Instances
data OutputDatum Source #
The datum attached to an output: either nothing; a datum hash; or the datum itself (an "inline datum").
Constructors
NoOutputDatum | |
OutputDatumHash DatumHash | |
OutputDatum Datum |
Instances
Intervals
An interval of
a
s.
The interval may be either closed or open at either end, meaning that the endpoints may or may not be included in the interval.
The interval can also be unbounded on either side.
Constructors
Interval | |
Fields
|
Instances
A set extended with a positive and negative infinity.
Instances
data UpperBound a Source #
The upper bound of an interval.
Constructors
UpperBound ( Extended a) Closure |
Instances
data LowerBound a Source #
The lower bound of an interval.
Constructors
LowerBound ( Extended a) Closure |
Instances
from :: a -> Interval a Source #
from a
is an
Interval
that includes all values that are
greater than or equal to
a
.
to :: a -> Interval a Source #
to a
is an
Interval
that includes all values that are
smaller than or equal to
a
.
lowerBound :: a -> LowerBound a Source #
upperBound :: a -> UpperBound a Source #
strictLowerBound :: a -> LowerBound a Source #
strictUpperBound :: a -> UpperBound a Source #
Association maps
A
Map
of key-value pairs.
Instances
Lift DefaultUni [(k, v)] => Lift DefaultUni ( Map k v) | |
Defined in PlutusTx.AssocMap Methods lift :: Map k v -> RTCompile DefaultUni fun ( Term TyName Name DefaultUni fun ()) Source # |
|
Traversable ( Map k) | |
Defined in PlutusTx.AssocMap |
|
Foldable ( Map k) | |
Functor ( Map k) | |
( Eq k, Eq v) => Eq ( Map k v) | |
( Data k, Data v) => Data ( Map k v) | |
Defined in PlutusTx.AssocMap Methods gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Map k v -> c ( Map k v) Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( Map k v) Source # toConstr :: Map k v -> Constr Source # dataTypeOf :: Map k v -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( Map k v)) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ( Map k v)) Source # gmapT :: ( forall b. Data b => b -> b) -> Map k v -> Map k v Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Map k v -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Map k v -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> Map k v -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> Map k v -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Map k v -> m ( Map k v) Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Map k v -> m ( Map k v) Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Map k v -> m ( Map k v) Source # |
|
( Show k, Show v) => Show ( Map k v) | |
Generic ( Map k v) | |
( NFData k, NFData v) => NFData ( Map k v) | |
Defined in PlutusTx.AssocMap |
|
( Pretty k, Pretty v) => Pretty ( Map k v) | |
( ToData k, ToData v) => ToData ( Map k v) | |
Defined in PlutusTx.AssocMap Methods toBuiltinData :: Map k v -> BuiltinData Source # |
|
( FromData k, FromData v) => FromData ( Map k v) | |
Defined in PlutusTx.AssocMap Methods fromBuiltinData :: BuiltinData -> Maybe ( Map k v) Source # |
|
( UnsafeFromData k, UnsafeFromData v) => UnsafeFromData ( Map k v) | |
Defined in PlutusTx.AssocMap Methods unsafeFromBuiltinData :: BuiltinData -> Map k v Source # |
|
( Eq k, Semigroup v) => Monoid ( Map k v) | |
Defined in PlutusTx.AssocMap |
|
( Eq k, Semigroup v) => Semigroup ( Map k v) | |
( Ord k, Ord v) => Ord ( Map k v) | |
Defined in PlutusTx.AssocMap |
|
( Eq k, Eq v) => Eq ( Map k v) | |
Typeable DefaultUni Map | |
Defined in PlutusTx.AssocMap Methods typeRep :: Proxy Map -> RTCompile DefaultUni fun ( Type TyName DefaultUni ()) Source # |
|
type Rep ( Map k v) | |
Defined in PlutusTx.AssocMap |
Newtypes for script/datum types and hash types
Constructors
Validator | |
Fields |
Instances
Eq Validator Source # | |
Ord Validator Source # | |
Defined in Plutus.V1.Ledger.Scripts Methods compare :: Validator -> Validator -> Ordering Source # (<) :: Validator -> Validator -> Bool Source # (<=) :: Validator -> Validator -> Bool Source # (>) :: Validator -> Validator -> Bool Source # (>=) :: Validator -> Validator -> Bool Source # |
|
Show Validator Source # | |
Generic Validator Source # | |
NFData Validator Source # | |
Defined in Plutus.V1.Ledger.Scripts |
|
Pretty Validator Source # | |
Serialise Validator Source # | |
type Rep Validator Source # | |
Defined in Plutus.V1.Ledger.Scripts
type
Rep
Validator
=
D1
('
MetaData
"Validator" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-GlUFhIIE0LJGuJDDdHh5lQ" '
True
) (
C1
('
MetaCons
"Validator" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"getValidator") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
Script
)))
|
mkValidatorScript :: CompiledCode ( BuiltinData -> BuiltinData -> BuiltinData -> ()) -> Validator Source #
unValidatorScript :: Validator -> Script Source #
newtype ValidatorHash Source #
Script runtime representation of a
Digest SHA256
.
Constructors
ValidatorHash BuiltinByteString |
Instances
newtype MintingPolicy Source #
MintingPolicy
is a wrapper around
Script
s which are used as validators for minting constraints.
Constructors
MintingPolicy | |
Fields |
Instances
mkMintingPolicyScript :: CompiledCode ( BuiltinData -> BuiltinData -> ()) -> MintingPolicy Source #
newtype MintingPolicyHash Source #
Script runtime representation of a
Digest SHA256
.
Constructors
MintingPolicyHash BuiltinByteString |
Instances
newtype StakeValidator Source #
StakeValidator
is a wrapper around
Script
s which are used as validators for withdrawals and stake address certificates.
Constructors
StakeValidator | |
Fields |
Instances
mkStakeValidatorScript :: CompiledCode ( BuiltinData -> BuiltinData -> ()) -> StakeValidator Source #
newtype StakeValidatorHash Source #
Script runtime representation of a
Digest SHA256
.
Constructors
StakeValidatorHash BuiltinByteString |
Instances
Redeemer
is a wrapper around
Data
values that are used as redeemers in transaction inputs.
Constructors
Redeemer | |
Fields |
Instances
newtype RedeemerHash Source #
Script runtime representation of a
Digest SHA256
.
Constructors
RedeemerHash BuiltinByteString |
Instances
Datum
is a wrapper around
Data
values which are used as data in transaction outputs.
Constructors
Datum | |
Fields |
Instances
Script runtime representation of a
Digest SHA256
.
Constructors
DatumHash BuiltinByteString |
Instances
newtype ScriptHash Source #
Script runtime representation of a
Digest SHA256
.
Constructors
ScriptHash | |
Fields |
Instances
Data
A generic "data" type.
The main constructor
Constr
represents a datatype value in sum-of-products
form:
Constr i args
represents a use of the
i
th constructor along with its arguments.
The other constructors are various primitives.
Instances
data BuiltinData Source #
A type corresponding to the Plutus Core builtin equivalent of
Data
.
The point of this type is to be an opaque equivalent of
Data
, so as to
ensure that it is only used in ways that the compiler can handle.
As such, you should use this type in your on-chain code, and in any data structures that you want to be representable on-chain.
For off-chain usage, there are conversion functions
builtinDataToData
and
dataToBuiltinData
, but note that these will not work on-chain.
Constructors
BuiltinData Data |
Instances
A typeclass for types that can be converted to and from
BuiltinData
.
Instances
class FromData a where Source #
Methods
fromBuiltinData :: BuiltinData -> Maybe a Source #
Convert a value from
BuiltinData
, returning
Nothing
if this fails.
Instances
class UnsafeFromData a where Source #
Methods
unsafeFromBuiltinData :: BuiltinData -> a Source #
Convert a value from
BuiltinData
, calling
error
if this fails.
This is typically much faster than
fromBuiltinData
.
When implementing this function, make sure to call
unsafeFromBuiltinData
rather than
fromBuiltinData
when converting substructures!
Instances
dataToBuiltinData :: Data -> BuiltinData Source #
Convert a
Data
into a
BuiltinData
. Only works off-chain.
builtinDataToData :: BuiltinData -> Data Source #
Convert a
BuiltinData
into a
Data
. Only works off-chain.
Errors
data EvaluationError Source #
Errors that can be thrown when evaluating a Plutus script.
Constructors
CekError ( CekEvaluationException NamedDeBruijn DefaultUni DefaultFun ) |
An error from the evaluator itself |
DeBruijnError FreeVariableError |
An error in the pre-evaluation step of converting from de-Bruijn indices |
CodecError DeserialiseFailure |
A serialisation error |
IncompatibleVersionError ( Version ()) |
An error indicating a version tag that we don't support TODO: make this error more informative when we have more information about what went wrong |
CostModelParameterMismatch |
An error indicating that the cost model parameters didn't match what we expected |
Instances
Eq EvaluationError Source # | |
Defined in Plutus.ApiCommon Methods (==) :: EvaluationError -> EvaluationError -> Bool Source # (/=) :: EvaluationError -> EvaluationError -> Bool Source # |
|
Show EvaluationError Source # | |
Defined in Plutus.ApiCommon |
|
Pretty EvaluationError Source # | |
Defined in Plutus.ApiCommon Methods pretty :: EvaluationError -> Doc ann Source # prettyList :: [ EvaluationError ] -> Doc ann Source # |