plutus-tx-constraints-1.1.0.0: Plutus Transaction Constraints
Safe HaskellNone
LanguageHaskell2010

Ledger.Tx.Constraints.OffChain

Synopsis

Lookups

data ScriptLookups a Source #

Constructors

ScriptLookups 

Fields

Instances

Instances details
Show (ScriptLookups a) 
Instance details

Defined in Ledger.Constraints.OffChain

Generic (ScriptLookups a) 
Instance details

Defined in Ledger.Constraints.OffChain

Associated Types

type Rep (ScriptLookups a) :: Type -> Type Source #

Semigroup (ScriptLookups a) 
Instance details

Defined in Ledger.Constraints.OffChain

Monoid (ScriptLookups a) 
Instance details

Defined in Ledger.Constraints.OffChain

ToJSON (ScriptLookups a) 
Instance details

Defined in Ledger.Constraints.OffChain

FromJSON (ScriptLookups a) 
Instance details

Defined in Ledger.Constraints.OffChain

type Rep (ScriptLookups a) 
Instance details

Defined in Ledger.Constraints.OffChain

type Rep (ScriptLookups a) = D1 ('MetaData "ScriptLookups" "Ledger.Constraints.OffChain" "plutus-ledger-constraints-1.1.0.0-2F6ljas7ShDIbSk2Pv4wJR" 'False) (C1 ('MetaCons "ScriptLookups" 'PrefixI 'True) ((S1 ('MetaSel ('Just "slTxOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map TxOutRef DecoratedTxOut)) :*: (S1 ('MetaSel ('Just "slOtherScripts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map ScriptHash (Versioned Script))) :*: S1 ('MetaSel ('Just "slOtherData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map DatumHash Datum)))) :*: ((S1 ('MetaSel ('Just "slPaymentPubKeyHashes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set PaymentPubKeyHash)) :*: S1 ('MetaSel ('Just "slTypedValidator") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (TypedValidator a)))) :*: (S1 ('MetaSel ('Just "slOwnPaymentPubKeyHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe PaymentPubKeyHash)) :*: S1 ('MetaSel ('Just "slOwnStakingCredential") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe StakingCredential))))))

typedValidatorLookups :: TypedValidator a -> ScriptLookups a Source #

A script lookups value with a script instance. For convenience this also includes the minting policy script that forwards all checks to the instance's validator.

If called multiple times, only the first typed validator is kept:

typedValidatorLookups tv1 <> typedValidatorLookups tv2 <> ...
    == typedValidatorLookups tv1

unspentOutputs :: Map TxOutRef DecoratedTxOut -> ScriptLookups a Source #

A script lookups value that uses the map of unspent outputs to resolve input constraints.

mintingPolicy :: Versioned MintingPolicy -> ScriptLookups a Source #

A script lookups value with a versioned minting policy script.

plutusV1MintingPolicy :: MintingPolicy -> ScriptLookups a Source #

A script lookups value with a PlutusV1 minting policy script.

plutusV2MintingPolicy :: MintingPolicy -> ScriptLookups a Source #

A script lookups value with a PlutusV2 minting policy script.

otherScript :: Versioned Validator -> ScriptLookups a Source #

A script lookups value with a versioned validator script.

plutusV1OtherScript :: Validator -> ScriptLookups a Source #

A script lookups value with a PlutusV1 validator script.

plutusV2OtherScript :: Validator -> ScriptLookups a Source #

A script lookups value with a PlutusV2 validator script.

otherData :: Datum -> ScriptLookups a Source #

A script lookups value with a datum.

ownPaymentPubKeyHash :: PaymentPubKeyHash -> ScriptLookups a Source #

A script lookups value with a payment public key hash.

If called multiple times, only the first payment public key hash is kept:

ownPaymentPubKeyHash pkh1 <> ownPaymentPubKeyHash pkh2 <> ...
    == ownPaymentPubKeyHash pkh1

ownStakingCredential :: StakingCredential -> ScriptLookups a Source #

A script lookups value with staking credentials.

If called multiple times, only the first staking credential is kept:

ownStakingCredential skh1 <> ownStakingCredential skh2 <> ...
    == ownStakingCredential skh1

paymentPubKey :: PaymentPubKey -> ScriptLookups a Source #

A script lookups value with a payment public key

paymentPubKeyHash :: PaymentPubKeyHash -> ScriptLookups a Source #

A script lookups value with a payment public key

Constraints resolution

data UnbalancedTx Source #

An unbalanced transaction. It needs to be balanced and signed before it can be submitted to the ledger. See note [Submitting transactions from Plutus contracts] in Wallet.

Constructors

UnbalancedEmulatorTx 

Fields

UnbalancedCardanoTx 

Fields

Instances

Instances details
Eq UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

Show UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

Generic UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

Associated Types

type Rep UnbalancedTx :: Type -> Type Source #

ToJSON UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

FromJSON UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

ToSchema UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

Pretty UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

type Rep UnbalancedTx 
Instance details

Defined in Ledger.Constraints.OffChain

type Rep UnbalancedTx = D1 ('MetaData "UnbalancedTx" "Ledger.Constraints.OffChain" "plutus-ledger-constraints-1.1.0.0-2F6ljas7ShDIbSk2Pv4wJR" 'False) (C1 ('MetaCons "UnbalancedEmulatorTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBalancedEmulatorTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Tx) :*: (S1 ('MetaSel ('Just "unBalancedTxRequiredSignatories") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set PaymentPubKeyHash)) :*: S1 ('MetaSel ('Just "unBalancedTxUtxoIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map TxOutRef TxOut)))) :+: C1 ('MetaCons "UnbalancedCardanoTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBalancedCardanoBuildTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CardanoBuildTx) :*: S1 ('MetaSel ('Just "unBalancedTxUtxoIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map TxOutRef TxOut))))

adjustUnbalancedTx :: PParams -> UnbalancedTx -> Either ToCardanoError ([Ada], UnbalancedTx) Source #

Each transaction output should contain a minimum amount of Ada (this is a restriction on the real Cardano network).

data MkTxError Source #

Instances

Instances details
Eq MkTxError Source # 
Instance details

Defined in Ledger.Tx.Constraints.OffChain

Show MkTxError Source # 
Instance details

Defined in Ledger.Tx.Constraints.OffChain

Generic MkTxError Source # 
Instance details

Defined in Ledger.Tx.Constraints.OffChain

Associated Types

type Rep MkTxError :: Type -> Type Source #

ToJSON MkTxError Source # 
Instance details

Defined in Ledger.Tx.Constraints.OffChain

FromJSON MkTxError Source # 
Instance details

Defined in Ledger.Tx.Constraints.OffChain

Pretty MkTxError Source # 
Instance details

Defined in Ledger.Tx.Constraints.OffChain

Methods

pretty :: MkTxError -> Doc ann Source #

prettyList :: [MkTxError] -> Doc ann Source #

type Rep MkTxError Source # 
Instance details

Defined in Ledger.Tx.Constraints.OffChain

type Rep MkTxError = D1 ('MetaData "MkTxError" "Ledger.Tx.Constraints.OffChain" "plutus-tx-constraints-1.1.0.0-G6OZg6WZdhpF1XLKYvmpKR" 'False) (C1 ('MetaCons "ToCardanoError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ToCardanoError)) :+: C1 ('MetaCons "LedgerMkTxError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MkTxError)))

mkTx :: (FromData (DatumType a), ToData (DatumType a), ToData (RedeemerType a)) => Params -> ScriptLookups a -> TxConstraints (RedeemerType a) (DatumType a) -> Either MkTxError UnbalancedTx Source #

Turn a TxConstraints value into an unbalanced transaction that satisfies the constraints. To use this in a contract, see submitTxConstraints and related functions.

mkSomeTx :: Params -> [SomeLookupsAndConstraints] -> Either MkTxError UnbalancedTx Source #

Given a list of SomeLookupsAndConstraints describing the constraints for several scripts, build a single transaction that runs all the scripts.