Safe Haskell | None |
---|---|
Language | Haskell2010 |
Constraints for transactions
Synopsis
- data TxOutDatum datum
- = TxOutDatumHash datum
- | TxOutDatumInTx datum
- | TxOutDatumInline datum
- getTxOutDatum :: TxOutDatum d -> d
- isTxOutDatumHash :: TxOutDatum d -> Bool
- isTxOutDatumInTx :: TxOutDatum d -> Bool
- isTxOutDatumInline :: TxOutDatum d -> Bool
- data TxConstraint
- = MustIncludeDatumInTxWithHash DatumHash Datum
- | MustIncludeDatumInTx Datum
- | MustValidateInTimeRange !(ValidityInterval POSIXTime)
- | MustBeSignedBy PaymentPubKeyHash
- | MustSpendAtLeast Value
- | MustProduceAtLeast Value
- | MustSpendPubKeyOutput TxOutRef
- | MustSpendScriptOutput TxOutRef Redeemer (Maybe TxOutRef)
- | MustUseOutputAsCollateral TxOutRef
- | MustReferenceOutput TxOutRef
- | MustMintValue MintingPolicyHash Redeemer TokenName Integer (Maybe TxOutRef)
- | MustPayToAddress Address (Maybe (TxOutDatum Datum)) (Maybe ScriptHash) Value
- | MustSatisfyAnyOf [[TxConstraint]]
- data TxConstraintFun = MustSpendScriptOutputWithMatchingDatumAndValue ValidatorHash (Datum -> Bool) (Value -> Bool) Redeemer
- newtype TxConstraintFuns = TxConstraintFuns [TxConstraintFun]
- data ScriptInputConstraint a = ScriptInputConstraint {
- icRedeemer :: a
- icTxOutRef :: TxOutRef
- icReferenceTxOutRef :: Maybe TxOutRef
- mustSpendOutputFromTheScript :: TxOutRef -> i -> TxConstraints i o
- mustSpendOutputFromTheReferencedScript :: TxOutRef -> i -> TxOutRef -> TxConstraints i o
- data ScriptOutputConstraint a = ScriptOutputConstraint {
- ocDatum :: TxOutDatum a
- ocValue :: Value
- ocReferenceScriptHash :: Maybe ScriptHash
- data TxConstraints i o = TxConstraints {}
- type UntypedConstraints = TxConstraints BuiltinData BuiltinData
- singleton :: TxConstraint -> TxConstraints i o
- mustValidateIn :: forall i o. POSIXTimeRange -> TxConstraints i o
- mustValidateInTimeRange :: forall i o. ValidityInterval POSIXTime -> TxConstraints i o
- mustValidateInSlotRange :: forall i o. ValidityInterval Slot -> TxConstraints i o
- mustBeSignedBy :: forall i o. PaymentPubKeyHash -> TxConstraints i o
- mustIncludeDatumInTxWithHash :: DatumHash -> Datum -> TxConstraints i o
- mustIncludeDatumInTx :: forall i o. Datum -> TxConstraints i o
- mustPayToTheScript :: o -> Value -> TxConstraints i o
- mustPayToTheScriptWithDatumHash :: o -> Value -> TxConstraints i o
- mustPayToTheScriptWithDatumInTx :: o -> Value -> TxConstraints i o
- mustPayToTheScriptWithInlineDatum :: o -> Value -> TxConstraints i o
- mustPayToTheScriptWithReferenceScript :: ScriptHash -> TxOutDatum o -> Value -> TxConstraints i o
- mustPayToPubKey :: forall i o. PaymentPubKeyHash -> Value -> TxConstraints i o
- mustPayToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Value -> TxConstraints i o
- mustPayWithDatumToPubKey :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o
- mustPayToPubKeyWithDatumHash :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o
- mustPayWithDatumInTxToPubKey :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o
- mustPayToPubKeyWithDatumInTx :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o
- mustPayWithInlineDatumToPubKey :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o
- mustPayToPubKeyWithInlineDatum :: forall i o. PaymentPubKeyHash -> Datum -> Value -> TxConstraints i o
- mustPayWithDatumToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToPubKeyAddressWithDatumHash :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayWithDatumInTxToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToPubKeyAddressWithDatumInTx :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayWithInlineDatumToPubKeyAddress :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToPubKeyAddressWithInlineDatum :: forall i o. PaymentPubKeyHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToAddressWithReferenceValidator :: forall i o. Address -> ValidatorHash -> Maybe (TxOutDatum Datum) -> Value -> TxConstraints i o
- mustPayToAddressWithReferenceMintingPolicy :: forall i o. Address -> MintingPolicyHash -> Maybe (TxOutDatum Datum) -> Value -> TxConstraints i o
- mustPayToAddressWithReferenceScript :: forall i o. Address -> ScriptHash -> Maybe (TxOutDatum Datum) -> Value -> TxConstraints i o
- mustPayToOtherScript :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o
- mustPayToOtherScriptWithDatumHash :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o
- mustPayToOtherScriptWithDatumInTx :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o
- mustPayToOtherScriptWithInlineDatum :: forall i o. ValidatorHash -> Datum -> Value -> TxConstraints i o
- mustPayToOtherScriptAddress :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToOtherScriptAddressWithDatumHash :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToOtherScriptAddressWithDatumInTx :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToOtherScriptAddressWithInlineDatum :: forall i o. ValidatorHash -> StakingCredential -> Datum -> Value -> TxConstraints i o
- mustPayToAddress :: forall i o. Address -> Value -> TxConstraints i o
- mustPayToAddressWithDatum :: forall i o. Address -> Datum -> Value -> TxConstraints i o
- mustPayToAddressWithDatumHash :: forall i o. Address -> Datum -> Value -> TxConstraints i o
- mustPayToAddressWithDatumInTx :: forall i o. Address -> Datum -> Value -> TxConstraints i o
- mustPayToAddressWithInlineDatum :: forall i o. Address -> Datum -> Value -> TxConstraints i o
- mustMintValue :: forall i o. Value -> TxConstraints i o
- mustMintValueWithReference :: forall i o. TxOutRef -> Value -> TxConstraints i o
- mustMintValueWithRedeemer :: forall i o. Redeemer -> Value -> TxConstraints i o
- mustMintValueWithRedeemerAndReference :: forall i o. Redeemer -> Maybe TxOutRef -> Value -> TxConstraints i o
- mustMintCurrency :: forall i o. MintingPolicyHash -> TokenName -> Integer -> TxConstraints i o
- mustMintCurrencyWithReference :: forall i o. TxOutRef -> MintingPolicyHash -> TokenName -> Integer -> TxConstraints i o
- mustMintCurrencyWithRedeemer :: forall i o. MintingPolicyHash -> Redeemer -> TokenName -> Integer -> TxConstraints i o
- mustMintCurrencyWithRedeemerAndReference :: forall i o. Maybe TxOutRef -> MintingPolicyHash -> Redeemer -> TokenName -> Integer -> TxConstraints i o
- mustSpendAtLeast :: forall i o. Value -> TxConstraints i o
- mustProduceAtLeast :: forall i o. Value -> TxConstraints i o
- mustSpendPubKeyOutput :: forall i o. TxOutRef -> TxConstraints i o
- mustSpendScriptOutput :: forall i o. TxOutRef -> Redeemer -> TxConstraints i o
- mustSpendScriptOutputWithReference :: TxOutRef -> Redeemer -> TxOutRef -> TxConstraints i o
- mustSpendScriptOutputWithMatchingDatumAndValue :: forall i o. ValidatorHash -> (Datum -> Bool) -> (Value -> Bool) -> Redeemer -> TxConstraints i o
- mustUseOutputAsCollateral :: forall i o. TxOutRef -> TxConstraints i o
- mustReferenceOutput :: forall i o. TxOutRef -> TxConstraints i o
- mustSatisfyAnyOf :: forall i o. [TxConstraints i o] -> TxConstraints i o
- isSatisfiable :: forall i o. TxConstraints i o -> Bool
- pubKeyPayments :: forall i o. TxConstraints i o -> [(PaymentPubKeyHash, Value)]
- mustSpendAtLeastTotal :: forall i o. TxConstraints i o -> Value
- mustProduceAtLeastTotal :: forall i o. TxConstraints i o -> Value
- requiredSignatories :: forall i o. TxConstraints i o -> [PaymentPubKeyHash]
- requiredMonetaryPolicies :: forall i o. TxConstraints i o -> [MintingPolicyHash]
- requiredDatums :: forall i o. TxConstraints i o -> [Datum]
- modifiesUtxoSet :: forall i o. TxConstraints i o -> Bool
- spendUtxosFromPlutusV1Script :: Map Address (Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints
- spendUtxosFromPlutusV1ScriptFilter :: (TxOutRef -> DecoratedTxOut -> Bool) -> Map Address (Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints
- spendUtxosFromTheScriptFilter :: forall i o. (TxOutRef -> DecoratedTxOut -> Bool) -> Map TxOutRef DecoratedTxOut -> i -> TxConstraints i o
- spendUtxosFromTheScript :: forall i o. Map TxOutRef DecoratedTxOut -> i -> TxConstraints i o
- spendUtxosFromTheReferencedScript :: forall i o. Map TxOutRef DecoratedTxOut -> i -> TxOutRef -> TxConstraints i o
- spendUtxosFromPlutusV2Script :: Map Address (Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints
- spendUtxosFromPlutusV2ScriptFilter :: (TxOutRef -> DecoratedTxOut -> Bool) -> Map Address (Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints
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
).
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
getTxOutDatum :: TxOutDatum d -> d Source #
isTxOutDatumHash :: TxOutDatum d -> Bool Source #
isTxOutDatumInTx :: TxOutDatum d -> Bool Source #
isTxOutDatumInline :: TxOutDatum d -> Bool Source #
data TxConstraint Source #
Constraints on transactions that want to spend script outputs
MustIncludeDatumInTxWithHash DatumHash Datum | The provided |
MustIncludeDatumInTx Datum | Like |
MustValidateInTimeRange !(ValidityInterval POSIXTime) | The transaction's validity range must be set with the given |
MustBeSignedBy PaymentPubKeyHash | The transaction must add the given |
MustSpendAtLeast Value | The sum of the transaction's input |
MustProduceAtLeast Value | The sum of the transaction's output |
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
data TxConstraintFun Source #
Constraints on transactions that contain functions. These don't support conversion to and from JSON.
MustSpendScriptOutputWithMatchingDatumAndValue ValidatorHash (Datum -> Bool) (Value -> Bool) Redeemer | The transaction must spend a script output from the given script address which matches the |
Instances
Show TxConstraintFun Source # | |
Defined in Ledger.Tx.Constraints.TxConstraints | |
Pretty TxConstraintFun Source # | |
Defined in Ledger.Tx.Constraints.TxConstraints pretty :: TxConstraintFun -> Doc ann prettyList :: [TxConstraintFun] -> Doc ann |
newtype TxConstraintFuns Source #
Instances
data ScriptInputConstraint a Source #
Constraint which specifies that the transaction must spend a transaction output from a target script.
ScriptInputConstraint | |
|
Instances
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.
mustSpendOutputFromTheReferencedScript :: TxOutRef -> i -> TxOutRef -> TxConstraints i o Source #
mustSpendOutputFromTheReferencedScript txOutRef red ref
spends the transaction
output txOutRef
with a script address using the redeemer red
, using the reference script ref
as a validator.
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 #
ScriptOutputConstraint | |
|
Instances
data TxConstraints i o Source #
Restrictions placed on the allocation of funds to outputs of transactions.
Instances
type UntypedConstraints = TxConstraints BuiltinData BuiltinData Source #
singleton :: TxConstraint -> TxConstraints i o Source #
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 #
mustIncludeDatumInTxWithHash :: DatumHash -> Datum -> TxConstraints i o Source #
mustIncludeDatumInTx :: forall i o. Datum -> TxConstraints i o Source #
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.
mustPayToTheScriptWithDatumInTx :: o -> Value -> TxConstraints i o Source #
mustPayToTheScriptWithInlineDatum :: o -> Value -> TxConstraints i o Source #
mustPayToTheScriptWithReferenceScript :: ScriptHash -> TxOutDatum o -> Value -> TxConstraints i o Source #
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 #
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.
mustMintValueWithReference :: forall i o. TxOutRef -> Value -> TxConstraints i o Source #
Same as mustMintValueWithRedeemerAndReference
, but sets the redeemer to the unit
redeemer.
mustMintValueWithRedeemer :: forall i o. Redeemer -> Value -> TxConstraints i o Source #
Same as mustMintValueWithRedeemerAndReference
, but sets the reference to Nothing
.
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.
mustMintCurrency :: forall i o. MintingPolicyHash -> TokenName -> Integer -> TxConstraints i o Source #
Same as mustMintCurrencyWithRedeemer
, but sets the redeemer to the unit
redeemer.
mustMintCurrencyWithReference :: forall i o. TxOutRef -> MintingPolicyHash -> TokenName -> Integer -> TxConstraints i o Source #
Same as mustMintCurrencyWithRedeemerAndReference
, but sets the redeemer to the unit
redeemer.
mustMintCurrencyWithRedeemer :: forall i o. MintingPolicyHash -> Redeemer -> TokenName -> Integer -> TxConstraints i o Source #
Same as mustMintCurrencyWithRedeemerAndReference
, but sets the reference to Nothing
.
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 #
mustSatisfyAnyOf :: forall i o. [TxConstraints i o] -> TxConstraints i o Source #
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 #
requiredMonetaryPolicies :: forall i o. TxConstraints i o -> [MintingPolicyHash] Source #
requiredDatums :: forall i o. TxConstraints i o -> [Datum] Source #
modifiesUtxoSet :: forall i o. TxConstraints i o -> Bool Source #
Check whether every transaction that satisfies the constraints has to modify the UTXO set.
spendUtxosFromPlutusV1Script :: 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.
spendUtxosFromPlutusV1ScriptFilter :: (TxOutRef -> DecoratedTxOut -> Bool) -> Map Address (Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints Source #
spendUtxosFromTheScriptFilter :: 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
.
spendUtxosFromTheScript :: forall i o. Map TxOutRef DecoratedTxOut -> i -> TxConstraints i o Source #
A version of spendUtxosFromScript
that selects all outputs
at the address
spendUtxosFromTheReferencedScript :: forall i o. Map TxOutRef DecoratedTxOut -> i -> TxOutRef -> TxConstraints i o Source #
A version of spendUtxosFromScript
that selects all outputs
at the address
utxo
the set of utxos we search into to find the one we want to spendsOutput
ref
the reference to the utxo that contains the reference script
spendUtxosFromPlutusV2Script :: 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.
spendUtxosFromPlutusV2ScriptFilter :: (TxOutRef -> DecoratedTxOut -> Bool) -> Map Address (Map TxOutRef DecoratedTxOut) -> Validator -> Redeemer -> UntypedConstraints Source #