Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add is_ utils to FilterChanges #923

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions crates/rpc-types-eth/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,26 @@ impl<T> FilterChanges<T> {
None
}
}

/// Check if the filter changes are empty.
pub fn is_empty(&self) -> bool {
matches!(self, Self::Empty)
}

/// Check if the filter changes contain logs.
pub fn is_logs(&self) -> bool {
matches!(self, Self::Logs(_))
}

/// Check if the filter changes contain hashes.
pub fn is_hashes(&self) -> bool {
matches!(self, Self::Hashes(_))
}

/// Check if the filter changes contain transactions.
pub fn is_transactions(&self) -> bool {
matches!(self, Self::Transactions(_))
}
}

mod empty_array {
Expand Down
Loading