Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/algos/addUntilReach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import { isDust } from '../dust';
*
* Refer to {@link coinselect coinselect} for additional details on input parameters and expected returned values.
*/
export function addUntilReach({
export function addUntilReach<Utxo extends OutputWithValue>({
utxos,
targets,
remainder,
feeRate,
dustRelayFeeRate = DUST_RELAY_FEE_RATE
}: {
utxos: Array<OutputWithValue>;
utxos: Array<Utxo>;
targets: Array<OutputWithValue>;
remainder: OutputInstance;
feeRate: number;
Expand All @@ -42,7 +42,7 @@ export function addUntilReach({
validateFeeRate(dustRelayFeeRate);

const targetsValue = targets.reduce((a, target) => a + target.value, 0);
const utxosSoFar: Array<OutputWithValue> = [];
const utxosSoFar: Array<Utxo> = [];

for (const candidate of utxos) {
const txSizeSoFar = vsize(
Expand Down
6 changes: 3 additions & 3 deletions src/algos/avoidChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import { isDust } from '../dust';
*
* Refer to {@link coinselect coinselect} for additional details on input parameters and expected returned values.
*/
export function avoidChange({
export function avoidChange<Utxo extends OutputWithValue>({
utxos,
targets,
remainder,
feeRate,
dustRelayFeeRate = DUST_RELAY_FEE_RATE
}: {
utxos: Array<OutputWithValue>;
utxos: Array<Utxo>;
targets: Array<OutputWithValue>;
/**
* This is the hypotetical change that this algo will check it would
Expand All @@ -47,7 +47,7 @@ export function avoidChange({
validateFeeRate(dustRelayFeeRate);

const targetsValue = targets.reduce((a, target) => a + target.value, 0);
const utxosSoFar: Array<OutputWithValue> = [];
const utxosSoFar: Array<Utxo> = [];

for (const candidate of utxos) {
const utxosSoFarValue = utxosSoFar.reduce((a, utxo) => a + utxo.value, 0);
Expand Down
4 changes: 2 additions & 2 deletions src/algos/maxFunds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import { isDust } from '../dust';
*
* Refer to {@link coinselect coinselect} for additional details on input parameters and expected returned values.
*/
export function maxFunds({
export function maxFunds<Utxo extends OutputWithValue>({
utxos,
targets,
remainder,
feeRate,
dustRelayFeeRate = DUST_RELAY_FEE_RATE
}: {
utxos: Array<OutputWithValue>;
utxos: Array<Utxo>;
targets: Array<OutputWithValue>;
/**
* Recipient to send maxFunds
Expand Down
4 changes: 2 additions & 2 deletions src/coinselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function utxoTransferredValue(
*
* @see {@link https://bitcoinerlab.com/modules/descriptors} for descriptor info.
*/
export function coinselect({
export function coinselect<Utxo extends OutputWithValue>({
utxos,
targets,
remainder,
Expand All @@ -81,7 +81,7 @@ export function coinselect({
* Array of UTXOs for the transaction. Each UTXO includes an `OutputInstance`
* and its value.
*/
utxos: Array<OutputWithValue>;
utxos: Array<Utxo>;
/**
* Array of transaction targets. If specified, `remainder` is used
* as the change address.
Expand Down