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

Make alloy_rpc_types_eth::SubscriptionResult generic over tx #1123

Merged
merged 1 commit into from
Aug 5, 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
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