Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 209 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ serde_json = "1.0.149"
[dev-dependencies]
anyhow = "1.0"
alloy = { version = "1.1.2", features = ["node-bindings", "provider-ws"] }
test-log = { version = "0.2.18", features = ["trace"] }

[package.metadata.docs.rs]
all-features = true
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ pub use robust_provider::{
CoreError, DEFAULT_CALL_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_MIN_DELAY,
DEFAULT_RECONNECT_INTERVAL, DEFAULT_SUBSCRIPTION_BUFFER_CAPACITY, DEFAULT_SUBSCRIPTION_TIMEOUT,
Error, IntoRobustProvider, IntoRootProvider, RobustProvider, RobustProviderBuilder,
RobustSubscription, RobustSubscriptionStream, SubscriptionError,
RobustSubscription, RobustSubscriptionStream,
};

#[cfg(feature = "http-subscription")]
pub use robust_provider::{
DEFAULT_BUFFER_CAPACITY, DEFAULT_POLL_INTERVAL, HttpPollingSubscription,
HttpSubscriptionConfig, HttpSubscriptionError,
};
pub use robust_provider::DEFAULT_POLL_INTERVAL;
2 changes: 0 additions & 2 deletions src/macros/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ macro_rules! robust_rpc {
// Call the provider method with turbofish syntax if generics are present
provider.$method $(::<$($generic),+>)? ($($($arg),+)?).await
},
false, // is_subscription = false
)
.await;

Expand Down Expand Up @@ -203,7 +202,6 @@ macro_rules! robust_rpc {
provider.$method $(::<$($generic),+>)? ($($arg),+).await
}
},
false, // is_subscription = false
)
.await;

Expand Down
9 changes: 6 additions & 3 deletions src/robust_provider/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ use crate::robust_provider::{
Error, IntoRootProvider, RobustProvider, subscription::DEFAULT_RECONNECT_INTERVAL,
};

#[cfg(feature = "http-subscription")]
use crate::robust_provider::http_subscription::DEFAULT_POLL_INTERVAL;

type BoxedProviderFuture<N> = Pin<Box<dyn Future<Output = Result<RootProvider<N>, Error>> + Send>>;

// RPC retry and timeout settings
Expand All @@ -22,6 +19,12 @@ pub const DEFAULT_MAX_RETRIES: usize = 3;
pub const DEFAULT_MIN_DELAY: Duration = Duration::from_secs(1);
/// Default subscription channel size.
pub const DEFAULT_SUBSCRIPTION_BUFFER_CAPACITY: usize = 128;
/// Default polling interval for HTTP subscriptions.
///
/// Set to 12 seconds to match approximate Ethereum mainnet block time.
/// Adjust based on the target chain's block time.
#[cfg(feature = "http-subscription")]
pub const DEFAULT_POLL_INTERVAL: Duration = Duration::from_secs(12);

/// Builder for constructing a [`RobustProvider`].
///
Expand Down
Loading