Skip to content

Commit b4aab26

Browse files
committed
graph: Add serde(transparent) to AnyTransactionRequest
Without this, serde wraps the inner WithOtherFields<TransactionRequest> in an extra struct layer when serializing, which would produce malformed JSON for eth_call RPC requests.
1 parent cb34319 commit b4aab26

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

graph/src/components/ethereum/network.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub struct AnyNetworkBare;
4646
/// supertraits, so we must re-implement those by delegation since Rust doesn't auto-delegate
4747
/// trait impls through `Deref`.
4848
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
49+
#[serde(transparent)]
4950
pub struct AnyTransactionRequest(WithOtherFields<TransactionRequest>);
5051

5152
impl Deref for AnyTransactionRequest {
@@ -82,6 +83,8 @@ impl From<AnyTypedTransaction> for AnyTransactionRequest {
8283

8384
impl From<AnyTransaction> for AnyTransactionRequest {
8485
fn from(value: AnyTransaction) -> Self {
86+
// Upstream only has From<AnyRpcTransaction> for WithOtherFields<TransactionRequest>,
87+
// so we wrap in WithOtherFields first to match that impl.
8588
let tx = WithOtherFields::<Transaction<AnyTxEnvelope>>::new(value);
8689
Self(AnyRpcTransaction::from(tx).into())
8790
}

0 commit comments

Comments
 (0)