Module bdk::wallet::tx_builder[][src]

Transaction builder

Example

// create a TxBuilder from a wallet
let mut tx_builder = wallet.build_tx();

tx_builder
    // Create a transaction with one output to `to_address` of 50_000 satoshi
    .add_recipient(to_address.script_pubkey(), 50_000)
    // With a custom fee rate of 5.0 satoshi/vbyte
    .fee_rate(FeeRate::from_sat_per_vb(5.0))
    // Only spend non-change outputs
    .do_not_spend_change()
    // Turn on RBF signaling
    .enable_rbf();
let (psbt, tx_details) = tx_builder.finish()?;

Structs

BumpFee

Marker type to indicate the TxBuilder is being used to bump the fee of an existing transaction.

CreateTx

Marker type to indicate the TxBuilder is being used to create a new transaction (as opposed to bumping the fee of an existing one).

TxBuilder

A transaction builder

Enums

ChangeSpendPolicy

Policy regarding the use of change outputs when creating a transaction

TxOrdering

Ordering of the transaction's inputs and outputs

Traits

TxBuilderContext

Context in which the TxBuilder is valid