import { CwiError, DojoClientApi, DojoCreateTxOutputApi, DojoCreatingTxInputsApi, DojoCreateTxResultOutputApi } from 'cwi-base'; export interface DojoTxBuilderInputApi { txid: string; vout: number; satoshis: number; scriptLength: number; script?: string; } export interface DojoTxBuilderOutputApi { satoshis: number; script: string; vout: number; index: number; change: boolean; } export interface DojoTxBuilderBaseOptions { } export declare class DojoTxBuilderBase { dojo: DojoClientApi; baseOptions?: DojoTxBuilderBaseOptions | undefined; constructor(dojo: DojoClientApi, baseOptions?: DojoTxBuilderBaseOptions | undefined); /** * inputs that will fund the transaction */ inputs: DojoTxBuilderInputApi[]; /** * outputs with pre-determined, non-adjustable amounts that will be created by the transaction */ outputs: DojoTxBuilderOutputApi[]; /** * change outputs generated to recapture excess funding * owned by authenticated user. * adjustable amounts. */ outputsChange: DojoTxBuilderOutputApi[]; /** * The current total value in satoshis of the selected inputs, */ funding(): number; /** * The current total value in satoshis of the amounts for all outputs */ spending(): number; /** * The current total value in satoshis of the amounts for all outputsChange */ change(): number; /** * The amount of this transaction as currently configured. * * `change` less `funding` * * Normally negative. The is the change in total value of authenticated user's unspent outputs. */ amount(): number; /** * Must return the fee required by miners for a transaction of a certain size. * @param bytes size in bytes */ feeForSize(bytes: number): number; /** * Must return the fee required by miners for the transaction as currently configured. * * The base class implementation computes the transaction size in bytes and applies * the fee rate established by the abstract `feeForSize` function. */ feeRequired(): number; /** * Must return the current excess fee for the transaction as currently configured. * * The base class defines this as funding() - spending() - change() - requiredFee() * * Because adding an input, or output, increments the counts, * which are varints, compute the excess fee being paid for * the transaction as a whole based on current choices: * - inputs * - outputs * - changeOutputs * * The goal is an excess fee of zero. * * A positive value is okay if the cost of an additional change output is greater. * * A negative value means the transaction is under funded, or over spends, and may be rejected. */ feeExcess(): number; /** * Add outputs to transaction `outputs`. * * All outputs are added. * * @param outputs to add to transaction `outputs` */ addOutputs(outputs: Array): void; /** * Add change outputs to transaction `outputsChange`. * * All change outputs are added. * * @param outputs to add to transaction `outputsChange` */ addChangeOutputs(outputs: Array): void; /** * Add inputs to transaction `inputs`. * * All inputs are added. * * @param inputs to add to transaction `inputs` */ addInputs(inputs: Record): void; /** * Add inputs sequentially to transaction `inputs` while `feeExcess` is negative. * * @param inputs to add to transaction `inputs`, removes inputs used from array */ addInputsToFundOutputs(inputs: DojoTxBuilderInputApi[]): void; /** * Repeatedly calls `getChangeOutput` and adds the new returned change output * while `feeExcess` is positive and returned output is not undefined. * * If `getChangeOutput` returns an output that would overspend (feeExcess < 0) * it is not added and the function returns. * * @param getChangeOutput a function that returns a single new change output or undefined if done. */ addChangeOutputsToRecoverExcessFee(getChangeOutput: () => DojoTxBuilderOutputApi | undefined): void; validateOutput(o: DojoCreateTxOutputApi): void; /** * validate current transaction configuration * * if `ok` is true, a valid transaction can be created * * if `ok` is false, `error` is not undefined and has details one issue. */ validate(noThrow?: boolean): { ok: boolean; error: CwiError | undefined; }; } //# sourceMappingURL=DojoTxBuilderBase.d.ts.map