pub struct Relay {
id: Arc<AtomicU64>,
client: Client,
url: Url,
signer: Option<PrivateKeySigner>,
}
Expand description
A Flashbots relay client.
The client automatically signs every request and sets the Flashbots authorization header appropriately with the given signer.
Note: You probably do not want to use this directly, unless
you want to interact directly with the Relay. Most users should use
FlashbotsClient
instead.
Fields§
§id: Arc<AtomicU64>
§client: Client
§url: Url
§signer: Option<PrivateKeySigner>
Implementations§
Source§impl Relay
impl Relay
Sourcepub fn new(url: impl Into<Url>, signer: Option<PrivateKeySigner>) -> Self
pub fn new(url: impl Into<Url>, signer: Option<PrivateKeySigner>) -> Self
Initializes a new relay client.
Sourcepub async fn request<T: Serialize + Send + Sync, R: DeserializeOwned>(
&self,
method: &str,
params: T,
) -> Result<R, RelayError>
pub async fn request<T: Serialize + Send + Sync, R: DeserializeOwned>( &self, method: &str, params: T, ) -> Result<R, RelayError>
Sends a request with the provided method to the relay, with the parameters serialized as JSON.
pub async fn serialized_request<R: DeserializeOwned>( &self, body: String, signature: Option<String>, ) -> Result<R, RelayError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Relay
impl !RefUnwindSafe for Relay
impl Send for Relay
impl Sync for Relay
impl Unpin for Relay
impl !UnwindSafe for Relay
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 280 bytes