Skip to content

Commit

Permalink
Make alloy_rpc_types_eth::SubscriptionResult generic over tx (#1123)
Browse files Browse the repository at this point in the history
Make alloy_rpc_types_eth::SubscriptionResult generic over tx
  • Loading branch information
emhane authored Aug 5, 2024
1 parent 3bf3618 commit d370271
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 d370271

Please sign in to comment.