/// 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(),
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};
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() {
None => None,
};
- Ok(SyncResult {
+ Ok(SyncResponse {
tx_update,
chain_update,
})
//! 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
//! 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)]
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,
};
spks: Spks,
chain: &mut LocalChain,
graph: &mut IndexedTxGraph<ConfirmationBlockTime, I>,
-) -> anyhow::Result<SyncResult>
+) -> anyhow::Result<SyncResponse>
where
I: Indexer,
I::ChangeSet: Default + Merge,
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,
&self,
request: R,
parallel_requests: usize,
- ) -> Result<SyncResult, Error>;
+ ) -> Result<SyncResponse, Error>;
}
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
&self,
request: R,
parallel_requests: usize,
- ) -> Result<SyncResult, Error> {
+ ) -> Result<SyncResponse, Error> {
let mut request = request.into();
let chain_tip = request.chain_tip();
_ => None,
};
- Ok(SyncResult {
+ Ok(SyncResponse {
chain_update,
tx_update,
})
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,
&self,
request: R,
parallel_requests: usize,
- ) -> Result<SyncResult, Error>;
+ ) -> Result<SyncResponse, Error>;
}
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();
_ => None,
};
- Ok(SyncResult {
+ Ok(SyncResponse {
chain_update,
tx_update,
})
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,
}
}
-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,