pub struct RpcClient { /* private fields */ }Expand description
Thin wrapper around an Alloy provider. This will be expanded with WebSocket support and reconnection logic as we port the TypeScript client behavior.
Implementations§
Source§impl RpcClient
impl RpcClient
Sourcepub fn new(provider: RootProvider) -> Self
pub fn new(provider: RootProvider) -> Self
Create a client from an existing provider.
Sourcepub fn http(url: Url) -> Self
pub fn http(url: Url) -> Self
Build a client from an HTTP URL using the vanilla provider (no fillers).
Sourcepub async fn ws(url: Url) -> Result<Self>
pub async fn ws(url: Url) -> Result<Self>
Build a client from a WebSocket URL (requires the ws feature).
Sourcepub async fn call<Req, Resp>(&self, method: &str, params: Req) -> Result<Resp>
pub async fn call<Req, Resp>(&self, method: &str, params: Req) -> Result<Resp>
Perform a JSON-RPC call using typed params and response.
Sourcepub fn provider(&self) -> &RootProvider
pub fn provider(&self) -> &RootProvider
Access the inner provider. This is useful for lower-level calls or subscriptions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RpcClient
impl !RefUnwindSafe for RpcClient
impl Send for RpcClient
impl Sync for RpcClient
impl Unpin for RpcClient
impl UnsafeUnpin for RpcClient
impl !UnwindSafe for RpcClient
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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