pub struct SwapEventFilter { /* private fields */ }Expand description
Builder for creating swap event filters.
This builder provides a fluent API for constructing filters to query swap events from Odos router contracts.
§Example
ⓘ
use odos_sdk::events::SwapEventFilter;
let filter = SwapEventFilter::new(router_address)
.from_block(18_000_000)
.to_block(18_100_000)
.sender(sender_address);Implementations§
Source§impl SwapEventFilter
impl SwapEventFilter
Sourcepub fn new(router_address: Address) -> Self
pub fn new(router_address: Address) -> Self
Creates a new swap event filter for the given router address.
Sourcepub fn from_block(self, block: u64) -> Self
pub fn from_block(self, block: u64) -> Self
Sets the starting block for the filter.
Sourcepub fn from_latest(self) -> Self
pub fn from_latest(self) -> Self
Sets the starting block to the latest block.
Sourcepub fn build_v2_filter(&self) -> Filter
pub fn build_v2_filter(&self) -> Filter
Builds the underlying Alloy filter for V2 Swap events.
Sourcepub fn build_v3_filter(&self) -> Filter
pub fn build_v3_filter(&self) -> Filter
Builds the underlying Alloy filter for V3 Swap events.
Sourcepub async fn get_v2_events<N, P>(
&self,
provider: &P,
) -> Result<Vec<SwapEvent>, TransportError>
pub async fn get_v2_events<N, P>( &self, provider: &P, ) -> Result<Vec<SwapEvent>, TransportError>
Gets V2 swap events from the provider.
Sourcepub async fn get_v3_events<N, P>(
&self,
provider: &P,
) -> Result<Vec<SwapEvent>, TransportError>
pub async fn get_v3_events<N, P>( &self, provider: &P, ) -> Result<Vec<SwapEvent>, TransportError>
Gets V3 swap events from the provider.
Trait Implementations§
Source§impl Clone for SwapEventFilter
impl Clone for SwapEventFilter
Source§fn clone(&self) -> SwapEventFilter
fn clone(&self) -> SwapEventFilter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SwapEventFilter
impl RefUnwindSafe for SwapEventFilter
impl Send for SwapEventFilter
impl Sync for SwapEventFilter
impl Unpin for SwapEventFilter
impl UnsafeUnpin for SwapEventFilter
impl UnwindSafe for SwapEventFilter
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