View Source Signet.DebugTrace.StructLog (Signet v1.3.8)

Summary

Functions

Deserializes a trace's struct-log into a struct.

Serializes a trace's struct-log into a json map.

Types

@type t() :: %Signet.DebugTrace.StructLog{
  depth: integer(),
  gas: integer(),
  gas_cost: integer(),
  op: atom(),
  pc: integer(),
  stack: [binary()]
}

Functions

@spec deserialize(map()) :: t() | no_return()

Deserializes a trace's struct-log into a struct.

Examples

iex> %{
...>   "depth" => 1,
...>   "gas" => 599978565,
...>   "gasCost" => 3,
...>   "op" => "PUSH1",
...>   "pc" => 2,
...>   "stack" => ["0x80"]
...> }
...> |> Signet.DebugTrace.StructLog.deserialize()
%Signet.DebugTrace.StructLog{
  depth: 1,
  gas: 599978565,
  gas_cost: 3,
  op: :PUSH1,
  pc: 2,
  stack: [~h[0x80]]
}
@spec serialize(t()) :: map()

Serializes a trace's struct-log into a json map.

Examples

iex> %Signet.DebugTrace.StructLog{
...>   depth: 1,
...>   gas: 599978565,
...>   gas_cost: 3,
...>   op: :PUSH1,
...>   pc: 2,
...>   stack: [~h[0x80]]
...> }
...> |> Signet.DebugTrace.StructLog.serialize()
%{
  depth: 1,
  gas: 599978565,
  gasCost: 3,
  op: "PUSH1",
  pc: 2,
  stack: ["0x80"]
}