consolidate
First select the smallest utxos that contain only includeAssets
(ignoring pure-ADA UTXOs if it ADA isn't in includeAssets
)
- simple use the selectSmallestFirst algorithm for this, filtering out UTxOs that contain asset classes that aren't in
includeAssets
nor inamount
- if the first selection fails (eg. due to dirty UTxOs), retry by only filtering out UTxOs that contain asset classes in
excludeAssets
Keep adding utxo for the left-over list (without additional sorting) until maxUtxos is reached
All UTxOs contain some lovelace, so require special treatment:
- pure lovelace UTxOs are treated as containing the lovelace assetClass
- UTxOs that contain lovelace in addition to other assetClasses are treated as containing those other assetClasses (but not lovelace)
export function consolidate(props: { excludeAssets: AssetClass[] includeAssets: AssetClass[] maxUtxos?: number }): ( utxos: TxInput<SC>[], amount: Value ) => [TxInput<SC>[], TxInput<SC>[]]
Arguments
Name | Type | Description |
---|---|---|
props | { excludeAssets: AssetClass[] includeAssets: AssetClass[] maxUtxos?: number } |
Return value
(
utxos: TxInput<SC>[],
amount: Value
) => [TxInput<SC>[], TxInput<SC>[]]