Skip to content

Commit 67c6830

Browse files
committed
update robust provider docs
1 parent 63d388b commit 67c6830

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/robust_provider/provider.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ impl<N: Network> RobustProvider<N> {
4242

4343
/// Fetch a block by [`BlockNumberOrTag`] with retry and timeout.
4444
///
45+
/// This is a wrapper function for [`Provider::get_block_by_number`].
46+
///
4547
/// # Errors
4648
///
4749
/// See [retry errors](#retry-errors).
@@ -65,6 +67,8 @@ impl<N: Network> RobustProvider<N> {
6567

6668
/// Fetch a block number by [`BlockId`] with retry and timeout.
6769
///
70+
/// This is a wrapper function for [`Provider::get_block`].
71+
///
6872
/// # Errors
6973
///
7074
/// See [retry errors](#retry-errors).
@@ -81,6 +85,8 @@ impl<N: Network> RobustProvider<N> {
8185

8286
/// Fetch the latest block number with retry and timeout.
8387
///
88+
/// This is a wrapper function for [`Provider::get_block_number`].
89+
///
8490
/// # Errors
8591
///
8692
/// See [retry errors](#retry-errors).
@@ -100,21 +106,27 @@ impl<N: Network> RobustProvider<N> {
100106

101107
/// Get the block number for a given block identifier.
102108
///
109+
/// This is a wrapper function for [`Provider::get_block_number_by_id`].
110+
///
111+
/// # Arguments
112+
///
113+
/// * `block_id` - The block identifier to fetch the block number for.
114+
///
103115
/// # Errors
104116
///
105117
/// See [retry errors](#retry-errors).
106-
pub async fn get_block_number_by_id(&self, id: BlockId) -> Result<u64, Error> {
118+
pub async fn get_block_number_by_id(&self, block_id: BlockId) -> Result<u64, Error> {
107119
info!("get_block_number_by_id called");
108120
let result = self
109121
.retry_with_total_timeout(
110-
move |provider| async move { provider.get_block_number_by_id(id).await },
122+
move |provider| async move { provider.get_block_number_by_id(block_id).await },
111123
false,
112124
)
113125
.await;
114126
if let Err(e) = &result {
115127
error!(error = %e, "get_block_number_by_id failed");
116128
}
117-
result?.ok_or_else(|| Error::BlockNotFound(id))
129+
result?.ok_or_else(|| Error::BlockNotFound(block_id))
118130
}
119131

120132
/// Fetch the latest confirmed block number with retry and timeout.
@@ -139,6 +151,8 @@ impl<N: Network> RobustProvider<N> {
139151

140152
/// Fetch a block by [`BlockHash`] with retry and timeout.
141153
///
154+
/// This is a wrapper function for [`Provider::get_block_by_hash`].
155+
///
142156
/// # Errors
143157
///
144158
/// See [retry errors](#retry-errors).
@@ -159,6 +173,8 @@ impl<N: Network> RobustProvider<N> {
159173

160174
/// Fetch logs for the given [`Filter`] with retry and timeout.
161175
///
176+
/// This is a wrapper function for [`Provider::get_logs`].
177+
///
162178
/// # Errors
163179
///
164180
/// See [retry errors](#retry-errors).
@@ -178,6 +194,8 @@ impl<N: Network> RobustProvider<N> {
178194

179195
/// Subscribe to new block headers with retry and timeout.
180196
///
197+
/// This is a wrapper function for [`Provider::subscribe_blocks`].
198+
///
181199
/// # Errors
182200
///
183201
/// see [retry errors](#retry-errors).

0 commit comments

Comments
 (0)