]> Untitled Git - bdk/commitdiff
chore(core)!: rename `SyncResult` to `SyncResponse`
authorLeonardo Lima <oleonardolima@users.noreply.github.com>
Tue, 19 Nov 2024 03:15:25 +0000 (00:15 -0300)
committerLeonardo Lima <oleonardolima@users.noreply.github.com>
Tue, 19 Nov 2024 03:45:06 +0000 (00:45 -0300)
crates/core/src/spk_client.rs
crates/electrum/src/bdk_electrum_client.rs
crates/electrum/src/lib.rs
crates/electrum/tests/test_electrum.rs
crates/esplora/src/async_ext.rs
crates/esplora/src/blocking_ext.rs
crates/wallet/src/wallet/mod.rs

index 1aceae5bbb4a38acd40e2d417f2e152c6331e39b..e4090fb1d14d27d3aa95c3a03899e16b01d54580 100644 (file)
@@ -322,14 +322,14 @@ impl<I> SyncRequest<I> {
 /// See also [`SyncRequest`].
 #[must_use]
 #[derive(Debug)]
-pub struct SyncResult<A = ConfirmationBlockTime> {
+pub struct SyncResponse<A = ConfirmationBlockTime> {
     /// Relevant transaction data discovered during the scan.
     pub tx_update: crate::TxUpdate<A>,
     /// Changes to the chain discovered during the scan.
     pub chain_update: Option<CheckPoint>,
 }
 
-impl<A> Default for SyncResult<A> {
+impl<A> Default for SyncResponse<A> {
     fn default() -> Self {
         Self {
             tx_update: Default::default(),
index a98063336d880a645c5c970a2e555096b9a0ecae..e05e0db2dd5c18f32f0a446078d52b3e59170edc 100644 (file)
@@ -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, FullScanResult, SyncRequest, SyncResponse},
     BlockId, CheckPoint, ConfirmationBlockTime, TxUpdate,
 };
 use electrum_client::{ElectrumApi, Error, HeaderNotification};
@@ -194,7 +194,7 @@ impl<E: ElectrumApi> BdkElectrumClient<E> {
         request: impl Into<SyncRequest<I>>,
         batch_size: usize,
         fetch_prev_txouts: bool,
-    ) -> Result<SyncResult, Error> {
+    ) -> Result<SyncResponse, Error> {
         let mut request: SyncRequest<I> = request.into();
 
         let tip_and_latest_blocks = match request.chain_tip() {
@@ -229,7 +229,7 @@ impl<E: ElectrumApi> BdkElectrumClient<E> {
             None => None,
         };
 
-        Ok(SyncResult {
+        Ok(SyncResponse {
             tx_update,
             chain_update,
         })
index 914b4f19a4850b00b339d68da1f8136278259794..797fc2c64ac6a05e0a0318be8707b4dbd309eb15 100644 (file)
@@ -1,6 +1,6 @@
 //! This crate is used for returning updates from Electrum servers.
 //!
-//! Updates are returned as either a [`SyncResult`] (if [`BdkElectrumClient::sync()`] is called),
+//! Updates are returned as either a [`SyncResponse`] (if [`BdkElectrumClient::sync()`] is called),
 //! or a [`FullScanResult`] (if [`BdkElectrumClient::full_scan()`] is called).
 //!
 //! In most cases [`BdkElectrumClient::sync()`] is used to sync the transaction histories of scripts
@@ -14,7 +14,7 @@
 //! 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
+//! [`SyncResponse`]: bdk_core::spk_client::SyncResponse
 //! [`FullScanResult`]: bdk_core::spk_client::FullScanResult
 
 #![warn(missing_docs)]
index 5f032ba6cb58b43445530649ca67533130444adb..d2dba9d8de96f7ae9e18def57d81bd27973c76ea 100644 (file)
@@ -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<I, Spks>(
     spks: Spks,
     chain: &mut LocalChain,
     graph: &mut IndexedTxGraph<ConfirmationBlockTime, I>,
-) -> anyhow::Result<SyncResult>
+) -> anyhow::Result<SyncResponse>
 where
     I: Indexer,
     I::ChangeSet: Default + Merge,
index ca51116135065b3fa1db92e794c259725fbd4bd0..344f8dea0903a6a92ea130fdc8f00be0262f2531 100644 (file)
@@ -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, FullScanResult, SyncRequest, SyncResponse};
 use bdk_core::{
     bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid},
     BlockId, CheckPoint, ConfirmationBlockTime, Indexed, TxUpdate,
@@ -45,7 +45,7 @@ pub trait EsploraAsyncExt {
         &self,
         request: R,
         parallel_requests: usize,
-    ) -> Result<SyncResult, Error>;
+    ) -> Result<SyncResponse, Error>;
 }
 
 #[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
@@ -104,7 +104,7 @@ impl EsploraAsyncExt for esplora_client::AsyncClient {
         &self,
         request: R,
         parallel_requests: usize,
-    ) -> Result<SyncResult, Error> {
+    ) -> Result<SyncResponse, Error> {
         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,
         })
index b740a21dbcde82c9227f6de604fe644f7264518a..3e57cf0b65bd9ef980211e8cd1f4a3a84edbf768 100644 (file)
@@ -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, FullScanResult, SyncRequest, SyncResponse};
 use bdk_core::{
     bitcoin::{BlockHash, OutPoint, ScriptBuf, Txid},
     BlockId, CheckPoint, ConfirmationBlockTime, Indexed, TxUpdate,
@@ -43,7 +43,7 @@ pub trait EsploraExt {
         &self,
         request: R,
         parallel_requests: usize,
-    ) -> Result<SyncResult, Error>;
+    ) -> Result<SyncResponse, Error>;
 }
 
 impl EsploraExt for esplora_client::BlockingClient {
@@ -101,7 +101,7 @@ impl EsploraExt for esplora_client::BlockingClient {
         &self,
         request: R,
         parallel_requests: usize,
-    ) -> Result<SyncResult, Error> {
+    ) -> Result<SyncResponse, Error> {
         let mut request: SyncRequest<I> = 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,
         })
index 68d5e6bec28cc44ec6cb0f35d68d2c68e8877552..8f722151268d1c31a1dba8dda4936c93251fa56c 100644 (file)
@@ -27,7 +27,7 @@ use bdk_chain::{
     local_chain::{ApplyHeaderError, CannotConnectError, CheckPoint, CheckPointIter, LocalChain},
     spk_client::{
         FullScanRequest, FullScanRequestBuilder, FullScanResult, SyncRequest, SyncRequestBuilder,
-        SyncResult,
+        SyncResponse,
     },
     tx_graph::{CalculateFeeError, CanonicalTx, TxGraph, TxUpdate},
     BlockId, ChainPosition, ConfirmationBlockTime, DescriptorExt, FullTxOut, Indexed,
@@ -142,8 +142,8 @@ impl From<FullScanResult<KeychainKind>> for Update {
     }
 }
 
-impl From<SyncResult> for Update {
-    fn from(value: SyncResult) -> Self {
+impl From<SyncResponse> for Update {
+    fn from(value: SyncResponse) -> Self {
         Self {
             last_active_indices: BTreeMap::new(),
             tx_update: value.tx_update,