diff --git a/src/lib.rs b/src/lib.rs index b3c9d40..d3d972a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,11 +46,11 @@ use std::collections::HashSet; type FutureResult<'a, T, E> = Pin> + Send + 'a>>; pub use bdk_wallet::chain::local_chain::MissingGenesisError; +pub use bdk_wallet::Update; use bdk_wallet::chain::{ keychain_txout::KeychainTxOutIndex, local_chain::{self, CheckPoint, LocalChain}, - spk_client::FullScanResponse, IndexedTxGraph, }; use bdk_wallet::chain::{ConfirmationBlockTime, TxUpdate}; @@ -120,7 +120,7 @@ impl UpdateSubscriber { /// A reference to a [`NodeEventHandler`] is required, which handles events emitted from a /// running node. Production applications should define how the application handles /// these events and displays them to end users. - pub async fn update(&mut self) -> Option> { + pub async fn update(&mut self) -> Option { let mut chain_changeset = BTreeMap::new(); while let Some(message) = self.receiver.recv().await { match message { @@ -161,15 +161,15 @@ impl UpdateSubscriber { // When the client is believed to have synced to the chain tip of most work, // we can return a wallet update. - fn get_scan_response(&mut self) -> FullScanResponse { + fn get_scan_response(&mut self) -> Update { let tx_update = TxUpdate::from(self.graph.graph().clone()); let graph = core::mem::take(&mut self.graph); let last_active_indices = graph.index.last_used_indices(); self.graph = IndexedTxGraph::new(graph.index); - FullScanResponse { + Update { tx_update, last_active_indices, - chain_update: Some(self.chain.tip()), + chain: Some(self.chain.tip()), } } } diff --git a/tests/client.rs b/tests/client.rs index ecb7426..4e90b43 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -12,9 +12,9 @@ use bdk_testenv::bitcoincore_rpc::RpcApi; use bdk_testenv::bitcoind; use bdk_testenv::TestEnv; use bdk_wallet::bitcoin::{Amount, Network}; -use bdk_wallet::chain::spk_client::FullScanResponse; use bdk_wallet::CreateParams; use bdk_wallet::KeychainKind; +use bdk_wallet::Update; const EXTERNAL_DESCRIPTOR: &str = "tr([7d94197e/86'/1'/0']tpubDCyQVJj8KzjiQsFjmb3KwECVXPvMwvAxxZGCP9XmWSopmjW3bCV3wD7TgxrUhiGSueDS1MU5X1Vb1YjYcp8jitXc5fXfdC1z68hDDEyKRNr/0/*)"; const INTERNAL_DESCRIPTOR: &str = "tr([7d94197e/86'/1'/0']tpubDCyQVJj8KzjiQsFjmb3KwECVXPvMwvAxxZGCP9XmWSopmjW3bCV3wD7TgxrUhiGSueDS1MU5X1Vb1YjYcp8jitXc5fXfdC1z68hDDEyKRNr/1/*)"; @@ -98,9 +98,9 @@ async fn update_returns_blockchain_data() -> anyhow::Result<()> { .update() .await .expect("should have update"); - let FullScanResponse { + let Update { tx_update, - chain_update, + chain, last_active_indices, } = res; // graph tx and anchor @@ -112,7 +112,7 @@ async fn update_returns_blockchain_data() -> anyhow::Result<()> { let txout = tx.output.iter().find(|txout| txout.value == amt).unwrap(); assert_eq!(txout.script_pubkey, addr.script_pubkey()); // chain - let update_cp = chain_update.unwrap(); + let update_cp = chain.unwrap(); assert_eq!(update_cp.height(), 102); // keychain assert_eq!(