pub struct Rpc<H> { /* private fields */ }Expand description
One chain’s JSON-RPC: a URL and the wire to it.
Implementations§
Source§impl<H: Http> Rpc<H>
impl<H: Http> Rpc<H>
Sourcepub fn new(http: H, url: impl Into<String>) -> Self
pub fn new(http: H, url: impl Into<String>) -> Self
Any node: an Arbitrum RPC, or HyperEVM through a provider.
pub fn url(&self) -> &str
pub const fn http(&self) -> &H
Sourcepub async fn run<T>(&self, query: Query<T>) -> Result<T, RpcError>
pub async fn run<T>(&self, query: Query<T>) -> Result<T, RpcError>
Posts the query once and reads the answer. Nothing is retried.
pub async fn chain_id(&self) -> Result<u64, RpcError>
pub async fn block_number(&self) -> Result<u64, RpcError>
pub async fn balance( &self, owner: Address, block: BlockTag, ) -> Result<U256, RpcError>
pub async fn transaction_count( &self, owner: Address, block: BlockTag, ) -> Result<u64, RpcError>
pub async fn gas_price(&self) -> Result<U256, RpcError>
pub async fn max_priority_fee(&self) -> Result<U256, RpcError>
pub async fn fee_history( &self, blocks: u64, newest: BlockTag, percentiles: &[u8], ) -> Result<FeeHistory, RpcError>
pub async fn estimate_gas(&self, call: &CallRequest) -> Result<u64, RpcError>
pub async fn call( &self, call: &CallRequest, block: BlockTag, ) -> Result<Vec<u8>, RpcError>
Sourcepub async fn send_raw_transaction(&self, raw: &[u8]) -> Result<B256, RpcError>
pub async fn send_raw_transaction(&self, raw: &[u8]) -> Result<B256, RpcError>
Sent once. With no answer the transaction may still have landed: look
for its receipt by crate::client::evm::tx::tx_hash before sending it again.
pub async fn receipt(&self, hash: B256) -> Result<Option<Receipt>, RpcError>
pub async fn transaction( &self, hash: B256, ) -> Result<Option<Transaction>, RpcError>
pub async fn block( &self, block: BlockTag, full: bool, ) -> Result<Option<Block>, RpcError>
pub async fn code( &self, at: Address, block: BlockTag, ) -> Result<Vec<u8>, RpcError>
pub async fn storage_at( &self, at: Address, slot: U256, block: BlockTag, ) -> Result<B256, RpcError>
pub async fn logs(&self, filter: &LogFilter) -> Result<Vec<Log>, RpcError>
pub async fn big_block_gas_price(&self) -> Result<U256, RpcError>
pub async fn using_big_blocks(&self, owner: Address) -> Result<bool, RpcError>
Trait Implementations§
Auto Trait Implementations§
impl<H> Freeze for Rpc<H>where
H: Freeze,
impl<H> RefUnwindSafe for Rpc<H>where
H: RefUnwindSafe,
impl<H> Send for Rpc<H>where
H: Send,
impl<H> Sync for Rpc<H>where
H: Sync,
impl<H> Unpin for Rpc<H>where
H: Unpin,
impl<H> UnsafeUnpin for Rpc<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for Rpc<H>where
H: UnwindSafe,
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