| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ledger.Tx.Constraints.OffChain
Contents
Synopsis
- data ScriptLookups a = ScriptLookups {
- slTxOutputs :: Map TxOutRef DecoratedTxOut
- slOtherScripts :: Map ScriptHash (Versioned Script)
- slOtherData :: Map DatumHash Datum
- slPaymentPubKeyHashes :: Set PaymentPubKeyHash
- slTypedValidator :: Maybe (TypedValidator a)
- slOwnPaymentPubKeyHash :: Maybe PaymentPubKeyHash
- slOwnStakingCredential :: Maybe StakingCredential
- typedValidatorLookups :: TypedValidator a -> ScriptLookups a
- generalise :: ScriptLookups a -> ScriptLookups Any
- unspentOutputs :: Map TxOutRef DecoratedTxOut -> ScriptLookups a
- mintingPolicy :: Versioned MintingPolicy -> ScriptLookups a
- plutusV1MintingPolicy :: MintingPolicy -> ScriptLookups a
- plutusV2MintingPolicy :: MintingPolicy -> ScriptLookups a
- otherScript :: Versioned Validator -> ScriptLookups a
- plutusV1OtherScript :: Validator -> ScriptLookups a
- plutusV2OtherScript :: Validator -> ScriptLookups a
- otherData :: Datum -> ScriptLookups a
- ownPaymentPubKeyHash :: PaymentPubKeyHash -> ScriptLookups a
- ownStakingCredential :: StakingCredential -> ScriptLookups a
- paymentPubKey :: PaymentPubKey -> ScriptLookups a
- paymentPubKeyHash :: PaymentPubKeyHash -> ScriptLookups a
- data SomeLookupsAndConstraints where
- SomeLookupsAndConstraints :: forall a. (FromData (DatumType a), ToData (DatumType a), ToData (RedeemerType a)) => ScriptLookups a -> TxConstraints (RedeemerType a) (DatumType a) -> SomeLookupsAndConstraints
- data UnbalancedTx
- unBalancedTxTx :: UnbalancedTx -> Either CardanoBuildTx Tx
- tx :: Traversal' UnbalancedTx CardanoBuildTx
- txValidityRange :: Lens' CardanoBuildTx (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra)
- txOuts :: Lens' CardanoBuildTx [TxOut CtxTx BabbageEra]
- utxoIndex :: Lens' UnbalancedTx (Map TxOutRef TxOut)
- emptyUnbalancedTx :: Params -> UnbalancedTx
- adjustUnbalancedTx :: PParams -> UnbalancedTx -> Either ToCardanoError ([Ada], UnbalancedTx)
- data MkTxError
- mkTx :: (FromData (DatumType a), ToData (DatumType a), ToData (RedeemerType a)) => Params -> ScriptLookups a -> TxConstraints (RedeemerType a) (DatumType a) -> Either MkTxError UnbalancedTx
- mkSomeTx :: Params -> [SomeLookupsAndConstraints] -> Either MkTxError UnbalancedTx
Lookups
data ScriptLookups a Source #
Constructors
| ScriptLookups | |
Fields
| |
Instances
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
generalise :: ScriptLookups a -> ScriptLookups Any Source #
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 SomeLookupsAndConstraints where Source #
Some typed TxConstraints and the ScriptLookups needed to turn them
into an UnbalancedTx.
Constructors
| SomeLookupsAndConstraints :: forall a. (FromData (DatumType a), ToData (DatumType a), ToData (RedeemerType a)) => ScriptLookups a -> TxConstraints (RedeemerType a) (DatumType a) -> SomeLookupsAndConstraints |
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
txValidityRange :: Lens' CardanoBuildTx (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) Source #
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).
Constructors
| ToCardanoError ToCardanoError | |
| LedgerMkTxError MkTxError |
Instances
| Eq MkTxError Source # | |
| Show MkTxError Source # | |
| Generic MkTxError Source # | |
| ToJSON MkTxError Source # | |
| FromJSON MkTxError Source # | |
| Pretty MkTxError Source # | |
| type Rep MkTxError Source # | |
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.