@xlink-network/xlink-sdk
Version:
35 lines (32 loc) • 1.27 kB
text/typescript
import { UTXOSpendable } from './bitcoinHelpers.mjs';
import { Recipient } from './createTransaction.mjs';
import '@c4/btc-utils';
import '@scure/btc-signer';
type BitcoinRecipient = Recipient;
type ReselectSpendableUTXOsFn = (satsToSend: bigint, pinnedUTXOs: UTXOSpendable[], lastTimeSelectedUTXOs: UTXOSpendable[]) => Promise<UTXOSpendable[]>;
interface BitcoinTransactionPrepareResult {
inputs: Array<UTXOSpendable>;
recipients: Array<BitcoinRecipient>;
changeAmount: bigint;
fee: bigint;
estimatedVSize: number;
}
declare function prepareTransaction(txInfo: {
recipients: Array<BitcoinRecipient>;
changeAddressScriptPubKey: Uint8Array;
opReturnData?: Uint8Array[];
selectedUTXOs?: Array<UTXOSpendable>;
feeRate: bigint;
reselectSpendableUTXOs: ReselectSpendableUTXOsFn;
}): Promise<BitcoinTransactionPrepareResult>;
declare function calculateFee(info: {
recipientAddressScriptPubKeys: Uint8Array[];
opReturnData: Uint8Array[];
selectedUTXOs: Array<UTXOSpendable>;
feeRate: bigint;
extraSize?: number;
}): Promise<{
fee: bigint;
estimatedVSize: number;
}>;
export { type BitcoinRecipient, type BitcoinTransactionPrepareResult, type ReselectSpendableUTXOsFn, calculateFee, prepareTransaction };