BlueWallet/typings/coinselect.d.ts

72 lines
1.3 KiB
TypeScript
Raw Normal View History

declare module 'coinselect' {
export type CoinSelectTarget = {
address: string;
value?: number;
script?: {
length: number;
};
};
export type CoinSelectUtxo = {
vout: number;
value: number;
2024-03-23 22:31:49 +01:00
txid: string;
address?: string;
wif?: string;
txhex?: string;
script?: {
length: number;
};
};
export type CoinSelectReturnInput = {
vout: number;
value: number;
txid: string;
address?: string;
wif?: string;
txhex?: string;
script?: {
length: number;
};
};
export type CoinSelectOutput = {
2024-02-18 15:42:42 +01:00
address?: string; // if output has no address - this is a change output
value: number;
};
export default function coinSelect(
utxos: CoinSelectUtxo[],
targets: CoinSelectTarget[],
feeRate: number,
changeAddress?: string,
): {
inputs: CoinSelectReturnInput[];
outputs: CoinSelectOutput[];
fee: number;
};
}
declare module 'coinselect/split' {
type Utxo = {
vout: number;
value: number;
2024-03-23 22:31:49 +01:00
txid: string;
};
export default function coinSelectSplit<U extends Utxo>(
utxos: U[],
targets: { address: string; value?: number }[],
feeRate: number,
changeAddress?: string,
): {
inputs: CoinselectReturnInput[];
outputs: {
address?: string;
value: number;
}[];
fee: number;
};
}