@bitcoinerlab/coinselect
Version:
A TypeScript library for Bitcoin transaction management, based on Bitcoin Descriptors for defining inputs and outputs. It facilitates optimal UTXO selection and transaction size calculation.
34 lines (33 loc) • 1.32 kB
TypeScript
import type { OutputInstance } from '@bitcoinerlab/descriptors';
import { OutputWithValue } from '../index';
/**
* Seeks a selection of UTXOs that does not necessitate the creation of change.
* Although the function signature matches that of the standard {@link coinselect coinselect},
* requiring a `remainder`, change is never generated. The `remainder` is used
* to assess if hypothetical change would NOT be considered dust, thereby rendering
* the solution unviable.
*
* Notes:
*
* - This function does not reorder UTXOs prior to selection.
* - UTXOs that do not provide enough value to cover their respective fee contributions are automatically excluded.
*
* Refer to {@link coinselect coinselect} for additional details on input parameters and expected returned values.
*/
export declare function avoidChange({ utxos, targets, remainder, feeRate, minimumFeeRate, dustRelayFeeRate }: {
utxos: Array<OutputWithValue>;
targets: Array<OutputWithValue>;
/**
* This is the hypotetical change that this algo will check it would
* never be needed
*/
remainder: OutputInstance;
feeRate: number;
minimumFeeRate?: number;
dustRelayFeeRate?: number;
}): {
fee: bigint;
vsize: number;
utxos: OutputWithValue[];
targets: OutputWithValue[];
} | undefined;