TxBuilder class

A transaction builder

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

Constructors

TxBuilder.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addData({required List<int> data}) TxBuilder
Add data as an output, using OP_RETURN
addForeignUtxo(Input psbtInput, OutPoint outPoint, BigInt satisfactionWeight) TxBuilder
Add a foreign UTXO i.e. a UTXO not owned by this wallet. At a minimum to add a foreign UTXO we need:
addRecipient(ScriptBuf script, BigInt amount) TxBuilder
Add a recipient to the internal list
addUnSpendable(OutPoint unSpendable) TxBuilder
Add a utxo to the internal list of unspendable utxos
addUtxo(OutPoint outpoint) TxBuilder
Add a utxo to the internal list of utxos that must be spent
addUtxos(List<OutPoint> outpoints) TxBuilder
Add the list of outpoints to the internal list of UTXOs that must be spent.
doNotSpendChange() TxBuilder
Do not spend change outputs
drainTo(ScriptBuf script) TxBuilder
Sets the address to drain excess coins to.
drainWallet() TxBuilder
Spend all the available inputs. This respects filters like TxBuilder().unSpendable and the change policy.
enableRbf() TxBuilder
Enable signaling RBF
enableRbfWithSequence(int nSequence) TxBuilder
Enable signaling RBF with a specific nSequence value
feeAbsolute(BigInt feeAmount) TxBuilder
Set an absolute fee
feeRate(double satPerVbyte) TxBuilder
Set a custom fee rate
finish(Wallet wallet) Future<(PartiallySignedTransaction, TransactionDetails)>
Finish building the transaction.
manuallySelectedOnly() TxBuilder
Only spend utxos added by add_utxo.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onlySpendChange() TxBuilder
Only spend change outputs
policyPath(KeychainKind keychain, Map<String, Uint32List> path) TxBuilder
Set the policy path to use while creating the transaction for a given keychain. This method accepts a map where the key is the policy node id (see policy.id()) and the value is the list of the indexes of the items that are intended to be satisfied from the policy node (see SatisfiableItem.Thresh.items).
setRecipients(List<(ScriptBuf, BigInt)> recipients) TxBuilder
Replace the recipients already added with a new list
toString() String
A string representation of this object.
inherited
unSpendable(List<OutPoint> outpoints) TxBuilder
Add a utxo to the internal list of unspendable utxos

Operators

operator ==(Object other) bool
The equality operator.
inherited