CoinSelectionAlgorithm typedef
Coin selection is the process of picking UTxO inputs to perticipate in a spending transaction. There is a dedicated Cardano Improvement Proposal that this implementation is attempting to follo in spirit:
https://cips.cardano.org/cips/cip2
Implementations details can be found here:
https://hackage.haskell.org/package/cardano-coin-selection-1.0.1/docs/Cardano-CoinSelection-Algorithm-LargestFirst.html https://hackage.haskell.org/package/cardano-coin-selection-1.0.1/docs/src/Cardano.CoinSelection.Algorithm.LargestFirst.html https://hackage.haskell.org/package/cardano-coin-selection-1.0.1/docs/Cardano-CoinSelection-Algorithm-RandomImprove.html https://hackage.haskell.org/package/cardano-coin-selection-1.0.1/docs/src/Cardano.CoinSelection.Algorithm.RandomImprove.html
The result of this method will ultimatly be a list of ShelleyTransactionInput which point to an UTXO unspent change entry using a transactionId and index:
class ShelleyTransactionInput { final String transactionId; final int index; } coin selection function type
Implementation
/// coin selection function type
typedef CoinSelectionAlgorithm
= Future<Result<CoinSelection, CoinSelectionError>> Function({
required List<WalletTransaction> unspentInputsAvailable,
required List<MultiAssetRequest> outputsRequested,
required Set<ShelleyAddress> ownedAddresses,
int coinSelectionLimit,
bool logSelection,
});