cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Skeleton.Option

Description

This modules provides a variety of options associated with a TxSkel. These options mostly revolves around customizing the default behavior of cooked-validators's transaction generation mechanism.

Synopsis

Documentation

data BalanceOutputPolicy Source #

Whether to adjust a potentially existing output to the balancing wallet with the change during transaction balancing.

Constructors

AdjustExistingOutput

Try to adjust an existing public key output with the change. If no suitable output can be found, create a new change output.

DontAdjustExistingOutput

Do not change the existing outputs, always create a new change output.

data FeePolicy Source #

What fee policy to use in the transaction.

Constructors

AutoFeeComputation

Use automatic fee computation. If balancing is activated, an optimal fee will be computed based on the transaction and existing utxos in the balancing wallet. Otherwise, the maximum transaction fee will be applied.

ManualFee Integer

Provide a fee to the transaction. If the autobalancing is activated, it will be attempted around this fee, which might lead to failure if it is too low, otherwise, this fee will be given to transaction generation.

Instances

Instances details
Show FeePolicy Source # 
Instance details

Defined in Cooked.Skeleton.Option

Default FeePolicy Source # 
Instance details

Defined in Cooked.Skeleton.Option

Methods

def :: FeePolicy #

Eq FeePolicy Source # 
Instance details

Defined in Cooked.Skeleton.Option

Ord FeePolicy Source # 
Instance details

Defined in Cooked.Skeleton.Option

data BalancingPolicy Source #

Whether to balance the transaction or not, and which wallet to use to provide outputs for balancing.

Constructors

BalanceWithFirstSigner

Balance with the first signer of the list of signers

BalanceWith Wallet

Balance using a given wallet

DoNotBalance

Do not perform balancing at all

data BalancingUtxos Source #

Which UTxOs to use when balancing. Note that utxos that are already known by the skeleton being balanced (in the sense of txSkelKnownTxOutRefs, i.e. inputs and reference inputs) will be filtered out during balancing.

Constructors

BalancingUtxosFromBalancingWallet

Use all UTxOs containing only a Value (no datum, no staking credential, and no reference script) belonging to the balancing wallet.

BalancingUtxosFromSet (Set TxOutRef)

Use the provided UTxOs. UTxOs belonging to scripts will be filtered out

data CollateralUtxos Source #

Describe which UTxOs to use as collaterals

Constructors

CollateralUtxosFromBalancingWallet

Rely on automated computation with only-value UTxOs from the balancing wallet. Return collaterals will be sent to this wallet.

CollateralUtxosFromWallet Wallet

Rely on automated computation with only-value UTxOs from a given wallet. Return collaterals will be sent to this wallet.

CollateralUtxosFromSet (Set TxOutRef) Wallet

Manually provide a set of candidate UTxOs to be used as collaterals alongside a wallet to send return collaterals back to.

data AnchorResolution Source #

Describes how to resolve anchors in proposal procedures

Constructors

AnchorResolutionLocal (Map String ByteString)

Provide a map between urls and page content as Bytestring

AnchorResolutionHttp

Allow online fetch of pages from a given URL. Important note: using this option is unsafe, as it requires a web connection and inherently prevents guarantees of reproducibily. Use at your own discretion.

data TxSkelOpts Source #

Set of options to modify the behavior of generating and validating some transaction.

Constructors

TxSkelOpts 

Fields

  • txSkelOptAutoSlotIncrease :: Bool

    Whether to increase the slot counter automatically on transaction submission. This is useful for modelling transactions that could be submitted in parallel in reality, so there should be no explicit ordering of what comes first.

    Default is True.

  • txSkelOptModTx :: Tx ConwayEra -> Tx ConwayEra

    Applies an arbitrary modification to a transaction after it has been potentially adjusted and balanced. The name of this option contains unsafe to draw attention to the fact that modifying a transaction at that stage might make it invalid. Still, this offers a hook for being able to alter a transaction in unforeseen ways. It is mostly used to test contracts that have been written for custom PABs.

    One interesting use of this function is to observe a transaction just before it is being sent for validation, with

    txSkelOptModTx = [RawModTx Debug.Trace.traceShowId]

    The leftmost function in the list is applied first.

    Default is [].

  • txSkelOptBalancingPolicy :: BalancingPolicy

    Whether to balance the transaction or not, and which wallet should provide/reclaim the missing and surplus value. Balancing ensures that

    input + mints == output + fees + burns

    If you decide to set txSkelOptBalance = DoNotBalance you will have trouble satisfying that equation by hand unless you use ManualFee. You will likely see a error about value preservation.

    Default is BalanceWithFirstSigner

  • txSkelOptFeePolicy :: FeePolicy

    The fee to use when balancing the transaction

    Default is AutoFeeComputation

  • txSkelOptBalanceOutputPolicy :: BalanceOutputPolicy

    The BalanceOutputPolicy to apply when balancing the transaction.

    Default is AdjustExistingOutput.

  • txSkelOptBalancingUtxos :: BalancingUtxos

    Which UTxOs to use during balancing. This can either be a precise list, or rely on automatic searches for utxos with values only belonging to the balancing wallet.

    Default is BalancingUtxosFromBalancingWallet.

  • txSkelOptModParams :: Params -> Params

    Apply an arbitrary modification to the protocol parameters that are used to balance and submit the transaction. This is obviously a very unsafe thing to do if you want to preserve compatibility with the actual chain. It is useful mainly for testing purposes, when you might want to use extremely big transactions or transactions that exhaust the maximum execution budget. Such a thing could be accomplished with

    txSkelOptModParams = Just $ ModParams increaseTransactionLimits

    for example.

    Default is Nothing.

  • txSkelOptCollateralUtxos :: CollateralUtxos

    Which utxos to use as collaterals. They can be given manually, or computed automatically from a given, or the balancing, wallet.

    Default is CollateralUtxosFromBalancingWallet

  • txSkelOptAnchorResolution :: AnchorResolution

    How to resolve anchor in proposal procedures

    Default is 'AnchorResolutionLocal Map.Empty'

Instances

Instances details
Show TxSkelOpts Source #

Showing TxSkelOpts is possible as long as we ignore modifications to the generated transaction and the parameters.

Instance details

Defined in Cooked.Skeleton.Option

PrettyCookedList TxSkelOpts Source #

Pretty-print a list of transaction skeleton options, only printing an option if its value is non-default.

Instance details

Defined in Cooked.Pretty.Skeleton

Default TxSkelOpts Source # 
Instance details

Defined in Cooked.Skeleton.Option

Methods

def :: TxSkelOpts #

Eq TxSkelOpts Source #

Comparing TxSkelOpts is possible as long as we ignore modifications to the generated transaction and the parameters.

Instance details

Defined in Cooked.Skeleton.Option

PrettyCookedList (TxSkelOpts, [Wallet]) Source #

Prints a list of pubkeys with a flag next to the balancing wallet

Instance details

Defined in Cooked.Pretty.Skeleton

txSkelOptModTxL :: Lens' TxSkelOpts (Tx ConwayEra -> Tx ConwayEra) Source #

A lens to get or set the Cardano transaction modifications option

txSkelOptAutoSlotIncreaseL :: Lens' TxSkelOpts Bool Source #

A lens to get or set the automatic slot increase option

txSkelOptBalancingPolicyL :: Lens' TxSkelOpts BalancingPolicy Source #

A lens to get or set the balancing policy option

txSkelOptBalanceOutputPolicyL :: Lens' TxSkelOpts BalanceOutputPolicy Source #

A lens to get or set the handling of balancing outputs option

txSkelOptFeePolicyL :: Lens' TxSkelOpts FeePolicy Source #

A lens to get or set the fee policy option

txSkelOptBalancingUtxosL :: Lens' TxSkelOpts BalancingUtxos Source #

A lens to get or set the balancing utxos option

txSkelOptModParamsL :: Lens' TxSkelOpts (Params -> Params) Source #

A lens to get or set the changes to protocol parameters option

txSkelOptCollateralUtxosL :: Lens' TxSkelOpts CollateralUtxos Source #

A lens to get or set the collateral utxos option

txSkelOptAnchorResolutionL :: Lens' TxSkelOpts AnchorResolution Source #

A lens to get or set the anchor resolution option

txSkelOptAddModTx :: (Tx ConwayEra -> Tx ConwayEra) -> TxSkelOpts -> TxSkelOpts Source #

Appends a transaction modification to the given TxSkelOpts

txSkelOptAddModParams :: (Params -> Params) -> TxSkelOpts -> TxSkelOpts Source #

Appends a parameters modification to the given TxSkelOpts