cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Copyright © 2022 IOHK
License Apache-2.0
Safe Haskell None
Language Haskell2010

Cardano.Wallet.CoinSelection

Description

This module provides a wallet-specific interface for coin selection.

Coin selection handles the following responsibilities:

  • selecting inputs from the UTxO set to pay for user-specified outputs;
  • selecting inputs from the UTxO set to pay for collateral;
  • producing change outputs to return excess value to the wallet;
  • balancing a selection to pay for the transaction fee.

Use the performSelection function to perform a coin selection.

Synopsis

Selection contexts

data WalletSelectionContext Source #

A selection context for the wallet.

Instances

Instances details
SelectionContext WalletSelectionContext Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

IsServerError ( SelectionBalanceError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

IsServerError ( SelectionOutputTokenQuantityExceedsLimitError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

IsServerError ( SelectionOutputSizeExceedsLimitError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

IsServerError ( SelectionOutputError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

IsServerError ( SelectionOutputCoinInsufficientError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

IsServerError ( SelectionCollateralError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

type Address WalletSelectionContext Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type UTxO WalletSelectionContext Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

data WalletUTxO Source #

A type of unique UTxO identifier for the wallet.

Instances

Instances details
Eq WalletUTxO Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Ord WalletUTxO Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Show WalletUTxO Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Generic WalletUTxO Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Buildable WalletUTxO Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Buildable ( WalletUTxO , TokenBundle ) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep WalletUTxO Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep WalletUTxO = D1 (' MetaData "WalletUTxO" "Cardano.Wallet.CoinSelection" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "WalletUTxO" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "txIn") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 TxIn ) :*: S1 (' MetaSel (' Just "address") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Address )))

Mapping between external (wallet) types and internal types

Mapping between external (wallet) selections and internal selections.

Performing selections

performSelection :: forall m. ( HasCallStack , MonadRandom m) => SelectionConstraints -> SelectionParams -> ExceptT ( SelectionError WalletSelectionContext ) m Selection Source #

Performs a coin selection.

This function has the following responsibilities:

  • selecting inputs from the UTxO set to pay for user-specified outputs;
  • selecting inputs from the UTxO set to pay for collateral;
  • producing change outputs to return excess value to the wallet;
  • balancing a selection to pay for the transaction fee.

See performSelection for more details.

type Selection = SelectionOf TokenBundle Source #

The default type of selection.

In this type of selection, change values do not have addresses assigned.

data SelectionCollateralRequirement Source #

Indicates the collateral requirement for a selection.

Constructors

SelectionCollateralRequired

Indicates that collateral is required.

SelectionCollateralNotRequired

Indicates that collateral is not required.

Instances

Instances details
Bounded SelectionCollateralRequirement Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Enum SelectionCollateralRequirement Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Eq SelectionCollateralRequirement Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Show SelectionCollateralRequirement Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Generic SelectionCollateralRequirement Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

type Rep SelectionCollateralRequirement Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

type Rep SelectionCollateralRequirement = D1 (' MetaData "SelectionCollateralRequirement" "Cardano.Wallet.CoinSelection.Internal" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "SelectionCollateralRequired" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "SelectionCollateralNotRequired" ' PrefixI ' False ) ( U1 :: Type -> Type ))

data SelectionConstraints Source #

Specifies all constraints required for coin selection.

Selection constraints:

  • are dependent on the current set of protocol parameters.
  • are not specific to a given selection.
  • place limits on the coin selection algorithm, enabling it to produce selections that are acceptable to the ledger.

Constructors

SelectionConstraints

Fields

Instances

Instances details
Generic SelectionConstraints Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep SelectionConstraints Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep SelectionConstraints = D1 (' MetaData "SelectionConstraints" "Cardano.Wallet.CoinSelection" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "SelectionConstraints" ' PrefixI ' True ) ((( S1 (' MetaSel (' Just "assessTokenBundleSize") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( TokenBundle -> TokenBundleSizeAssessment )) :*: S1 (' MetaSel (' Just "certificateDepositAmount") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin )) :*: ( S1 (' MetaSel (' Just "computeMinimumAdaQuantity") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Address -> TokenMap -> Coin )) :*: S1 (' MetaSel (' Just "isBelowMinimumAdaQuantity") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Address -> TokenBundle -> Bool )))) :*: (( S1 (' MetaSel (' Just "computeMinimumCost") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( SelectionSkeleton -> Coin )) :*: S1 (' MetaSel (' Just "computeSelectionLimit") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ([ TxOut ] -> SelectionLimit ))) :*: ( S1 (' MetaSel (' Just "maximumCollateralInputCount") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int ) :*: ( S1 (' MetaSel (' Just "minimumCollateralPercentage") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Natural ) :*: S1 (' MetaSel (' Just "maximumLengthChangeAddress") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Address ))))))

type SelectionLimit = SelectionLimitOf Int Source #

Specifies a limit to adhere to when performing a selection.

data SelectionLimitOf a Source #

Constructors

NoLimit

Indicates that there is no limit.

MaximumInputLimit a

Indicates a maximum limit on the number of inputs to select.

data SelectionOf change Source #

Represents a balanced selection.

Constructors

Selection

Fields

Instances

Instances details
Eq change => Eq ( SelectionOf change) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Show change => Show ( SelectionOf change) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Generic ( SelectionOf change) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Associated Types

type Rep ( SelectionOf change) :: Type -> Type Source #

Buildable ( SelectionOf TokenBundle ) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Buildable ( SelectionOf TxOut ) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep ( SelectionOf change) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

data SelectionParams Source #

Specifies all parameters that are specific to a given selection.

Constructors

SelectionParams

Fields

Instances

Instances details
Eq SelectionParams Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Show SelectionParams Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Generic SelectionParams Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep SelectionParams Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep SelectionParams = D1 (' MetaData "SelectionParams" "Cardano.Wallet.CoinSelection" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "SelectionParams" ' PrefixI ' True ) ((( S1 (' MetaSel (' Just "assetsToBurn") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TokenMap ) :*: ( S1 (' MetaSel (' Just "assetsToMint") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TokenMap ) :*: S1 (' MetaSel (' Just "extraCoinIn") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin ))) :*: ( S1 (' MetaSel (' Just "extraCoinOut") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin ) :*: ( S1 (' MetaSel (' Just "outputsToCover") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [ TxOut ]) :*: S1 (' MetaSel (' Just "rewardWithdrawal") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin )))) :*: (( S1 (' MetaSel (' Just "certificateDepositsTaken") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Natural ) :*: ( S1 (' MetaSel (' Just "certificateDepositsReturned") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Natural ) :*: S1 (' MetaSel (' Just "collateralRequirement") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SelectionCollateralRequirement ))) :*: ( S1 (' MetaSel (' Just "utxoAvailableForCollateral") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Map WalletUTxO TokenBundle )) :*: ( S1 (' MetaSel (' Just "utxoAvailableForInputs") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( UTxOSelection WalletUTxO )) :*: S1 (' MetaSel (' Just "selectionStrategy") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 SelectionStrategy ))))))

data SelectionStrategy Source #

Indicates a choice of selection strategy.

A SelectionStrategy determines how much of each asset the selection algorithm will attempt to select from the available UTxO set, relative to the minimum amount necessary to make the selection balance.

The default SelectionStrategy is SelectionStrategyOptimal , which when specified will cause the selection algorithm to attempt to select around twice the minimum possible amount of each asset from the available UTxO set, making it possible to generate change outputs that are roughly the same sizes and shapes as the user-specified outputs.

Specifying SelectionStrategyMinimal will cause the selection algorithm to only select just enough of each asset from the available UTxO set to meet the minimum amount. The selection process will terminate as soon as the minimum amount of each asset is covered.

The "optimal" strategy is recommended for most situations, as using this strategy will help to ensure that a wallet's UTxO distribution can evolve over time to resemble the typical distribution of payments made by the wallet owner. This increases the likelihood that future selections will succeed, and lowers the amortized cost of future transactions.

The "minimal" strategy is recommended only for situations where it is not possible to create a selection with the "optimal" strategy. It is advised to use this strategy only when necessary, as it increases the likelihood of generating change outputs that are much smaller than user-specified outputs. If this strategy is used regularly, the UTxO set can evolve to a state where the distribution no longer resembles the typical distribution of payments made by the user. This increases the likelihood that future selections will not succeed, and increases the amortized cost of future transactions.

Selection skeletons

data SelectionSkeleton Source #

A skeleton selection that can be used to estimate the cost of a final selection.

Change outputs are deliberately stripped of their asset quantities, as the fee estimation function must be agnostic to the magnitudes of these quantities.

Increasing or decreasing the quantity of a particular asset in a change output must not change the estimated cost of a selection.

Selection errors

data BalanceInsufficientError Source #

Indicates that the balance of available UTxO entries is insufficient to cover the balance required.

See computeUTxOBalanceSufficiency .

Instances

Instances details
Eq BalanceInsufficientError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

Show BalanceInsufficientError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

Generic BalanceInsufficientError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

type Rep BalanceInsufficientError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

type Rep BalanceInsufficientError = D1 (' MetaData "BalanceInsufficientError" "Cardano.Wallet.CoinSelection.Internal.Balance" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "BalanceInsufficientError" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "utxoBalanceAvailable") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TokenBundle ) :*: S1 (' MetaSel (' Just "utxoBalanceRequired") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TokenBundle )))

data SelectionBalanceError ctx Source #

Represents the set of errors that may occur while performing a selection.

Instances

Instances details
SelectionContext ctx => Eq ( SelectionBalanceError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

SelectionContext ctx => Show ( SelectionBalanceError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

Generic ( SelectionBalanceError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

IsServerError ( SelectionBalanceError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

type Rep ( SelectionBalanceError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

data SelectionCollateralError ctx Source #

Represents an unsuccessful attempt to select collateral.

Instances

Instances details
SelectionContext ctx => Eq ( SelectionCollateralError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

SelectionContext ctx => Show ( SelectionCollateralError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Generic ( SelectionCollateralError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

IsServerError ( SelectionCollateralError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

type Rep ( SelectionCollateralError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

type Rep ( SelectionCollateralError ctx) = D1 (' MetaData "SelectionCollateralError" "Cardano.Wallet.CoinSelection.Internal" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "SelectionCollateralError" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "largestCombinationAvailable") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Map ( UTxO ctx) Coin )) :*: S1 (' MetaSel (' Just "minimumSelectionAmount") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin )))

data SelectionOutputError ctx Source #

Indicates a problem when preparing outputs for a coin selection.

Instances

Instances details
SelectionContext ctx => Eq ( SelectionOutputError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

SelectionContext ctx => Show ( SelectionOutputError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Generic ( SelectionOutputError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

IsServerError ( SelectionOutputError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

type Rep ( SelectionOutputError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

data SelectionOutputCoinInsufficientError ctx Source #

Instances

Instances details
SelectionContext ctx => Eq ( SelectionOutputCoinInsufficientError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

SelectionContext ctx => Show ( SelectionOutputCoinInsufficientError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Generic ( SelectionOutputCoinInsufficientError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

IsServerError ( SelectionOutputCoinInsufficientError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

type Rep ( SelectionOutputCoinInsufficientError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

type Rep ( SelectionOutputCoinInsufficientError ctx) = D1 (' MetaData "SelectionOutputCoinInsufficientError" "Cardano.Wallet.CoinSelection.Internal" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "SelectionOutputCoinInsufficientError" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "minimumExpectedCoin") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ) :*: S1 (' MetaSel (' Just "output") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Address ctx, TokenBundle ))))

newtype SelectionOutputSizeExceedsLimitError ctx Source #

Instances

Instances details
SelectionContext ctx => Eq ( SelectionOutputSizeExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

SelectionContext ctx => Show ( SelectionOutputSizeExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Generic ( SelectionOutputSizeExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

IsServerError ( SelectionOutputSizeExceedsLimitError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

type Rep ( SelectionOutputSizeExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

type Rep ( SelectionOutputSizeExceedsLimitError ctx) = D1 (' MetaData "SelectionOutputSizeExceedsLimitError" "Cardano.Wallet.CoinSelection.Internal" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "SelectionOutputSizeExceedsLimitError" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "outputThatExceedsLimit") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Address ctx, TokenBundle ))))

data SelectionOutputTokenQuantityExceedsLimitError ctx Source #

Indicates that a token quantity exceeds the maximum quantity that can appear in a transaction output's token bundle.

Constructors

SelectionOutputTokenQuantityExceedsLimitError

Fields

Instances

Instances details
SelectionContext ctx => Eq ( SelectionOutputTokenQuantityExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

SelectionContext ctx => Show ( SelectionOutputTokenQuantityExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

Generic ( SelectionOutputTokenQuantityExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

IsServerError ( SelectionOutputTokenQuantityExceedsLimitError WalletSelectionContext ) Source #
Instance details

Defined in Cardano.Wallet.Api.Server

type Rep ( SelectionOutputTokenQuantityExceedsLimitError ctx) Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal

type Rep ( SelectionOutputTokenQuantityExceedsLimitError ctx) = D1 (' MetaData "SelectionOutputTokenQuantityExceedsLimitError" "Cardano.Wallet.CoinSelection.Internal" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "SelectionOutputTokenQuantityExceedsLimitError" ' PrefixI ' True ) (( S1 (' MetaSel (' Just "address") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Address ctx)) :*: S1 (' MetaSel (' Just "asset") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 AssetId )) :*: ( S1 (' MetaSel (' Just "quantity") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TokenQuantity ) :*: S1 (' MetaSel (' Just "quantityMaxBound") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TokenQuantity ))))

data UnableToConstructChangeError Source #

Constructors

UnableToConstructChangeError

Fields

  • requiredCost :: ! Coin

    The minimal required cost needed for the transaction to be considered valid. This does not include min Ada values.

  • shortfall :: ! Coin

    The additional coin quantity that would be required to cover the selection cost and minimum coin quantity of each change output.

Instances

Instances details
Eq UnableToConstructChangeError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

Show UnableToConstructChangeError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

Generic UnableToConstructChangeError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

type Rep UnableToConstructChangeError Source #
Instance details

Defined in Cardano.Wallet.CoinSelection.Internal.Balance

type Rep UnableToConstructChangeError = D1 (' MetaData "UnableToConstructChangeError" "Cardano.Wallet.CoinSelection.Internal.Balance" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "UnableToConstructChangeError" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "requiredCost") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin ) :*: S1 (' MetaSel (' Just "shortfall") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin )))

Selection reports

data SelectionReportDetailed Source #

Includes detailed information about a selection.

Instances

Instances details
Eq SelectionReportDetailed Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Show SelectionReportDetailed Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Generic SelectionReportDetailed Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Buildable SelectionReportDetailed Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep SelectionReportDetailed Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

data SelectionReportSummarized Source #

Includes summarized information about a selection.

Each data point can be serialized as a single line of text.

Instances

Instances details
Eq SelectionReportSummarized Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Show SelectionReportSummarized Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Generic SelectionReportSummarized Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

Buildable SelectionReportSummarized Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep SelectionReportSummarized Source #
Instance details

Defined in Cardano.Wallet.CoinSelection

type Rep SelectionReportSummarized = D1 (' MetaData "SelectionReportSummarized" "Cardano.Wallet.CoinSelection" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "SelectionReportSummarized" ' PrefixI ' True ) ((( S1 (' MetaSel (' Just "computedFee") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ) :*: ( S1 (' MetaSel (' Just "adaBalanceOfSelectedInputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ) :*: S1 (' MetaSel (' Just "adaBalanceOfExtraCoinSource") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ))) :*: ( S1 (' MetaSel (' Just "adaBalanceOfExtraCoinSink") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ) :*: ( S1 (' MetaSel (' Just "adaBalanceOfRequestedOutputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin ) :*: S1 (' MetaSel (' Just "adaBalanceOfGeneratedChangeOutputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Coin )))) :*: (( S1 (' MetaSel (' Just "numberOfSelectedInputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int ) :*: ( S1 (' MetaSel (' Just "numberOfSelectedCollateralInputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int ) :*: S1 (' MetaSel (' Just "numberOfRequestedOutputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int ))) :*: (( S1 (' MetaSel (' Just "numberOfGeneratedChangeOutputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int ) :*: S1 (' MetaSel (' Just "numberOfUniqueNonAdaAssetsInSelectedInputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int )) :*: ( S1 (' MetaSel (' Just "numberOfUniqueNonAdaAssetsInRequestedOutputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int ) :*: S1 (' MetaSel (' Just "numberOfUniqueNonAdaAssetsInGeneratedChangeOutputs") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Int ))))))

Selection deltas

balanceMissing :: BalanceInsufficientError -> TokenBundle Source #

Calculate the missing balance from a BalanceInsufficientError .

selectionDelta Source #

Arguments

:: (change -> Coin )

A function to extract the coin value from a change value.

-> SelectionOf change
-> Coin

Computes the ada surplus of a selection, assuming there is a surplus.