Skip to content

Commit

Permalink
feat(bdk): add Wallet::list_output method
Browse files Browse the repository at this point in the history
  • Loading branch information
evanlinjin committed Nov 1, 2023
1 parent 723658f commit d76cead
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/bdk/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,20 @@ impl<D> Wallet<D> {
.map(|((k, i), full_txo)| new_local_utxo(k, i, full_txo))
}

/// List all relevant outputs (includes both spent and unspent).
///
/// To list only unspent outputs (UTXOs), use [`Wallet::list_unspent`] instead.
pub fn list_output(&self) -> impl Iterator<Item = LocalOutput> + '_ {
self.indexed_graph
.graph()
.filter_chain_txouts(
&self.chain,
self.chain.tip().map(|cp| cp.block_id()).unwrap_or_default(),
self.indexed_graph.index.outpoints().iter().cloned(),
)
.map(|((k, i), full_txo)| new_local_utxo(k, i, full_txo))
}

/// Get all the checkpoints the wallet is currently storing indexed by height.
pub fn checkpoints(&self) -> CheckPointIter {
self.chain.iter_checkpoints()
Expand Down

0 comments on commit d76cead

Please sign in to comment.