import { Ecc } from './ecc.js'; import type { Signatory } from './signatories.js'; import { Script } from './script.js'; import { Tx, TxInput, TxOutput } from './tx.js'; /** Builder input that bundles all the data required to sign a TxInput */ export interface TxBuilderInput { input: TxInput; /** Signing callback; see `Signatory` in `signatories.ts`. */ signatory?: Signatory; } /** * Output that can either be: * - `TxOutput`: A full output with a fixed sats amount * - `Script`: A Script which will receive the leftover sats after fees. * Leftover usually is the change the sender gets back from providing more * sats than needed. */ export type TxBuilderOutput = TxOutput | Script; /** Class that can be used to build and sign txs. */ export declare class TxBuilder { /** nVersion of the resulting Tx */ version: number; /** Inputs that will be signed by the buider */ inputs: TxBuilderInput[]; /** * Outputs of the tx, can specify a single leftover (i.e. change) output as * a Script. **/ outputs: TxBuilderOutput[]; /** nLockTime of the resulting Tx */ locktime: number; constructor(params?: { version?: number; inputs?: TxBuilderInput[]; outputs?: TxBuilderOutput[]; locktime?: number; }); /** Calculte sum of all sats coming in, or `undefined` if some unknown. */ private inputSum; private prepareOutputs; /** * Create a TxBuilder from the given tx. * This is useful if tx is unsigned/partially signed and needs to be completed. **/ static fromTx(tx: Tx): TxBuilder; /** Sign the tx built by this builder and return a Tx */ sign(params?: { ecc?: Ecc; feePerKb?: bigint; dustSats?: bigint; }): Tx; } /** Calculate the required tx fee for the given txSize and feePerKb, * rounding up */ export declare function calcTxFee(txSize: number, feePerKb: bigint): bigint; //# sourceMappingURL=txBuilder.d.ts.map