pub struct EventFilter { /* private fields */ }Expand description
Type representing filters to apply when fetching events from the chain.
§Examples
use alloy::primitives::address;
use event_scanner::EventFilter;
pub async fn create_event_filter() -> EventFilter {
let contract_address = address!("0xd8dA6BF26964af9d7eed9e03e53415d37aa96045");
let filter = EventFilter::new()
.contract_address(contract_address)
.event("Transfer(address,address,uint256)");
filter
}Implementations§
Source§impl EventFilter
impl EventFilter
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new EventFilter.
Sourcepub fn contract_address(self, contract_address: impl Into<Address>) -> Self
pub fn contract_address(self, contract_address: impl Into<Address>) -> Self
Sets the contract address to filter events from. If not set, events from all contracts will be tracked.
Sourcepub fn contract_addresses(
self,
contract_addresses: impl IntoIterator<Item = impl Into<Address>>,
) -> Self
pub fn contract_addresses( self, contract_addresses: impl IntoIterator<Item = impl Into<Address>>, ) -> Self
Sets the contract address to filter events from. If not set, events from all contracts will be tracked.
Sourcepub fn event(self, event: impl Into<String>) -> Self
pub fn event(self, event: impl Into<String>) -> Self
Sets the event signature to filter specific events. If neither events nor event signature hashes are set, all events from the specified contract(s) will be tracked.
Sourcepub fn events(self, events: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn events(self, events: impl IntoIterator<Item = impl Into<String>>) -> Self
Sets the event signatures to filter specific events. If neither events nor event signature hashes are set, all events from the specified contract(s) will be tracked.
Sourcepub fn event_signature(self, event_signature: impl Into<Topic>) -> Self
pub fn event_signature(self, event_signature: impl Into<Topic>) -> Self
Sets the event signature hash to filter specific events. If neither event signature hashes nor events are set, all events from the specified contract(s) will be tracked.
Sourcepub fn event_signatures(
self,
event_signatures: impl IntoIterator<Item = impl Into<Topic>>,
) -> Self
pub fn event_signatures( self, event_signatures: impl IntoIterator<Item = impl Into<Topic>>, ) -> Self
Sets the event signature hashes to filter specific events. If neither event signature hashes nor events are 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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventFilter
impl Debug for EventFilter
Source§impl Default for EventFilter
impl Default for EventFilter
Source§fn default() -> EventFilter
fn default() -> EventFilter
Source§impl Display for EventFilter
impl Display for EventFilter
Source§impl From<&EventFilter> for Filter
impl From<&EventFilter> for Filter
Source§fn from(value: &EventFilter) -> Self
fn from(value: &EventFilter) -> Self
Source§impl From<EventFilter> for Filter
impl From<EventFilter> for Filter
Source§fn from(value: EventFilter) -> Self
fn from(value: EventFilter) -> Self
Auto Trait Implementations§
impl !Freeze for EventFilter
impl RefUnwindSafe for EventFilter
impl Send for EventFilter
impl Sync for EventFilter
impl Unpin for EventFilter
impl UnsafeUnpin 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
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>
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>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.