2021-07-26 15:40:37 +02:00
|
|
|
declare module 'coinselect' {
|
2022-09-03 00:48:07 +01:00
|
|
|
export type CoinSelectTarget = {
|
|
|
|
address: string;
|
|
|
|
value?: number;
|
|
|
|
script?: {
|
|
|
|
length: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-09-10 12:11:28 +01:00
|
|
|
export type CoinSelectUtxo = {
|
2021-07-26 15:40:37 +02:00
|
|
|
vout: number;
|
|
|
|
value: number;
|
|
|
|
txId: string;
|
2022-09-03 00:48:07 +01:00
|
|
|
address?: string;
|
|
|
|
wif?: string;
|
|
|
|
txhex?: string;
|
|
|
|
script?: {
|
|
|
|
length: number;
|
|
|
|
};
|
2021-07-26 15:40:37 +02:00
|
|
|
};
|
|
|
|
|
2022-09-11 11:59:00 +01:00
|
|
|
export type CoinSelectReturnInput = {
|
2022-09-03 00:48:07 +01:00
|
|
|
vout: number;
|
|
|
|
value: number;
|
|
|
|
txid: string;
|
|
|
|
address?: string;
|
|
|
|
wif?: string;
|
|
|
|
txhex?: string;
|
|
|
|
script?: {
|
|
|
|
length: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export type CoinSelectOutput = {
|
|
|
|
address?: string;
|
|
|
|
value: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function coinSelect(
|
2022-09-10 12:11:28 +01:00
|
|
|
utxos: CoinSelectUtxo[],
|
2022-09-03 00:48:07 +01:00
|
|
|
targets: CoinSelectTarget[],
|
2021-07-26 15:40:37 +02:00
|
|
|
feeRate: number,
|
|
|
|
changeAddress?: string,
|
|
|
|
): {
|
2022-09-11 11:59:00 +01:00
|
|
|
inputs: CoinSelectReturnInput[];
|
2022-09-03 00:48:07 +01:00
|
|
|
outputs: CoinSelectOutput[];
|
2021-07-26 15:40:37 +02:00
|
|
|
fee: number;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module 'coinselect/split' {
|
|
|
|
type Utxo = {
|
|
|
|
vout: number;
|
|
|
|
value: number;
|
|
|
|
txId: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function coinSelectSplit<U extends Utxo>(
|
|
|
|
utxos: U[],
|
|
|
|
targets: { address: string; value?: number }[],
|
|
|
|
feeRate: number,
|
|
|
|
changeAddress?: string,
|
|
|
|
): {
|
2022-09-03 00:48:07 +01:00
|
|
|
inputs: CoinselectReturnInput[];
|
2021-07-26 15:40:37 +02:00
|
|
|
outputs: {
|
|
|
|
address?: string;
|
|
|
|
value: number;
|
|
|
|
}[];
|
|
|
|
fee: number;
|
|
|
|
};
|
|
|
|
}
|