import { getInputType, Transaction } from '@scure/btc-signer'; import { NETWORK } from '@scure/btc-signer/utils'; import { TransactionInputUpdate } from '@scure/btc-signer/psbt'; export interface OutputsSpendingMoreThanInputsError { message: string; type: 'outputs-spending-more-than-inputs'; amount: bigint; } export interface NotEnoughFundsToPayFeesError { message: string; type: 'not-enough-funds'; fee: bigint; amount: bigint; } export declare class EstimateError extends Error { error: OutputsSpendingMoreThanInputsError | NotEnoughFundsToPayFeesError; constructor(error: OutputsSpendingMoreThanInputsError | NotEnoughFundsToPayFeesError); } export interface SizeEstimationConfig { changeAddress?: string; network: typeof NETWORK; } export interface FeeEstimationConfig extends SizeEstimationConfig { ancestorsFeePaid: bigint; ancestorsSize: number; totalInputAmount: bigint; changeAddress: string; feePerByte: bigint; dust: bigint; network: typeof NETWORK; additionalInputs?: InputType[]; additionalOutputs?: OutputType[]; } export declare function adjustChange(transaction: Transaction, archInputIndexes: Array, opts: FeeEstimationConfig): { fee: bigint; amount: bigint; vsize: number; changeAmount: bigint; }; export type InputType = ReturnType & { isArchInput: boolean; }; export type OutputType = { address: string; amount: bigint; } | { script: Uint8Array; amount: bigint | undefined; }; export declare class TransactionSizeCalculator { inputs: InputType[]; outputs: OutputType[]; constructor(); addInput(input: InputType): void; addOutput(output: OutputType): void; estimateSize(opts: SizeEstimationConfig): { weight: number; changeWeight: number; outputAmount: bigint; }; estimateByteSize(opts: SizeEstimationConfig): number; calculateFee(feePerByte: bigint, opts: SizeEstimationConfig): bigint; static createFrom(txCalculator: TransactionSizeCalculator): TransactionSizeCalculator; static createFromTransaction(transaction: Transaction): TransactionSizeCalculator; } export declare function transformTransactionOutputs(transaction: Transaction): OutputType[]; export declare function transformTransactionInputs(transaction: Transaction, archInputIndexes: Array): InputType[]; export declare function transformTransactionInput(input: TransactionInputUpdate, disableScriptCheck?: boolean, allowLegacyWitnessUtxo?: boolean, isArchInput?: boolean): InputType; export declare function toVsize(weight: number): number; export declare function estimateInput(inputType: InputType): { size: number; witnessLen: number; weight: number; }; export declare const DEFAULT_P2TR_INPUT: InputType; export declare const DEFAULT_ARCH_P2TR_INPUT: InputType; export declare const SCHNORR_PUBLIC_KEY_BYTES = 32; export declare const DEFAULT_P2TR_OUTPUT: OutputType; export declare function getInputTypeFromAddress(address: string, isArchInput?: boolean): InputType; export declare function getOutputTypeFromAddress(address: string, network?: { bech32: string; pubKeyHash: number; scriptHash: number; wif: number; }): OutputType;