Skip to content

Commit

Permalink
chore: add support for OtherFields in Transaction (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir authored Dec 11, 2023
1 parent 46bf17a commit ead6a46
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/rpc-types/src/eth/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ mod typed;

pub use tx_type::*;

use crate::other::OtherFields;

/// Transaction object used in RPC
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -71,6 +73,9 @@ pub struct Transaction {
/// EIP2718
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub transaction_type: Option<U64>,
/// Arbitrary extra fields.
#[serde(flatten)]
pub other: OtherFields,
}

#[cfg(test)]
Expand Down Expand Up @@ -105,6 +110,7 @@ mod tests {
max_fee_per_gas: Some(U128::from(21)),
max_priority_fee_per_gas: Some(U128::from(22)),
max_fee_per_blob_gas: None,
other: Default::default(),
};
let serialized = serde_json::to_string(&transaction).unwrap();
assert_eq!(
Expand Down Expand Up @@ -142,6 +148,7 @@ mod tests {
max_fee_per_gas: Some(U128::from(21)),
max_priority_fee_per_gas: Some(U128::from(22)),
max_fee_per_blob_gas: None,
other: Default::default(),
};
let serialized = serde_json::to_string(&transaction).unwrap();
assert_eq!(
Expand Down

0 comments on commit ead6a46

Please sign in to comment.