cardano-coin-selection-1.0.1: Algorithms for coin selection and fee balancing.

Cardano.CoinSelection.Algorithm.Migration

Contents

Description

This module contains an algorithm for migrating all funds from one wallet to another.

See selectCoins.

Synopsis

# Coin Selection for Migration

Arguments

 :: (Ord i, Ord o) => FeeOptions i o The fee options. -> BatchSize The maximum number of inputs to include in each selection. -> CoinMap i The UTxO set to migrate. -> [CoinSelection i o]

Creates a series of coin selections that, when published as transactions, will have the effect of migrating all funds from one wallet to another.

Since UTxO-based blockchains typically impose limits on the sizes of individual transactions, and since individual UTxO sets can contain arbitrarily many entries, migrating all funds from one wallet to another may require the creation of several transactions.

This function therefore partitions the given set of inputs into multiple batches of up to b inputs, where b is specified by the given BatchSize parameter. (See idealBatchSize for an automatic way to calculate a suitable batch size.)

For each batch of inputs, this function creates a separate CoinSelection with the given inputs and a generated change set, where the change set represents the value to be transferred to the target wallet, carefully adjusted to deduct a fee in accordance with the given FeeOptions parameter. The set of outputs for each coin selection is purposefully left empty, as all value is captured in the change set.

Since: 1.0.0

newtype BatchSize Source #

An upper limit for the number of inputs to include in each coin selection generated by selectCoins.

Since: 1.0.0

Constructors

 BatchSize Word16
Instances
 Source # Instance details Methods Source # Instance details Methods Source # Instance details MethodsshowList :: [BatchSize] -> ShowS # Source # Instance details Associated Typestype Rep BatchSize :: Type -> Type # Methodsto :: Rep BatchSize x -> BatchSize # type Rep BatchSize Source # Instance details type Rep BatchSize = D1 (MetaData "BatchSize" "Cardano.CoinSelection.Algorithm.Migration" "cardano-coin-selection-1.0.1-8YDTuK0wdOiKx5xElB4HN" True) (C1 (MetaCons "BatchSize" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word16)))

Calculate an ideal batch size based on the given coin selection limit.

Since: 1.0.0