1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Pluggable standardized Bitcoin backend

#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(unused_extern_crates)]

#[doc(hidden)]
#[macro_use]
pub mod macros;

/// Bitcoin Provider trait
pub mod provider;

/// Pending Transaction
pub mod pending;

/// Outpoint spend watcher
pub mod watcher;

/// Chain watcher
pub mod chain;

#[doc(hidden)]
#[cfg(any(feature = "rpc", feature = "esplora"))]
pub mod reqwest_utils;

/// Utils
pub mod utils;

/// EsploraProvider
#[cfg(feature = "esplora")]
pub mod esplora;

/// Local (or remote) node RPC
#[cfg(feature = "rpc")]
pub mod rpc;

/// Common usage
pub mod prelude;

/// Minimal Types
pub mod types;

/// The default poll interval, set to 300 seconds (5 minutes)
pub const DEFAULT_POLL_INTERVAL: std::time::Duration = std::time::Duration::from_millis(180 * 1000);

/// The default number of cache items to keep in a caching provider
pub const DEFAULT_CACHE_SIZE: usize = 300;

// Alias the default encoder
type Encoder = bitcoins::Encoder;

// Useful alias for the stateful streams
#[cfg(target_arch = "wasm32")]
type ProviderFut<'a, T> = std::pin::Pin<
    Box<dyn std::future::Future<Output = Result<T, crate::provider::ProviderError>> + 'a>,
>;

// Useful alias for the stateful streams
#[cfg(not(target_arch = "wasm32"))]
type ProviderFut<'a, T> = std::pin::Pin<
    Box<dyn std::future::Future<Output = Result<T, crate::provider::ProviderError>> + 'a + Send>,
>;