cooked-validators-4.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Tweak.AddInputsAndOutputs

Description

This module provides some Tweaks that add or remove inputs and outputs from transactions. Some also operate on the minted value.

Synopsis

Documentation

ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer)) Source #

Ensure that a given TxOutRef is being spent with a given TxSkelRedeemer. The return value will be Just the added data, if anything changed.

addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m () Source #

Add an input to a transaction. If the given TxOutRef is already being consumed by the transaction, fail.

removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)] Source #

Remove transaction inputs according to a given predicate. The returned list contains all removed inputs.

ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut) Source #

Ensure that a certain output is produced by a transaction. The return value will be Just the added output, when applicable.

addOutputTweak :: MonadTweak m => TxSkelOut -> m () Source #

Add a transaction output, at the end of the current list of outputs, thus retaining the initial outputs order.

removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut] Source #

Remove transaction outputs according to some predicate. The returned list contains all the removed outputs.

addMintTweak :: MonadTweak m => (Versioned MintingPolicy, TxSkelRedeemer, TokenName, Integer) -> m () Source #

Add a new entry to the TxSkelMints of the transaction skeleton under modification. As this is implemented in terms of addToTxSkelMints, the same caveats apply as do to that function!

removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, TxSkelRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, TxSkelRedeemer, TokenName, Integer)] Source #

Remove some entries from the TxSkelMints of a transaction, according to some predicate. The returned list holds the removed entries.