WalletInterface
A Bitcoin wallet.
The Wallet acts as a way of coherently interfacing with output descriptors and related transactions. Its main components are:
output descriptors from which it can derive addresses.
signers that can contribute signatures to addresses instantiated from the descriptors.
The user is responsible for loading and writing wallet changes which are represented as ChangeSets (see take_staged). Also see individual functions and example for instructions on when Wallet state needs to be persisted.
The Wallet descriptor (external) and change descriptor (internal) must not derive the same script pubkeys. See KeychainTxOutIndex::insert_descriptor() for more details.
Inheritors
Functions
Apply relevant unconfirmed transactions to the wallet. Transactions that are not relevant are filtered out.
Applies an update to the wallet and stages the changes (but does not persist them).
Calculates the fee of a given transaction. Returns `Amount::ZERO` if tx
is a coinbase transaction.
Calculate the `FeeRate` for a given transaction.
Informs the wallet that you no longer intend to broadcast a tx that was built from it.
The derivation index of this wallet. It will return None
if it has not derived any addresses. Otherwise, it will return the index of the highest address it has derived.
Finds how the wallet derived the script pubkey spk
.
Return the checksum of the public descriptor associated to keychain
.
Get a single transaction from the wallet as a `WalletTx` (if the transaction exists).
Returns the utxo owned by this wallet corresponding to outpoint
if it exists in the wallet's database.
List all relevant outputs (includes both spent and unspent, confirmed and unconfirmed).
Return the list of unspent outputs of this wallet.
List addresses that are revealed but unused.
Marks an address used of the given keychain
at index
.
The index of the next address that you would get if you were to ask the wallet for a new address.
Get the next unused address for the given keychain
, i.e. the address with the lowest derivation index that hasn't been used in a transaction.
Peek an address of the given keychain
at index
without revealing it.
Persist staged changes of wallet into persister.
Return the spending policies for the wallet’s descriptor.
Reveal addresses up to and including the target index
and return an iterator of newly revealed addresses.
Attempt to reveal the next address of the given keychain
.
Compute the tx
's sent and received `Amount`s.
Sign a transaction with all the wallet's signers, in the order specified by every signer's `SignerOrdering`. This function returns the Result
type with an encapsulated bool
that has the value true if the PSBT was finalized, or false otherwise.
Create a `FullScanRequest for this wallet.
Create a partial `SyncRequest` for this wallet for all revealed spks.
Iterate over the transactions in the wallet.