pub struct AlloyChainProvider { /* private fields */ }
Expand description
The AlloyChainProvider is a concrete implementation of the ChainProvider trait, providing data over Ethereum JSON-RPC using an alloy provider as the backend.
Note:
This provider fetches data using the debug_getRawHeader
, debug_getRawReceipts
, and
debug_getRawBlock
methods. The RPC must support this namespace.
Implementations§
Source§impl AlloyChainProvider
impl AlloyChainProvider
Sourcepub fn new(inner: ReqwestProvider) -> Self
pub fn new(inner: ReqwestProvider) -> Self
Creates a new AlloyChainProvider with the given alloy provider.
Sourcepub fn new_http(url: Url) -> Self
pub fn new_http(url: Url) -> Self
Creates a new AlloyChainProvider from the provided reqwest::Url.
Sourcepub async fn latest_block_number(
&mut self,
) -> Result<u64, RpcError<TransportErrorKind>>
pub async fn latest_block_number( &mut self, ) -> Result<u64, RpcError<TransportErrorKind>>
Returns the latest L2 block number.
Trait Implementations§
Source§impl ChainProvider for AlloyChainProvider
impl ChainProvider for AlloyChainProvider
Source§type Error = AlloyProviderError
type Error = AlloyProviderError
The error type for the ChainProvider.
Source§fn header_by_hash<'life0, 'async_trait>(
&'life0 mut self,
hash: B256,
) -> Pin<Box<dyn Future<Output = Result<Header, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn header_by_hash<'life0, 'async_trait>(
&'life0 mut self,
hash: B256,
) -> Pin<Box<dyn Future<Output = Result<Header, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn block_info_by_number<'life0, 'async_trait>(
&'life0 mut self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockInfo, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn block_info_by_number<'life0, 'async_trait>(
&'life0 mut self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockInfo, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the block at the given number, or an error if the block does not exist in the data
source.
Source§fn receipts_by_hash<'life0, 'async_trait>(
&'life0 mut self,
hash: B256,
) -> Pin<Box<dyn Future<Output = Result<Vec<Receipt>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receipts_by_hash<'life0, 'async_trait>(
&'life0 mut self,
hash: B256,
) -> Pin<Box<dyn Future<Output = Result<Vec<Receipt>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns all receipts in the block with the given hash, or an error if the block does not
exist in the data source.
Source§fn block_info_and_transactions_by_hash<'life0, 'async_trait>(
&'life0 mut self,
hash: B256,
) -> Pin<Box<dyn Future<Output = Result<(BlockInfo, Vec<TxEnvelope>), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn block_info_and_transactions_by_hash<'life0, 'async_trait>(
&'life0 mut self,
hash: B256,
) -> Pin<Box<dyn Future<Output = Result<(BlockInfo, Vec<TxEnvelope>), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the BlockInfo and list of TxEnvelopes from the given block hash.
Source§impl Clone for AlloyChainProvider
impl Clone for AlloyChainProvider
Source§fn clone(&self) -> AlloyChainProvider
fn clone(&self) -> AlloyChainProvider
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for AlloyChainProvider
impl !RefUnwindSafe for AlloyChainProvider
impl Send for AlloyChainProvider
impl Sync for AlloyChainProvider
impl Unpin for AlloyChainProvider
impl !UnwindSafe for AlloyChainProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more