Trait TxSenderTxBuilder

Source
pub trait TxSenderTxBuilder:
    Send
    + Sync
    + 'static {
    type SpendableInput: SpendableInputInfo;

    // Required methods
    fn build_child_tx<S: TxSenderSigner>(
        p2a_anchor: OutPoint,
        anchor_sat: Amount,
        fee_payer_utxos: Vec<Self::SpendableInput>,
        change_address: Address,
        required_fee: Amount,
        signer: &S,
    ) -> Result<Transaction, BridgeError>;
    fn utxos_to_spendable_inputs(
        utxos: Vec<(Txid, u32, Amount)>,
        signer_address: &Address,
    ) -> Vec<Self::SpendableInput>;
}
Expand description

Trait for building child transactions in the transaction sender.

This abstraction allows the core crate to provide SpendableTxIn-based transaction building using TxHandler, while keeping the tx-sender crate independent of the builder module.

All methods are static - no instance of this trait is stored.

Required Associated Types§

Source

type SpendableInput: SpendableInputInfo

The type representing a spendable transaction input. In core, this would be SpendableTxIn.

Required Methods§

Source

fn build_child_tx<S: TxSenderSigner>( p2a_anchor: OutPoint, anchor_sat: Amount, fee_payer_utxos: Vec<Self::SpendableInput>, change_address: Address, required_fee: Amount, signer: &S, ) -> Result<Transaction, BridgeError>

Builds a child transaction for CPFP.

This method constructs a child transaction that spends the P2A anchor output and fee payer UTXOs, paying the required fees for the CPFP package.

§Arguments
  • p2a_anchor - The P2A anchor output to spend
  • anchor_sat - Amount in the anchor output
  • fee_payer_utxos - UTXOs to fund the child transaction
  • change_address - Address for the change output
  • required_fee - The calculated required fee for the package
  • signer_address - The signer’s address (for script pubkey)
  • signer - The signer to sign the transaction inputs
§Returns

A signed child transaction ready for package submission.

Source

fn utxos_to_spendable_inputs( utxos: Vec<(Txid, u32, Amount)>, signer_address: &Address, ) -> Vec<Self::SpendableInput>

Converts database UTXOs into the builder’s SpendableInput type.

§Arguments
  • utxos - Vector of (txid, vout, amount) tuples from the database
  • signer_address - The signer’s address (for script pubkey generation)
§Returns

Vector of SpendableInput instances ready for use in transaction building.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§