TxBuilderInterface

A TxBuilder is created by calling build_tx on a wallet. After assigning it, you set options on it until finally calling finish to consume the builder and generate the transaction.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun addData(data: ByteArray): TxBuilder

Add data as an output using OP_RETURN.

Link copied to clipboard
abstract fun addGlobalXpubs(): TxBuilder

Fill-in the PSBT_GLOBAL_XPUB field with the extended keys contained in both the external and internal descriptors.

Link copied to clipboard
abstract fun addRecipient(script: Script, amount: Amount): TxBuilder

Add a recipient to the internal list of recipients.

Link copied to clipboard
abstract fun addUnspendable(unspendable: OutPoint): TxBuilder

Add a utxo to the internal list of unspendable utxos.

Link copied to clipboard
abstract fun addUtxo(outpoint: OutPoint): TxBuilder

Add a utxo to the internal list of utxos that must be spent.

Link copied to clipboard
abstract fun addUtxos(outpoints: List<OutPoint>): TxBuilder

Add the list of outpoints to the internal list of UTXOs that must be spent.

Link copied to clipboard
abstract fun allowDust(allowDust: Boolean): TxBuilder

Set whether or not the dust limit is checked.

Link copied to clipboard
abstract fun changePolicy(changePolicy: ChangeSpendPolicy): TxBuilder

Set a specific ChangeSpendPolicy. See TxBuilder::do_not_spend_change and TxBuilder::only_spend_change for some shortcuts. This method assumes the presence of an internal keychain, otherwise it has no effect.

Link copied to clipboard
abstract fun currentHeight(height: UInt): TxBuilder

Set the current blockchain height.

Link copied to clipboard
abstract fun doNotSpendChange(): TxBuilder

Do not spend change outputs.

Link copied to clipboard
abstract fun drainTo(script: Script): TxBuilder

Sets the address to drain excess coins to.

Link copied to clipboard
abstract fun drainWallet(): TxBuilder

Spend all the available inputs. This respects filters like TxBuilder::unspendable and the change policy.

Link copied to clipboard
abstract fun feeAbsolute(feeAmount: Amount): TxBuilder

Set an absolute fee The fee_absolute method refers to the absolute transaction fee in Amount. If anyone sets both the fee_absolute method and the fee_rate method, the FeePolicy enum will be set by whichever method was called last, as the FeeRate and FeeAmount are mutually exclusive.

Link copied to clipboard
abstract fun feeRate(feeRate: FeeRate): TxBuilder

Set a custom fee rate.

Link copied to clipboard
abstract fun finish(wallet: Wallet): Psbt

Finish building the transaction.

Link copied to clipboard

Only spend utxos added by TxBuilder::add_utxo.

Link copied to clipboard
abstract fun nlocktime(locktime: LockTime): TxBuilder

Use a specific nLockTime while creating the transaction.

Link copied to clipboard
abstract fun onlySpendChange(): TxBuilder

Only spend change outputs.

Link copied to clipboard
abstract fun policyPath(policyPath: Map<String, List<ULong>>, keychain: KeychainKind): TxBuilder

The TxBuilder::policy_path is a complex API. See the Rust docs for complete information: https://docs.rs/bdk_wallet/latest/bdk_wallet/struct.TxBuilder.html#method.policy_path

Link copied to clipboard
abstract fun setExactSequence(nsequence: UInt): TxBuilder

Set an exact nSequence value.

Link copied to clipboard
abstract fun setRecipients(recipients: List<ScriptAmount>): TxBuilder

Replace the recipients already added with a new list of recipients.

Link copied to clipboard
abstract fun unspendable(unspendable: List<OutPoint>): TxBuilder

Replace the internal list of unspendable utxos with a new list.

Link copied to clipboard
abstract fun version(version: Int): TxBuilder

Build a transaction with a specific version.