Struct ethcontract::contract::AllEventsBuilder

source ·
pub struct AllEventsBuilder<T: Transport, E: ParseLog> {
    pub filter: LogFilterBuilder<T>,
    pub deployment_information: Option<DeploymentInformation>,
    /* private fields */
}
Expand description

A builder for creating a filtered stream for any contract event.

Fields§

§filter: LogFilterBuilder<T>

The underlying log filter for these contract events.

§deployment_information: Option<DeploymentInformation>

The contract deployment transaction hash. Specifying this can increase the performance of the paginated events query.

Note that if the contract was created from an existing deployment that includes the transaction hash, then this property will be automatically set.

Implementations§

source§

impl<T: Transport, E: ParseLog> AllEventsBuilder<T, E>

source

pub fn new( web3: Web3<T>, address: Address, deployment_information: Option<DeploymentInformation> ) -> Self

Creates a new all events builder from a web3 provider and and address.

source

pub fn from_block(self, block: BlockNumber) -> Self

Sets the starting block from which to stream logs for.

If left unset defaults to the latest block.

source

pub fn to_block(self, block: BlockNumber) -> Self

Sets the last block from which to stream logs for.

If left unset defaults to the streaming until the end of days.

source

pub fn block_hash(self, hash: H256) -> Self

Sets block_hash. The field block_hash and the pair from_block and to_block are mutually exclusive.

source

pub fn topic0(self, topic: Topic<H256>) -> Self

Adds a filter for the first indexed topic.

For regular events, this corresponds to the event signature. For anonymous events, this is the first indexed property.

source

pub fn topic1(self, topic: Topic<H256>) -> Self

Adds a filter for the second indexed topic.

source

pub fn topic2(self, topic: Topic<H256>) -> Self

Adds a filter for the third indexed topic.

source

pub fn topic3(self, topic: Topic<H256>) -> Self

Adds a filter for the third indexed topic.

source

pub fn limit(self, value: usize) -> Self

Limit the number of events that can be retrieved by this filter.

Note that this parameter is non-standard.

source

pub fn block_page_size(self, value: u64) -> Self

The page size in blocks to use when doing a paginated query on past events.

source

pub fn poll_interval(self, value: Duration) -> Self

The polling interval. This is used as the interval between consecutive eth_getLogs calls to get log updates.

source

pub async fn query(self) -> Result<Vec<Event<E>>, ExecutionError>

Returns a future that resolves into a collection of events matching the event builder’s parameters.

source

pub async fn query_paginated( self ) -> Result<impl Stream<Item = Result<Event<E>, ExecutionError>>, ExecutionError>

Returns a future that resolves into a collection of events matching the event builder’s parameters. This method is similar to query with the notable difference that the logs are fetched in pages by querying smaller block ranges specified by block_page_size instead of using a single query.

Note that if the block range is inconsistent (for example from block is after the to block, or querying until the earliest block), then the query will be forwarded to the node as is.

source

pub fn stream( self ) -> impl Stream<Item = Result<StreamEvent<E>, ExecutionError>>

Creates an event stream from the current event builder.

Trait Implementations§

source§

impl<T: Debug + Transport, E: Debug + ParseLog> Debug for AllEventsBuilder<T, E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for AllEventsBuilder<T, E>
where T: Freeze,

§

impl<T, E> RefUnwindSafe for AllEventsBuilder<T, E>

§

impl<T, E> Send for AllEventsBuilder<T, E>
where T: Send,

§

impl<T, E> Sync for AllEventsBuilder<T, E>
where T: Sync,

§

impl<T, E> Unpin for AllEventsBuilder<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for AllEventsBuilder<T, E>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more