pub struct EventFilter {
pub contract_address: Option<Address>,
pub event: Option<String>,
}Fields§
§contract_address: Option<Address>Contract address to filter events from. If None, events from all contracts will be tracked.
event: Option<String>Human-readable event signature, e.g. “Transfer(address,address,uint256)”. If None, all events from the specified contract(s) will be tracked.
Implementations§
Source§impl EventFilter
impl EventFilter
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new EventFilter.
§Examples
use alloy::primitives::Address;
use event_scanner::EventFilter;
pub async fn create_event_filter() -> EventFilter {
let contract_address = Address::ZERO;
let filter = EventFilter::new()
.with_contract_address(contract_address)
.with_event("Transfer(address,address,uint256)");
filter
}Sourcepub fn with_contract_address(self, contract_address: Address) -> Self
pub fn with_contract_address(self, contract_address: Address) -> Self
Sets the contract address to filter events from. If not set, events from all contracts will be tracked.
Sourcepub fn with_event<E: Into<String>>(self, event: E) -> Self
pub fn with_event<E: Into<String>>(self, event: E) -> Self
Sets the event signature to filter specific events. If not set, all events from the specified contract(s) will be tracked.
Trait Implementations§
Source§impl Clone for EventFilter
impl Clone for EventFilter
Source§fn clone(&self) -> EventFilter
fn clone(&self) -> EventFilter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for EventFilter
impl Default for EventFilter
Source§fn default() -> EventFilter
fn default() -> EventFilter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EventFilter
impl RefUnwindSafe for EventFilter
impl Send for EventFilter
impl Sync for EventFilter
impl Unpin for EventFilter
impl UnwindSafe for EventFilter
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