UNPKG

@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.

31 lines (30 loc) 1.24 kB
import type { OutputInstance } from '@bitcoinerlab/descriptors'; import { OutputWithValue } from '../index'; /** * The `maxFunds` algorithm is tailored for scenarios where the goal is to transfer all funds from specified UTXOs to a single recipient output. * To utilize this function, specify the recipient output in the `remainder` argument. * In this context, the `remainder` serves as the recipient of the funds. * * 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. * - Recipient of all funds is set to last position of the returned `targets` array. * * Refer to {@link coinselect coinselect} for additional details on input parameters and expected returned values. */ export declare function maxFunds({ utxos, targets, remainder, feeRate, dustRelayFeeRate }: { utxos: Array<OutputWithValue>; targets: Array<OutputWithValue>; /** * Recipient to send maxFunds */ remainder: OutputInstance; feeRate: number; dustRelayFeeRate?: number; }): { fee: number; vsize: number; utxos: OutputWithValue[]; targets: OutputWithValue[]; } | undefined;