Skip to content

Commit

Permalink
feat(rpc): implement Default for TransactionTrace (alloy-rs#816)
Browse files Browse the repository at this point in the history
* implement default for TransactionTrace

* fix clippy
  • Loading branch information
tcoratger authored and ben186 committed Jul 27, 2024
1 parent 6870c4c commit d13cc33
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/rpc-types-trace/src/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d13cc33

Please sign in to comment.