Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat: add support for eth_getBlockReceipts #365

Merged
merged 4 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions ethers-providers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ pub trait Middleware: Sync + Send + Debug {
.map_err(FromErr::from)
}

async fn get_block_receipts<T: Into<BlockNumber> + Send + Sync>(
&self,
block: T,
) -> Result<Vec<TransactionReceipt>, Self::Error> {
self.inner()
.get_block_receipts(block)
.await
.map_err(FromErr::from)
}

async fn get_gas_price(&self) -> Result<U256, Self::Error> {
self.inner().get_gas_price().await.map_err(FromErr::from)
}
Expand Down
8 changes: 8 additions & 0 deletions ethers-providers/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ impl<P: JsonRpcClient> Middleware for Provider<P> {
self.request("eth_getTransactionReceipt", [hash]).await
}

/// Returns all receipts for a block.
async fn get_block_receipts<T: Into<BlockNumber> + Send + Sync>(
&self,
block: T,
) -> Result<Vec<TransactionReceipt>, Self::Error> {
self.request("eth_getBlockReceipts", [block.into()]).await
}

/// Gets the current gas price as estimated by the node
async fn get_gas_price(&self) -> Result<U256, ProviderError> {
self.request("eth_gasPrice", ()).await
Expand Down