diff --git a/crates/rpc/rpc-types/src/eth/filter.rs b/crates/rpc/rpc-types/src/eth/filter.rs index 370395f73..710f53cae 100644 --- a/crates/rpc/rpc-types/src/eth/filter.rs +++ b/crates/rpc/rpc-types/src/eth/filter.rs @@ -393,18 +393,26 @@ impl Filter { #[must_use] pub fn event(self, event_name: &str) -> Self { let hash = keccak256(event_name.as_bytes()); - self.topic0(hash) + self.event_signature(hash) } - /// Hashes all event signatures and sets them as array to topic0 + /// Hashes all event signatures and sets them as array to event_signature(topic0) #[must_use] pub fn events(self, events: impl IntoIterator>) -> Self { let events = events.into_iter().map(|e| keccak256(e.as_ref())).collect::>(); - self.topic0(events) + self.event_signature(events) + } + + /// Sets event_signature(topic0) (the event name for non-anonymous events) + #[must_use] + pub fn event_signature>(mut self, topic: T) -> Self { + self.topics[0] = topic.into(); + self } /// Sets topic0 (the event name for non-anonymous events) #[must_use] + #[deprecated(note = "use `event_signature` instead")] pub fn topic0>(mut self, topic: T) -> Self { self.topics[0] = topic.into(); self diff --git a/examples/db-access.rs b/examples/db-access.rs index 289f895be..faed7fc1d 100644 --- a/examples/db-access.rs +++ b/examples/db-access.rs @@ -182,9 +182,9 @@ fn receipts_provider_example