pub use bdk_chain::keychain::Balance;
use bdk_chain::{
indexed_tx_graph,
- keychain::{KeychainTxOutIndex, WalletChangeSet, WalletUpdate},
+ keychain::{KeychainTxOutIndex, WalletChangeSet},
local_chain::{self, CannotConnectError, CheckPoint, CheckPointIter, LocalChain},
tx_graph::{CanonicalTx, TxGraph},
Append, BlockId, ChainPosition, ConfirmationTime, ConfirmationTimeAnchor, FullTxOut,
secp: SecpCtx,
}
+/// A structure to update [`KeychainTxOutIndex`], [`TxGraph`] and [`LocalChain`] atomically.
+///
+/// [`LocalChain`]: local_chain::LocalChain
+#[derive(Debug, Clone)]
+pub struct WalletUpdate<K, A> {
+ /// Contains the last active derivation indices per keychain (`K`), which is used to update the
+ /// [`KeychainTxOutIndex`].
+ pub last_active_indices: BTreeMap<K, u32>,
+
+ /// Update for the [`TxGraph`].
+ pub graph: TxGraph<A>,
+
+ /// Update for the [`LocalChain`].
+ ///
+ /// [`LocalChain`]: local_chain::LocalChain
+ pub chain: local_chain::Update,
+}
+
+impl<K, A> WalletUpdate<K, A> {
+ /// Construct a [`WalletUpdate`] with a given [`local_chain::Update`].
+ pub fn new(chain_update: local_chain::Update) -> Self {
+ Self {
+ last_active_indices: BTreeMap::new(),
+ graph: TxGraph::default(),
+ chain: chain_update,
+ }
+ }
+}
+
/// The update to a [`Wallet`] used in [`Wallet::apply_update`]. This is usually returned from blockchain data sources.
pub type Update = WalletUpdate<KeychainKind, ConfirmationTimeAnchor>;
//!
//! [`SpkTxOutIndex`]: crate::SpkTxOutIndex
-use crate::{
- collections::BTreeMap, indexed_tx_graph, local_chain, tx_graph::TxGraph, Anchor, Append,
-};
+use crate::{collections::BTreeMap, indexed_tx_graph, local_chain, Anchor, Append};
#[cfg(feature = "miniscript")]
mod txout_index;
}
}
-/// A structure to update [`KeychainTxOutIndex`], [`TxGraph`] and [`LocalChain`] atomically.
-///
-/// [`LocalChain`]: local_chain::LocalChain
-#[derive(Debug, Clone)]
-pub struct WalletUpdate<K, A> {
- /// Contains the last active derivation indices per keychain (`K`), which is used to update the
- /// [`KeychainTxOutIndex`].
- pub last_active_indices: BTreeMap<K, u32>,
-
- /// Update for the [`TxGraph`].
- pub graph: TxGraph<A>,
-
- /// Update for the [`LocalChain`].
- ///
- /// [`LocalChain`]: local_chain::LocalChain
- pub chain: local_chain::Update,
-}
-
-impl<K, A> WalletUpdate<K, A> {
- /// Construct a [`WalletUpdate`] with a given [`local_chain::Update`].
- pub fn new(chain_update: local_chain::Update) -> Self {
- Self {
- last_active_indices: BTreeMap::new(),
- graph: TxGraph::default(),
- chain: chain_update,
- }
- }
-}
-
/// A structure that records the corresponding changes as result of applying an [`WalletUpdate`].
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(
use bdk::bitcoin::Address;
use bdk::SignOptions;
-use bdk::{bitcoin::Network, Wallet};
-use bdk_electrum::bdk_chain::{keychain::WalletUpdate, local_chain};
+use bdk::{bitcoin::Network, wallet::WalletUpdate, Wallet};
+use bdk_electrum::bdk_chain::local_chain;
use bdk_electrum::electrum_client::{self, ElectrumApi};
use bdk_electrum::ElectrumExt;
use bdk_file_store::Store;
use bdk::{
bitcoin::{Address, Network},
- chain::keychain::WalletUpdate,
- wallet::AddressIndex,
+ wallet::{AddressIndex, WalletUpdate},
SignOptions, Wallet,
};
use bdk_esplora::{esplora_client, EsploraAsyncExt};
use bdk::{
bitcoin::{Address, Network},
- chain::keychain::WalletUpdate,
- wallet::AddressIndex,
+ wallet::{AddressIndex, WalletUpdate},
SignOptions, Wallet,
};
use bdk_esplora::{esplora_client, EsploraExt};