Skip to content

Commit

Permalink
Make alloy_rpc_types_eth::SubscriptionResult generic over tx
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane committed Aug 3, 2024
1 parent 3bf3618 commit 0289c86
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/rpc-types-eth/src/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
/// Subscription result.
#[derive(Clone, Debug, PartialEq, Eq, Deserialize)]
#[serde(untagged)]
pub enum SubscriptionResult {
pub enum SubscriptionResult<T = Transaction> {
/// New block header.
Header(Box<RichHeader>),
/// Log
Log(Box<Log>),
/// Transaction hash
TransactionHash(B256),
/// Full Transaction
FullTransaction(Box<Transaction>),
FullTransaction(Box<T>),
/// SyncStatus
SyncState(PubSubSyncStatus),
}
Expand Down Expand Up @@ -45,7 +45,10 @@ pub struct SyncStatusMetadata {
pub highest_block: Option<u64>,
}

impl Serialize for SubscriptionResult {
impl<T> Serialize for SubscriptionResult<T>
where
T: Serialize,
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down

0 comments on commit 0289c86

Please sign in to comment.