View Source Signet.Trace.Action (Signet v1.0.0-echo6)

Summary

Functions

Deserializes a trace sub-action into a struct.

Types

@type t() :: %Signet.Trace.Action{
  call_type: String.t() | nil,
  from: <<_::160>>,
  gas: integer(),
  init: binary() | nil,
  input: binary(),
  to: <<_::160>> | nil,
  value: integer()
}

Functions

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

Deserializes a trace sub-action into a struct.

Examples

iex> use Signet.Hex
iex> %{
...>   "callType" => "call",
...>   "from" => "0x83806d539d4ea1c140489a06660319c9a303f874",
...>   "gas" => "0x1a1f8",
...>   "input" => "0x",
...>   "to" => "0x1c39ba39e4735cb65978d4db400ddd70a72dc750",
...>   "value" => "0x7a16c911b4d00000"
...> }
...> |> Signet.Trace.Action.deserialize()
%Signet.Trace.Action{
  call_type: "call",
  from: ~h[0x83806d539d4ea1c140489a06660319c9a303f874],
  gas: 0x01a1f8,
  input: <<>>,
  to: ~h[0x1c39ba39e4735cb65978d4db400ddd70a72dc750],
  value: 0x7a16c911b4d00000,
}

iex> use Signet.Hex
iex> %{
...>   "callType" => "call",
...>   "from" => "0x0000000000000000000000000000000000000000",
...>   "gas" => "0x1dcd0f58",
...>   "input" =>
...>     "0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000",
...>   "to" => "0x13172ee393713fba9925a9a752341ebd31e8d9a7",
...>   "value" => "0x0"
...> }
...> |> Signet.Trace.Action.deserialize()
%Signet.Trace.Action{
  call_type: "call",
  from: ~h[0x0000000000000000000000000000000000000000],
  gas: 0x1dcd0f58,
  input: ~h[0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000],
  to: ~h[0x13172ee393713fba9925a9a752341ebd31e8d9a7],
  value: 0x0,
}