From e8473cb0afc682ea184388a977f45c999f917c7f Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:17:19 +0200 Subject: [PATCH] feat(rpc): implement `Default` for `TransactionTrace` (#816) * implement default for TransactionTrace * fix clippy --- crates/rpc-types-trace/src/parity.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/rpc-types-trace/src/parity.rs b/crates/rpc-types-trace/src/parity.rs index ac9a7f63af8..48a8f9eede8 100644 --- a/crates/rpc-types-trace/src/parity.rs +++ b/crates/rpc-types-trace/src/parity.rs @@ -172,6 +172,12 @@ pub enum Action { Reward(RewardAction), } +impl Default for Action { + fn default() -> Self { + Self::Call(CallAction::default()) + } +} + impl Action { /// Returns true if this is a call action pub const fn is_call(&self) -> bool { @@ -240,7 +246,7 @@ pub enum CallType { } /// Represents a certain [CallType] of a _call_ or message transaction. -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(rename_all = "camelCase")] pub struct CallAction { /// Address of the sending account. @@ -358,7 +364,7 @@ impl TraceOutput { } /// A parity style trace of a transaction. -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(rename_all = "camelCase")] pub struct TransactionTrace { /// Represents what kind of trace this is