Extend zkevm batch info in API

pull/7584/head
POA 1 year ago
parent 397df46528
commit a7d39c8113
  1. 3
      apps/block_scout_web/lib/block_scout_web/controllers/api/v2/zkevm_controller.ex
  2. 9
      apps/block_scout_web/lib/block_scout_web/views/api/v2/zkevm_view.ex

@ -19,7 +19,8 @@ defmodule BlockScoutWeb.API.V2.ZkevmController do
} }
@batches_necessity_by_association %{ @batches_necessity_by_association %{
:sequence_transaction => :optional :sequence_transaction => :optional,
:verify_transaction => :optional
} }
@spec batch(Plug.Conn.t(), map()) :: Plug.Conn.t() @spec batch(Plug.Conn.t(), map()) :: Plug.Conn.t()

@ -66,11 +66,18 @@ defmodule BlockScoutWeb.API.V2.ZkevmView do
batch.sequence_transaction.hash batch.sequence_transaction.hash
end end
verify_tx_hash =
if not is_nil(batch.verify_transaction) do
batch.verify_transaction.hash
end
%{ %{
"number" => batch.number, "number" => batch.number,
"status" => batch_status(batch),
"timestamp" => batch.timestamp, "timestamp" => batch.timestamp,
"tx_count" => batch.l2_transactions_count, "tx_count" => batch.l2_transactions_count,
"sequence_tx_hash" => sequence_tx_hash "sequence_tx_hash" => sequence_tx_hash,
"verify_tx_hash" => verify_tx_hash
} }
end) end)
end end

Loading…
Cancel
Save