@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.
28 lines (27 loc) • 1.17 kB
TypeScript
import type { OutputInstance } from '@bitcoinerlab/descriptors';
import { OutputWithValue } from '../index';
/**
* The `addUntilReach` algorithm is similar to the default {@link coinselect coinselect}.
* It continuously adds UTXOs until the combined value surpasses the sum of the targets and fees.
* This function does not reorder UTXOs before selection. It evaluates whether creating change
* is feasible, with consideration of whether the change exceeds the dust threshold.
*
* 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 addUntilReach({ utxos, targets, remainder, feeRate, dustRelayFeeRate }: {
utxos: Array<OutputWithValue>;
targets: Array<OutputWithValue>;
remainder: OutputInstance;
feeRate: number;
dustRelayFeeRate?: number;
}): {
fee: number;
vsize: number;
utxos: OutputWithValue[];
targets: OutputWithValue[];
} | undefined;