diff --git a/crates/core/src/spk_client.rs b/crates/core/src/spk_client.rs index 1aceae5bb..eee4a5371 100644 --- a/crates/core/src/spk_client.rs +++ b/crates/core/src/spk_client.rs @@ -322,14 +322,14 @@ impl SyncRequest { /// See also [`SyncRequest`]. #[must_use] #[derive(Debug)] -pub struct SyncResult { +pub struct SyncResponse { /// Relevant transaction data discovered during the scan. pub tx_update: crate::TxUpdate, /// Changes to the chain discovered during the scan. pub chain_update: Option, } -impl Default for SyncResult { +impl Default for SyncResponse { fn default() -> Self { Self { tx_update: Default::default(), @@ -459,7 +459,7 @@ impl FullScanRequest { /// See also [`FullScanRequest`]. #[must_use] #[derive(Debug)] -pub struct FullScanResult { +pub struct FullScanResponse { /// Relevant transaction data discovered during the scan. pub tx_update: crate::TxUpdate, /// Last active indices for the corresponding keychains (`K`). An index is active if it had a @@ -469,7 +469,7 @@ pub struct FullScanResult { pub chain_update: Option, } -impl Default for FullScanResult { +impl Default for FullScanResponse { fn default() -> Self { Self { tx_update: Default::default(), diff --git a/crates/electrum/src/bdk_electrum_client.rs b/crates/electrum/src/bdk_electrum_client.rs index a98063336..f9e53bff8 100644 --- a/crates/electrum/src/bdk_electrum_client.rs +++ b/crates/electrum/src/bdk_electrum_client.rs @@ -1,7 +1,7 @@ use bdk_core::{ bitcoin::{block::Header, BlockHash, OutPoint, ScriptBuf, Transaction, Txid}, collections::{BTreeMap, HashMap}, - spk_client::{FullScanRequest, FullScanResult, SyncRequest, SyncResult}, + spk_client::{FullScanRequest, FullScanResponse, SyncRequest, SyncResponse}, BlockId, CheckPoint, ConfirmationBlockTime, TxUpdate, }; use electrum_client::{ElectrumApi, Error, HeaderNotification}; @@ -126,7 +126,7 @@ impl BdkElectrumClient { stop_gap: usize, batch_size: usize, fetch_prev_txouts: bool, - ) -> Result, Error> { + ) -> Result, Error> { let mut request: FullScanRequest = request.into(); let tip_and_latest_blocks = match request.chain_tip() { @@ -159,7 +159,7 @@ impl BdkElectrumClient { _ => None, }; - Ok(FullScanResult { + Ok(FullScanResponse { tx_update, chain_update, last_active_indices, @@ -194,7 +194,7 @@ impl BdkElectrumClient { request: impl Into>, batch_size: usize, fetch_prev_txouts: bool, - ) -> Result { + ) -> Result { let mut request: SyncRequest = request.into(); let tip_and_latest_blocks = match request.chain_tip() { @@ -229,7 +229,7 @@ impl BdkElectrumClient { None => None, }; - Ok(SyncResult { + Ok(SyncResponse { tx_update, chain_update, }) diff --git a/crates/electrum/src/lib.rs b/crates/electrum/src/lib.rs index 914b4f19a..8bc87321f 100644 --- a/crates/electrum/src/lib.rs +++ b/crates/electrum/src/lib.rs @@ -1,7 +1,7 @@ //! This crate is used for returning updates from Electrum servers. //! -//! Updates are returned as either a [`SyncResult`] (if [`BdkElectrumClient::sync()`] is called), -//! or a [`FullScanResult`] (if [`BdkElectrumClient::full_scan()`] is called). +//! Updates are returned as either a [`SyncResponse`] (if [`BdkElectrumClient::sync()`] is called), +//! or a [`FullScanResponse`] (if [`BdkElectrumClient::full_scan()`] is called). //! //! In most cases [`BdkElectrumClient::sync()`] is used to sync the transaction histories of scripts //! that the application cares about, for example the scripts for all the receive addresses of a @@ -14,8 +14,8 @@ //! Refer to [`example_electrum`] for a complete example. //! //! [`example_electrum`]: https://github.com/bitcoindevkit/bdk/tree/master/example-crates/example_electrum -//! [`SyncResult`]: bdk_core::spk_client::SyncResult -//! [`FullScanResult`]: bdk_core::spk_client::FullScanResult +//! [`SyncResponse`]: bdk_core::spk_client::SyncResponse +//! [`FullScanResponse`]: bdk_core::spk_client::FullScanResponse #![warn(missing_docs)] diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs index 5f032ba6c..d2dba9d8d 100644 --- a/crates/electrum/tests/test_electrum.rs +++ b/crates/electrum/tests/test_electrum.rs @@ -1,7 +1,7 @@ use bdk_chain::{ bitcoin::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash}, local_chain::LocalChain, - spk_client::{FullScanRequest, SyncRequest, SyncResult}, + spk_client::{FullScanRequest, SyncRequest, SyncResponse}, spk_txout::SpkTxOutIndex, Balance, ConfirmationBlockTime, IndexedTxGraph, Indexer, Merge, TxGraph, }; @@ -31,7 +31,7 @@ fn sync_with_electrum( spks: Spks, chain: &mut LocalChain, graph: &mut IndexedTxGraph, -) -> anyhow::Result +) -> anyhow::Result where I: Indexer, I::ChangeSet: Default + Merge, diff --git a/crates/esplora/src/async_ext.rs b/crates/esplora/src/async_ext.rs index ca5111613..b9b7fa567 100644 --- a/crates/esplora/src/async_ext.rs +++ b/crates/esplora/src/async_ext.rs @@ -1,6 +1,6 @@ use async_trait::async_trait; use bdk_core::collections::{BTreeMap, BTreeSet, HashSet}; -use bdk_core::spk_client::{FullScanRequest, FullScanResult, SyncRequest, SyncResult}; +use bdk_core::spk_client::{FullScanRequest, FullScanResponse, SyncRequest, SyncResponse}; use bdk_core::{ bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid}, BlockId, CheckPoint, ConfirmationBlockTime, Indexed, TxUpdate, @@ -32,7 +32,7 @@ pub trait EsploraAsyncExt { request: R, stop_gap: usize, parallel_requests: usize, - ) -> Result, Error>; + ) -> Result, Error>; /// Sync a set of scripts, txids, and/or outpoints against Esplora. /// @@ -45,7 +45,7 @@ pub trait EsploraAsyncExt { &self, request: R, parallel_requests: usize, - ) -> Result; + ) -> Result; } #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] @@ -56,7 +56,7 @@ impl EsploraAsyncExt for esplora_client::AsyncClient { request: R, stop_gap: usize, parallel_requests: usize, - ) -> Result, Error> { + ) -> Result, Error> { let mut request = request.into(); let keychains = request.keychains(); @@ -93,7 +93,7 @@ impl EsploraAsyncExt for esplora_client::AsyncClient { _ => None, }; - Ok(FullScanResult { + Ok(FullScanResponse { chain_update, tx_update, last_active_indices, @@ -104,7 +104,7 @@ impl EsploraAsyncExt for esplora_client::AsyncClient { &self, request: R, parallel_requests: usize, - ) -> Result { + ) -> Result { let mut request = request.into(); let chain_tip = request.chain_tip(); @@ -151,7 +151,7 @@ impl EsploraAsyncExt for esplora_client::AsyncClient { _ => None, }; - Ok(SyncResult { + Ok(SyncResponse { chain_update, tx_update, }) diff --git a/crates/esplora/src/blocking_ext.rs b/crates/esplora/src/blocking_ext.rs index b740a21db..655055b33 100644 --- a/crates/esplora/src/blocking_ext.rs +++ b/crates/esplora/src/blocking_ext.rs @@ -1,5 +1,5 @@ use bdk_core::collections::{BTreeMap, BTreeSet, HashSet}; -use bdk_core::spk_client::{FullScanRequest, FullScanResult, SyncRequest, SyncResult}; +use bdk_core::spk_client::{FullScanRequest, FullScanResponse, SyncRequest, SyncResponse}; use bdk_core::{ bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid}, BlockId, CheckPoint, ConfirmationBlockTime, Indexed, TxUpdate, @@ -30,7 +30,7 @@ pub trait EsploraExt { request: R, stop_gap: usize, parallel_requests: usize, - ) -> Result, Error>; + ) -> Result, Error>; /// Sync a set of scripts, txids, and/or outpoints against Esplora. /// @@ -43,7 +43,7 @@ pub trait EsploraExt { &self, request: R, parallel_requests: usize, - ) -> Result; + ) -> Result; } impl EsploraExt for esplora_client::BlockingClient { @@ -52,7 +52,7 @@ impl EsploraExt for esplora_client::BlockingClient { request: R, stop_gap: usize, parallel_requests: usize, - ) -> Result, Error> { + ) -> Result, Error> { let mut request = request.into(); let chain_tip = request.chain_tip(); @@ -90,7 +90,7 @@ impl EsploraExt for esplora_client::BlockingClient { _ => None, }; - Ok(FullScanResult { + Ok(FullScanResponse { chain_update, tx_update, last_active_indices, @@ -101,7 +101,7 @@ impl EsploraExt for esplora_client::BlockingClient { &self, request: R, parallel_requests: usize, - ) -> Result { + ) -> Result { let mut request: SyncRequest = request.into(); let chain_tip = request.chain_tip(); @@ -142,7 +142,7 @@ impl EsploraExt for esplora_client::BlockingClient { _ => None, }; - Ok(SyncResult { + Ok(SyncResponse { chain_update, tx_update, }) diff --git a/crates/wallet/src/wallet/mod.rs b/crates/wallet/src/wallet/mod.rs index 136312e9a..752cd3d28 100644 --- a/crates/wallet/src/wallet/mod.rs +++ b/crates/wallet/src/wallet/mod.rs @@ -26,8 +26,8 @@ use bdk_chain::{ indexer::keychain_txout::KeychainTxOutIndex, local_chain::{ApplyHeaderError, CannotConnectError, CheckPoint, CheckPointIter, LocalChain}, spk_client::{ - FullScanRequest, FullScanRequestBuilder, FullScanResult, SyncRequest, SyncRequestBuilder, - SyncResult, + FullScanRequest, FullScanRequestBuilder, FullScanResponse, SyncRequest, SyncRequestBuilder, + SyncResponse, }, tx_graph::{CalculateFeeError, CanonicalTx, TxGraph, TxUpdate}, BlockId, ChainPosition, ConfirmationBlockTime, DescriptorExt, FullTxOut, Indexed, @@ -130,8 +130,8 @@ pub struct Update { pub chain: Option, } -impl From> for Update { - fn from(value: FullScanResult) -> Self { +impl From> for Update { + fn from(value: FullScanResponse) -> Self { Self { last_active_indices: value.last_active_indices, tx_update: value.tx_update, @@ -140,8 +140,8 @@ impl From> for Update { } } -impl From for Update { - fn from(value: SyncResult) -> Self { +impl From for Update { + fn from(value: SyncResponse) -> Self { Self { last_active_indices: BTreeMap::new(), tx_update: value.tx_update,