pub struct Endpoint {
pub config: EndpointConfig,
/* private fields */
}Expand description
A single RPC endpoint with its configuration and provider
Fields§
§config: EndpointConfigEndpoint configuration
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn new(
config: EndpointConfig,
timeout_secs: u64,
proxy: Option<&str>,
) -> Result<Self>
pub fn new( config: EndpointConfig, timeout_secs: u64, proxy: Option<&str>, ) -> Result<Self>
Create a new endpoint from config
Note: The proxy parameter is currently not implemented. Proxy support would
require using a custom reqwest client with the alloy provider.
§Errors
Returns RpcError::ProxyNotSupported if a proxy URL is provided, to prevent
users from having a false sense of privacy/security when traffic would actually
go direct.
Sourcepub fn max_block_range(&self) -> u64
pub fn max_block_range(&self) -> u64
Get max block range
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if enabled
Sourcepub fn provider(
&self,
) -> &FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>
pub fn provider( &self, ) -> &FillProvider<JoinFill<Identity, JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>>, RootProvider>
Get the inner provider for direct RPC calls
Sourcepub async fn get_block_number(&self) -> Result<u64>
pub async fn get_block_number(&self) -> Result<u64>
Get the current block number
Sourcepub async fn get_logs(&self, filter: &Filter) -> Result<(Vec<Log>, Duration)>
pub async fn get_logs(&self, filter: &Filter) -> Result<(Vec<Log>, Duration)>
Fetch logs with a filter
Sourcepub async fn get_transaction(&self, hash: B256) -> Result<Option<Transaction>>
pub async fn get_transaction(&self, hash: B256) -> Result<Option<Transaction>>
Get a transaction by hash
Sourcepub async fn get_transaction_receipt(
&self,
hash: B256,
) -> Result<Option<TransactionReceipt>>
pub async fn get_transaction_receipt( &self, hash: B256, ) -> Result<Option<TransactionReceipt>>
Get a transaction receipt by hash
Sourcepub async fn get_block_with_txs(
&self,
block_number: u64,
) -> Result<Option<Block>>
pub async fn get_block_with_txs( &self, block_number: u64, ) -> Result<Option<Block>>
Get a block by number with full transaction objects
Sourcepub async fn test_archive_support(&self) -> Result<bool>
pub async fn test_archive_support(&self) -> Result<bool>
Check if endpoint supports archive queries (test with an old block)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Endpoint
impl !RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl !UnwindSafe for Endpoint
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§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