pub struct Api<H: Handler> {
pub handler: H,
}Expand description
Wraps any Handler and provides convenience methods for common Ethereum
RPC calls.
Fields§
§handler: HThe underlying handler.
Implementations§
Source§impl<H: Handler> Api<H>
impl<H: Handler> Api<H>
Sourcepub async fn call(&self, method: &str, params: Vec<Value>) -> Result<Value>
pub async fn call(&self, method: &str, params: Vec<Value>) -> Result<Value>
Performs a JSON-RPC call with positional arguments.
Sourcepub async fn call_as<T: DeserializeOwned>(
&self,
method: &str,
params: Vec<Value>,
) -> Result<T>
pub async fn call_as<T: DeserializeOwned>( &self, method: &str, params: Vec<Value>, ) -> Result<T>
Performs a call and deserializes the result into T via serde.
Sourcepub async fn block_number(&self) -> Result<u64>
pub async fn block_number(&self) -> Result<u64>
Returns the current block number from the connected node.
Auto Trait Implementations§
impl<H> Freeze for Api<H>where
H: Freeze,
impl<H> RefUnwindSafe for Api<H>where
H: RefUnwindSafe,
impl<H> Send for Api<H>
impl<H> Sync for Api<H>
impl<H> Unpin for Api<H>where
H: Unpin,
impl<H> UnsafeUnpin for Api<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for Api<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