plutus-tx-constraints-1.2.0.0: Plutus Transaction Constraints
Safe Haskell None
Language Haskell2010

Ledger.Tx.Constraints.TxConstraints

Description

Constraints for transactions

Synopsis

Documentation

data TxOutDatum datum Source #

How tx outs datum are embedded in a a Tx

We do not use TxOutDatum from cardano-node to provide easier to handel type (we don't type witnesses) and to have a distinction at the type leve between constraints that require a Datum and constraints (like MustPayToOtherScript ) with an optional datum (like MustPayToPubKeyAddress ).

Constructors

TxOutDatumHash datum

A datum specified in a transaction output using only it's hash, i.e. the datum is not inlined nor is it added in the transaction body.

TxOutDatumInTx datum

A datum specified in a transaction output using it's hash, while also adding the actual datum in the transaction body.

TxOutDatumInline datum

A datum inlined in a transaction output. It is *not* added in the transaction body.

Instances

Instances details
Functor TxOutDatum Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Functor TxOutDatum Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Eq datum => Eq ( TxOutDatum datum) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Show datum => Show ( TxOutDatum datum) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Generic ( TxOutDatum datum) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Associated Types

type Rep ( TxOutDatum datum) :: Type -> Type Source #

ToJSON datum => ToJSON ( TxOutDatum datum) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

FromJSON datum => FromJSON ( TxOutDatum datum) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Pretty d => Pretty ( TxOutDatum d) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Eq d => Eq ( TxOutDatum d) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep ( TxOutDatum datum) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

data TxConstraint Source #

Constraints on transactions that want to spend script outputs

Constructors

MustIncludeDatumInTxWithHash DatumHash Datum

The provided DatumHash and Datum must be included in the transaction body. Like MustIncludeDatumInTx , but useful when you already have a DatumHash and want to make sure that is is the actual hash of the Datum .

MustIncludeDatumInTx Datum

Like MustHashDatum , but the hash of the Datum is computed automatically.

MustValidateInTimeRange !( ValidityInterval POSIXTime )

The transaction's validity range must be set with the given POSIXTimeRange .

MustBeSignedBy PaymentPubKeyHash

The transaction must add the given PaymentPubKeyHash in its signatories.

MustSpendAtLeast Value

The sum of the transaction's input Value s must be at least as much as the given Value .

MustProduceAtLeast Value

The sum of the transaction's output Value s must be at least as much as the given Value .

MustSpendPubKeyOutput TxOutRef

The transaction must spend the given unspent transaction public key output.

MustSpendScriptOutput TxOutRef Redeemer ( Maybe TxOutRef )

The transaction must spend the given unspent transaction script output.

MustUseOutputAsCollateral TxOutRef

The transaction must include the utxo as collateral input.

MustReferenceOutput TxOutRef

The transaction must reference (not spend) the given unspent transaction output.

MustMintValue MintingPolicyHash Redeemer TokenName Integer ( Maybe TxOutRef )

The transaction must mint the given token and amount.

MustPayToAddress Address ( Maybe ( TxOutDatum Datum )) ( Maybe ScriptHash ) Value

The transaction must create a transaction output.

MustSatisfyAnyOf [[ TxConstraint ]]

The transaction must satisfy constraints given as an alternative of conjuctions (DNF), that is `check (MustSatisfyAnyOf xs) = any (all check) xs`

Instances

Instances details
Eq TxConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Show TxConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Generic TxConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

ToJSON TxConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

FromJSON TxConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Pretty TxConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep TxConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep TxConstraint = D1 (' MetaData "TxConstraint" "Ledger.Tx.Constraints.TxConstraints" "plutus-tx-constraints-1.2.0.0-5XBz5Nhh1is2GnetLpxiQv" ' False ) ((( C1 (' MetaCons "MustIncludeDatumInTxWithHash" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 DatumHash ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Datum )) :+: ( C1 (' MetaCons "MustIncludeDatumInTx" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Datum )) :+: C1 (' MetaCons "MustValidateInTimeRange" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( ValidityInterval POSIXTime ))))) :+: ( C1 (' MetaCons "MustBeSignedBy" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 PaymentPubKeyHash)) :+: ( C1 (' MetaCons "MustSpendAtLeast" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Value )) :+: C1 (' MetaCons "MustProduceAtLeast" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Value ))))) :+: (( C1 (' MetaCons "MustSpendPubKeyOutput" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxOutRef )) :+: ( C1 (' MetaCons "MustSpendScriptOutput" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxOutRef ) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Redeemer ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Maybe TxOutRef )))) :+: C1 (' MetaCons "MustUseOutputAsCollateral" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxOutRef )))) :+: (( C1 (' MetaCons "MustReferenceOutput" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxOutRef )) :+: C1 (' MetaCons "MustMintValue" ' PrefixI ' False ) (( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 MintingPolicyHash ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Redeemer )) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TokenName ) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Integer ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Maybe TxOutRef )))))) :+: ( C1 (' MetaCons "MustPayToAddress" ' PrefixI ' False ) (( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Address ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Maybe ( TxOutDatum Datum )))) :*: ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Maybe ScriptHash )) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Value ))) :+: C1 (' MetaCons "MustSatisfyAnyOf" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [[ TxConstraint ]]))))))

data TxConstraintFun Source #

Constraints on transactions that contain functions. These don't support conversion to and from JSON.

Constructors

MustSpendScriptOutputWithMatchingDatumAndValue ValidatorHash ( Datum -> Bool ) ( Value -> Bool ) Redeemer

The transaction must spend a script output from the given script address which matches the Datum and Value predicates.

newtype TxConstraintFuns Source #

Instances

Instances details
Show TxConstraintFuns Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Generic TxConstraintFuns Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

ToJSON TxConstraintFuns Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

FromJSON TxConstraintFuns Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Monoid TxConstraintFuns Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Semigroup TxConstraintFuns Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep TxConstraintFuns Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep TxConstraintFuns = D1 (' MetaData "TxConstraintFuns" "Ledger.Tx.Constraints.TxConstraints" "plutus-tx-constraints-1.2.0.0-5XBz5Nhh1is2GnetLpxiQv" ' True ) ( C1 (' MetaCons "TxConstraintFuns" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ TxConstraintFun ])))

data ScriptInputConstraint a Source #

Constraint which specifies that the transaction must spend a transaction output from a target script.

Constructors

ScriptInputConstraint

Fields

Instances

Instances details
Functor ScriptInputConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Eq a => Eq ( ScriptInputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Show a => Show ( ScriptInputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Generic ( ScriptInputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

ToJSON a => ToJSON ( ScriptInputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

FromJSON a => FromJSON ( ScriptInputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Pretty a => Pretty ( ScriptInputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep ( ScriptInputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep ( ScriptInputConstraint a) = D1 (' MetaData "ScriptInputConstraint" "Ledger.Tx.Constraints.TxConstraints" "plutus-tx-constraints-1.2.0.0-5XBz5Nhh1is2GnetLpxiQv" ' False ) ( C1 (' MetaCons "ScriptInputConstraint" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "icRedeemer") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 a) :*: ( S1 (' MetaSel (' Just "icTxOutRef") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxOutRef ) :*: S1 (' MetaSel (' Just "icReferenceTxOutRef") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Maybe TxOutRef )))))

mustSpendOutputFromTheScript :: TxOutRef -> i -> TxConstraints i o Source #

mustSpendOutputFromTheScript txOutRef red spends the transaction output txOutRef with a script address using the redeemer red .

If used in OffChain , this constraint spends a script output txOutRef with redeemer red . The script address is derived from the typed validator that is provided in the ScriptLookups with typedValidatorLookups .

If used in OnChain , this constraint verifies that the spend script transaction output with red is part of the transaction's inputs.

data ScriptOutputConstraint a Source #

Constructors

ScriptOutputConstraint

Fields

Instances

Instances details
Functor ScriptOutputConstraint Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Eq a => Eq ( ScriptOutputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Show a => Show ( ScriptOutputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Generic ( ScriptOutputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

ToJSON a => ToJSON ( ScriptOutputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

FromJSON a => FromJSON ( ScriptOutputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Pretty a => Pretty ( ScriptOutputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep ( ScriptOutputConstraint a) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep ( ScriptOutputConstraint a) = D1 (' MetaData "ScriptOutputConstraint" "Ledger.Tx.Constraints.TxConstraints" "plutus-tx-constraints-1.2.0.0-5XBz5Nhh1is2GnetLpxiQv" ' False ) ( C1 (' MetaCons "ScriptOutputConstraint" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "ocDatum") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( TxOutDatum a)) :*: ( S1 (' MetaSel (' Just "ocValue") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Value ) :*: S1 (' MetaSel (' Just "ocReferenceScriptHash") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Maybe ScriptHash )))))

data TxConstraints i o Source #

Restrictions placed on the allocation of funds to outputs of transactions.

Instances

Instances details
Bifunctor TxConstraints Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

( Show i, Show o) => Show ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Generic ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Associated Types

type Rep ( TxConstraints i o) :: Type -> Type Source #

Semigroup ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Monoid ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

( ToJSON i, ToJSON o) => ToJSON ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

( FromJSON i, FromJSON o) => FromJSON ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Monoid ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

Semigroup ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

type Rep ( TxConstraints i o) Source #
Instance details

Defined in Ledger.Tx.Constraints.TxConstraints

mustValidateIn :: forall i o. POSIXTimeRange -> TxConstraints i o Source #

Deprecated: Please use mustValidateInTimeRange or mustValidateInSlotRange instead

mustValidateIn r requires the transaction's validity time range to be contained in POSIXTimeRange r .

If used in OffChain , this constraint sets the transaction's validity time range to r .

If used in OnChain , this constraint verifies that the time range r is entirely contained in the transaction's validity time range.

mustValidateInTimeRange :: forall i o. ValidityInterval POSIXTime -> TxConstraints i o Source #

mustValidateInTimeRange r requires the transaction's validity time range to be contained in POSIXTime range r .

If used in OffChain , this constraint sets the transaction's validity time range to r .

If used in OnChain , this constraint verifies that the time range r is entirely contained in the transaction's validity time range.

mustValidateInSlotRange :: forall i o. ValidityInterval Slot -> TxConstraints i o Source #

mustValidateInSlotRange r requires the transaction's validity slot range to be contained in Slot range r .

If used in OffChain , this constraint sets the transaction's validity slot range to r .

If used in OnChain , this constraint verifies that the slot range r is entirely contained in the transaction's validity time range.

mustBeSignedBy :: forall i o. PaymentPubKeyHash -> TxConstraints i o Source #

mustBeSignedBy pk requires the transaction to be signed by the public key pk .

If used in OffChain , this constraint adds pk in the transaction's public key witness set.

If used in OnChain , this constraint verifies that pk is part of the transaction's public key witness set.

mustIncludeDatumInTxWithHash :: DatumHash -> Datum -> TxConstraints i o Source #

mustIncludeDatumInTxWithHash dh d requires the transaction body to include the datum hash dh and actual datum d .

If used in OffChain , this constraint adds dh and d in the transaction's body.

If used in OnChain , this constraint verifies that dh and d are part of the transaction's body.

mustIncludeDatumInTx :: forall i o. Datum -> TxConstraints i o Source #

mustIncludeDatumInTx d requires the transaction body to include the datum d .

If used in OffChain , this constraint adds d in the transaction's body alongside it's hash (which is computed automatically).

If used in OnChain , this constraint verifies that d is part of the transaction's body.

mustPayToTheScript :: o -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToTheScriptWithDatumHash instead

mustPayToTheScriptWithDatumHash :: o -> Value -> TxConstraints i o Source #

mustPayToTheScriptWithDatumHash d v locks the value v with a script alongside a datum d which is included in the transaction body.

If used in OffChain , this constraint creates a script output with dt and vl and adds dt in the transaction's datum witness set. The script address is derived from the typed validator that is provided in the ScriptLookups with typedValidatorLookups .

If used in OnChain , this constraint verifies that d is part of the datum witness set and that the new script transaction output with dt and vt is part of the transaction's outputs.

mustPayToPubKey :: forall i o. PaymentPubKeyHash -> Value -> TxConstraints i o Source #

mustPayToPubKey pkh v is the same as mustPayToPubKeyAddressWithDatumHash , but without any staking key hash and datum.

mustPayToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Value -> TxConstraints i o Source #

mustPayToPubKeyAddress pkh skh v is the same as mustPayToPubKeyAddressWithDatumHash , but without any datum.

mustPayWithDatumToPubKey :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToPubKeyWithDatumHash instead

mustPayToPubKeyWithDatumHash :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o Source #

mustPayToPubKeyWithDatumHash pkh d v is the same as mustPayToPubKeyAddressWithDatumHash , but without the staking key hash.

mustPayWithDatumInTxToPubKey :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToPubKeyWithDatumInTx instead

mustPayToPubKeyWithDatumInTx :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o Source #

mustPayToPubKeyWithDatumInTx pkh d v is the same as mustPayToPubKeyAddressWithDatumHash , but with an inline datum and without the staking key hash.

mustPayWithInlineDatumToPubKey :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToPubKeyWithInlineDatum instead

mustPayToPubKeyWithInlineDatum :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o Source #

mustPayToPubKeyWithInlineDatum pkh d v is the same as mustPayToPubKeyAddressWithDatumHash , but with an inline datum and without the staking key hash.

mustPayWithDatumToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToPubKeyAddressWithDatumHash instead

mustPayToPubKeyAddressWithDatumHash :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

mustPayToPubKeyAddressWithDatumHash pkh skh d v locks a transaction output with a public key address.

If used in OffChain , this constraint creates a public key output with pkh , skh , d and v and maybe adds d in the transaction's datum witness set.

If used in OnChain , this constraint verifies that d is part of the datum witness set and that the public key transaction output with pkh , skh , d and v is part of the transaction's outputs.

mustPayWithDatumInTxToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToPubKeyAddressWithDatumInTx instead

mustPayToPubKeyAddressWithDatumInTx :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

mustPayToPubKeyAddressWithDatumInTx pkh d v is the same as mustPayToPubKeyAddressWithDatumHash , but the datum is also added in the transaction body.

mustPayWithInlineDatumToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToPubKeyAddressWithInlineDatum instead

mustPayToPubKeyAddressWithInlineDatum :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

mustPayWithInlineInlineDatumToPubKeyAddress pkh d v is the same as mustPayToPubKeyAddressWithInlineDatum , but the datum is inline in the Tx.

mustPayToAddressWithReferenceValidator :: forall i o. Address -> ValidatorHash -> Maybe ( TxOutDatum Datum ) -> Value -> TxConstraints i o Source #

mustPayToAddressWithReferenceValidator is a helper that calls mustPayToAddressWithReferenceScript .

mustPayToAddressWithReferenceMintingPolicy :: forall i o. Address -> MintingPolicyHash -> Maybe ( TxOutDatum Datum ) -> Value -> TxConstraints i o Source #

mustPayToAddressWithReferenceMintingPolicy is a helper that calls mustPayToAddressWithReferenceScript .

mustPayToAddressWithReferenceScript :: forall i o. Address -> ScriptHash -> Maybe ( TxOutDatum Datum ) -> Value -> TxConstraints i o Source #

mustPayToAddressWithReferenceScript addr scriptHash d v creates a transaction output with an reference script. This allows the script to be used as a reference script.

If used in OffChain , this constraint creates an output with addr , scriptHash , d and v and maybe adds d in the transaction's datum witness set.

If used in OnChain , this constraint verifies that d is part of the datum witness set and that the transaction output with addr , scriptHash , d and v is part of the transaction's outputs.

mustPayToOtherScript :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToOtherScriptWithDatumHash instead

mustPayToOtherScriptWithDatumHash :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o Source #

mustPayToOtherScriptWithDatumHash vh d v is the same as mustPayToOtherScriptAddressWithDatumHash , but without the staking key hash.

mustPayToOtherScriptWithDatumInTx :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o Source #

mustPayToOtherScriptWithDatumInTx vh d v is the same as mustPayToOtherScriptAddressWithDatumHash , but without the staking key hash.

mustPayToOtherScriptWithInlineDatum :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o Source #

mustPayToOtherScriptWithInlineDatum vh d v is the same as mustPayToOtherScriptAddressWithDatumHash , but with an inline datum and without the staking key hash.

mustPayToOtherScriptAddress :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToOtherScriptAddressWithDatumHash instead

mustPayToOtherScriptAddressWithDatumHash :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

mustPayToOtherScriptAddressWithDatumHash vh svh d v locks the value v with the given script hash vh alonside a datum d .

If used in OffChain , this constraint creates a script output with vh , svh , d and v and adds d in the transaction's datum witness set.

If used in OnChain , this constraint verifies that d is part of the datum witness set and that the script transaction output with vh , svh , d and v is part of the transaction's outputs. For v , this means that the transactions output must be at least the given value. The output can contain more, or different tokens, but the requested value v must be present.

mustPayToOtherScriptAddressWithDatumInTx :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

mustPayToOtherScriptAddressWithDatumInTx vh svh d v locks the value v with the given script hash vh alonside a datum d .

If used in OffChain , this constraint creates a script output with vh , svh , d and v and adds d in the transaction's datum witness set.

If used in OnChain , this constraint verifies that d is part of the datum witness set and that the script transaction output with vh , svh , d and v is part of the transaction's outputs. For v , this means that the transactions output must be at least the given value. The output can contain more, or different tokens, but the requested value v must be present.

mustPayToOtherScriptAddressWithInlineDatum :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o Source #

mustPayToOtherScriptAddressInlineDatum vh d v is the same as mustPayToOtherScriptAddressWithDatumHash , but with an inline datum.

mustPayToAddress :: forall i o. Address -> Value -> TxConstraints i o Source #

mustPayToAddress addr v locks the value v at the given address addr .

If used in OffChain , this constraint creates a script output with addr and v .

If used in OnChain , this constraint verifies that the script transaction output with addr and v is part of the transaction's outputs.

mustPayToAddressWithDatum :: forall i o. Address -> Datum -> Value -> TxConstraints i o Source #

Deprecated: Use mustPayToAddressWithDatumHash instead

mustPayToAddressWithDatumHash :: forall i o. Address -> Datum -> Value -> TxConstraints i o Source #

mustPayToAddress addr d v locks the value v at the given address addr alonside a datum d .

If used in OffChain , this constraint creates a script output with addr , d and v and adds d in the transaction's datum witness set.

If used in OnChain , this constraint verifies that d is part of the datum witness set and that the script transaction output with addr , d and v is part of the transaction's outputs.

mustPayToAddressWithDatumInTx :: forall i o. Address -> Datum -> Value -> TxConstraints i o Source #

mustPayToAddressWithDatumInTx addr d v locks the value v at the given address addr alonside a datum d .

If used in OffChain , this constraint creates a script output with addr , d and v and adds d in the transaction's datum witness set.

If used in OnChain , this constraint verifies that d is part of the datum witness set and that the script transaction output with addr , d and v as part of the transaction's outputs.

mustPayToAddressWithInlineDatum :: forall i o. Address -> Datum -> Value -> TxConstraints i o Source #

mustPayToAddressWithInlineDatum vh d v is the same as mustPayToAddress , but with an inline datum.

mustMintValue :: forall i o. Value -> TxConstraints i o Source #

Same as mustMintValueWithRedeemer , but sets the redeemer to the unit redeemer.

mustMintValueWithRedeemerAndReference :: forall i o. Redeemer -> Maybe TxOutRef -> Value -> TxConstraints i o Source #

Same as mustMintCurrencyWithRedeemerAndReference , but uses the minting policy hash, token name and amount provided by Value .

Note that we can derive the MintingPolicyHash from the Value 's currency symbol.

mustMintCurrencyWithRedeemerAndReference :: forall i o. Maybe TxOutRef -> MintingPolicyHash -> Redeemer -> TokenName -> Integer -> TxConstraints i o Source #

mustMintCurrencyWithRedeemerAndReference mref mph r tn a creates the given amount a of the currency specified with mph , r and tn . The minting policy script can be specified with a reference script mref .

If used in OffChain , this constraint mints a currency using mref , mph , r , tn and a , adds mph in the transaction's minting policy witness set and adds r in the transaction's redeemer witness set. The minting policy must be provided in the ScriptLookups with typedValidatorLookups or plutusV1MintingPolicy .

If used in OnChain , this constraint verifies that the minted currenty mref , mph , tn and a is part of the transaction's minting information.

mustSpendAtLeast :: forall i o. Value -> TxConstraints i o Source #

mustSpendAtLeast v requires the sum of the transaction's inputs value to be at least v .

If used in OffChain , this constraint checks if at least the given value is spent in the transaction. When the transaction is created, a DeclaredInputMismatch error is raised if it is not the case.

If used in OnChain , this constraint verifies that the sum of the transaction's inputs value to be at least v .

mustProduceAtLeast :: forall i o. Value -> TxConstraints i o Source #

mustProduceAtLeast v requires the sum of the transaction's outputs value to be at least v .

If used in OffChain , this constraint checks if at least the given value is produced in the transaction. When the transaction is created, a DeclaredOutputMismatch error is raised if it is not the case.

If used in OnChain , this constraint verifies that the sum of the transaction's outputs value to be at least v .

mustSpendPubKeyOutput :: forall i o. TxOutRef -> TxConstraints i o Source #

mustSpendPubKeyOutput utxo must spend the given unspent transaction public key output.

If used in OffChain , this constraint adds utxo as an input to the transaction. Information about this utxo must be provided in the ScriptLookups with unspentOutputs .

If several calls to mustSpendPubKeyOutput are performed for the same TxOutRef , only one instance of the constraint is kept when the transaction is created.

If used in OnChain , this constraint verifies that the transaction spends this utxo .

mustSpendScriptOutput :: forall i o. TxOutRef -> Redeemer -> TxConstraints i o Source #

mustSpendScriptOutput utxo red must spend the given unspent transaction script output.

If used in OffChain , this constraint adds utxo and red as an input to the transaction. Information about this utxo must be provided in the ScriptLookups with unspentOutputs . The validator must be either provided by unspentOutputs or through otherScript . The datum must be either provided by unspentOutputs or through otherData .

If several calls to mustSpendScriptOutput are performed for the same TxOutRef , if the two constraints have different redeemers, an error will be thrown when the transaction is created. Otherwise, only one instance of the constraint is kept. If combined with mustSpendScriptOutputWithReference for the same TxOutRef , see mustSpendScriptOutputWithReference .

If used in OnChain , this constraint verifies that the transaction spends this utxo .

mustSpendScriptOutputWithReference :: TxOutRef -> Redeemer -> TxOutRef -> TxConstraints i o Source #

mustSpendScriptOutputWithReference utxo red refTxOutref must spend the given unspent transaction script output, using a script reference as witness.

If used in OffChain , this constraint adds utxo and red as an input to the transaction, and refTxOutref as reference input. Information about utxo and refTxOutref must be provided in the ScriptLookups with unspentOutputs . The datum must be either provided by unspentOutputs or through otherData .

If several calls to mustSpendScriptOutputWithReference are performed for the same TxOutRef , if the two constraints have different redeemers, or if the two constraints use a different TxOutRef as a TxOutRef, an error will be thrown when the transaction is created. Otherwise, only one instance of the constraint is kept.

If combined with mustSpendScriptOutput for the same TxOutRef , an error is throw if they have a different redeemer. Otherwise, only one instance of the mustSpendScriptOutputWithReference constraint is kept, the mustSpendScriptOutput constraints are ignored.

If used in OnChain , this constraint verifies that the transaction spends this utxo .

mustSpendScriptOutputWithMatchingDatumAndValue :: forall i o. ValidatorHash -> ( Datum -> Bool ) -> ( Value -> Bool ) -> Redeemer -> TxConstraints i o Source #

mustSpendScriptOutputWithMatchingDatumAndValue validatorHash datumPredicate valuePredicate redeemer must spend an output locked by the given validator script hash, which includes a Datum that matches the given datum predicate and a Value that matches the given value predicate.

If used in OffChain , this constraint checks that there's exactly one output that matches the requirements, and then adds this as an input to the transaction with the given redeemer.

The outputs that will be considered need to be privided in the ScriptLookups with unspentOutputs .

If used in OnChain , this constraint verifies that there's at least one input that matches the requirements.

mustUseOutputAsCollateral :: forall i o. TxOutRef -> TxConstraints i o Source #

mustUseOutputAsCollateral utxo must use the given unspent transaction output reference as collateral input.

If used in OffChain , this constraint adds utxo as a collateral input to the transaction.

In OnChain this constraint has no effect, since no information about collateral inputs is passed to the scripts.

mustReferenceOutput :: forall i o. TxOutRef -> TxConstraints i o Source #

mustReferenceOutput utxo must reference (not spend!) the given unspent transaction output reference.

If used in OffChain , this constraint adds utxo as a reference input to the transaction.

If used in OnChain , this constraint verifies that the transaction references this utxo .

isSatisfiable :: forall i o. TxConstraints i o -> Bool Source #

Are the constraints satisfiable?

pubKeyPayments :: forall i o. TxConstraints i o -> [(PaymentPubKeyHash, Value )] Source #

mustSpendAtLeastTotal :: forall i o. TxConstraints i o -> Value Source #

The minimum Value that satisfies all MustSpendAtLeast constraints

mustProduceAtLeastTotal :: forall i o. TxConstraints i o -> Value Source #

The minimum Value that satisfies all MustProduceAtLeast constraints

requiredSignatories :: forall i o. TxConstraints i o -> [PaymentPubKeyHash] Source #

modifiesUtxoSet :: forall i o. TxConstraints i o -> Bool Source #

Check whether every transaction that satisfies the constraints has to modify the UTXO set.

collectFromPlutusV1Script :: Map Address ( Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints Source #

A set of constraints for a transaction that collects PlutusV1 script outputs from the address of the given validator script, using the same redeemer script for all outputs.

collectFromTheScriptFilter :: forall i o. ( TxOutRef -> DecoratedTxOut -> Bool ) -> Map TxOutRef DecoratedTxOut -> i -> TxConstraints i o Source #

Given the pay to script address of the Validator , collect from it all the outputs that match a predicate, using the RedeemerValue .

collectFromTheScript :: forall i o. Map TxOutRef DecoratedTxOut -> i -> TxConstraints i o Source #

A version of collectFromScript that selects all outputs at the address

collectFromPlutusV2Script :: Map Address ( Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints Source #

A set of constraints for a transaction that collects PlutusV2 script outputs from the address of the given validator script, using the same redeemer script for all outputs.