From 1f792e68db07c44646694c01e13245ad0fcef92a Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Mon, 11 Dec 2023 15:40:43 -0400 Subject: [PATCH] chore: add support for OtherFields in Transaction --- crates/rpc-types/src/eth/transaction/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/rpc-types/src/eth/transaction/mod.rs b/crates/rpc-types/src/eth/transaction/mod.rs index 6dfe965d83d..7ae7e404b55 100644 --- a/crates/rpc-types/src/eth/transaction/mod.rs +++ b/crates/rpc-types/src/eth/transaction/mod.rs @@ -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")] @@ -71,6 +73,9 @@ pub struct Transaction { /// EIP2718 #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub transaction_type: Option, + /// Arbitrary extra fields. + #[serde(flatten)] + pub other: OtherFields, } #[cfg(test)] @@ -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!( @@ -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!(