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
// SPDX-FileCopyrightText: 2025 Semiotic AI, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//! Transport layer utilities for Alloy providers.
//!
//! This module provides Tower-based middleware layers for customizing
//! the RPC transport behavior of Alloy providers.
//!
//! Note: RPC request/response logging is handled natively by alloy's transport
//! layer at DEBUG/TRACE level.
//!
//! # Rate Limiting
//!
//! The [`RateLimitLayer`] provides configurable rate limiting for RPC requests,
//! helping to stay within API rate limits for various RPC providers.
//!
//! ## Usage
//!
//! ```rust,ignore
//! use semioscan::transport::RateLimitLayer;
//! use alloy_rpc_client::ClientBuilder;
//! use alloy_provider::ProviderBuilder;
//! use std::time::Duration;
//!
//! // Create a client with rate limiting (10 requests per second)
//! let client = ClientBuilder::default()
//! .layer(RateLimitLayer::new(10, Duration::from_secs(1)))
//! .http(rpc_url);
//!
//! let provider = ProviderBuilder::new()
//! .connect_client(client);
//! ```
//!
//! ## With Chain-Specific Configuration
//!
//! ```rust,ignore
//! use semioscan::transport::RateLimitLayer;
//! use alloy_chains::NamedChain;
//! use std::time::Duration;
//!
//! // Create rate limiter based on chain requirements
//! let layer = match chain {
//! NamedChain::Base => RateLimitLayer::new(4, Duration::from_secs(1)),
//! NamedChain::Optimism => RateLimitLayer::new(10, Duration::from_secs(1)),
//! _ => RateLimitLayer::new(25, Duration::from_secs(1)),
//! };
//! ```
pub use ;
pub use ;