Function utxo::select

source · []
pub fn select<'a, T: Select + Clone>(
    inputs: &'a mut [T],
    output: &T,
    threshold: &T
) -> Option<(&'a mut [T], &'a mut [T], T)>
Expand description

Select UTxOs.

Arguments

  • inputs - The available UTxOs to be selected from
  • output - The total output required
  • threshold - The minimum the total inputs exceed the total outputs, reserved to pay fees and avoid Dust

Returns Some((selected, unselected, excess)) on success, otherwise returns None (no enough inputs). The excess can be used to pay the fee and return the change. The unselected UTxOs can be selected later if more are needed.