Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
chore: add convenient from impls (#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Feb 6, 2023
1 parent 56cc3e6 commit 0bb6f51
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ethers-core/src/types/trace/geth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,37 @@ pub enum GethTraceFrame {
CallTracer(CallFrame),
}

impl From<DefaultFrame> for GethTraceFrame {
fn from(value: DefaultFrame) -> Self {
GethTraceFrame::Default(value)
}
}

impl From<CallFrame> for GethTraceFrame {
fn from(value: CallFrame) -> Self {
GethTraceFrame::CallTracer(value)
}
}

#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(untagged)]
pub enum GethTrace {
Known(GethTraceFrame),
Unknown(Value),
}

impl From<GethTraceFrame> for GethTrace {
fn from(value: GethTraceFrame) -> Self {
GethTrace::Known(value)
}
}

impl From<Value> for GethTrace {
fn from(value: Value) -> Self {
GethTrace::Unknown(value)
}
}

/// Available built-in tracers
///
/// See <https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers>
Expand Down

0 comments on commit 0bb6f51

Please sign in to comment.