@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.
32 lines (31 loc) • 1.49 kB
TypeScript
import type { PartialSig } from 'bip174/src/lib/interfaces';
import type { OutputInstance } from '@bitcoinerlab/descriptors';
/**
* When the descriptor is addr(address) then we will assume that any
* addr(SH_TYPE_ADDRESS) is in fact SH_WPKH.
* If you plan to use sh(ARBITRARY SCRIPT), then you must use a descriptor
* of this type: sh(MINISCRIPT)
*/
export declare function inputWeight(input: OutputInstance,
/**
* If a transaction isSegwitTx, a single byte is then also required for
* non-witness inputs to encode the length of the empty witness stack:
* encodeLength(0) + 0 = 1
* Read more:
* https://gist.github.com/junderw/b43af3253ea5865ed52cb51c200ac19c?permalink_comment_id=4760512#gistcomment-4760512
*/
isSegwitTx: boolean, signatures?: Array<PartialSig>): number;
export declare function outputWeight(output: OutputInstance): number;
/**
* When the descriptor in an input is is addr(address) then we will assume that
* any addr(SH_TYPE_ADDRESS) is in fact SH_WPKH.
* If you plan to use sh(ARBITRARY SCRIPT), then you must use a descriptor
* of this type: sh(MINISCRIPT)
*/
export declare function size(inputs: Array<OutputInstance>, outputs: Array<OutputInstance>,
/** For testing purposes only. It can be used to obtain the exact
* size of the signatures.
* If not passed, then signatures are assumed to be 72 bytes length:
* https://transactionfee.info/charts/bitcoin-script-ecdsa-length/
*/
signaturesPerInput?: Array<Array<PartialSig>>): number;