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 generics to filter, transaction, and pub_sub. #573

Merged
merged 5 commits into from
Apr 20, 2024
Merged
Changes from all commits
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
8 changes: 4 additions & 4 deletions crates/rpc-types/src/eth/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ impl FilteredParams {
/// Response of the `eth_getFilterChanges` RPC.
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
#[serde(untagged)]
pub enum FilterChanges {
pub enum FilterChanges<T = Transaction> {
/// Empty result.
#[serde(with = "empty_array")]
Empty,
Expand All @@ -858,7 +858,7 @@ pub enum FilterChanges {
/// New hashes (block or transactions).
Hashes(Vec<B256>),
/// New transactions.
Transactions(Vec<Transaction>),
Transactions(Vec<T>),
}

mod empty_array {
Expand All @@ -879,10 +879,10 @@ impl<'de> Deserialize<'de> for FilterChanges {
{
#[derive(Deserialize)]
#[serde(untagged)]
enum Changes {
enum Changes<T = Transaction> {
Hashes(Vec<B256>),
Logs(Vec<RpcLog>),
Transactions(Vec<Transaction>),
Transactions(Vec<T>),
}

let changes = Changes::deserialize(deserializer)?;
Expand Down
Loading