Add API v2 response for zkEVM batch page

pull/7584/head
POA 1 year ago
parent dbc3921a97
commit eadef3c01d
  1. 18
      apps/block_scout_web/lib/block_scout_web/views/api/v2/zkevm_view.ex

@ -2,10 +2,26 @@ defmodule BlockScoutWeb.API.V2.ZkevmView do
use BlockScoutWeb, :view
def render("zkevm_batch.json", %{batch: batch}) do
sequence_tx_hash =
if not is_nil(batch.sequence_transaction) do
batch.sequence_transaction.hash
end
verify_tx_hash =
if not is_nil(batch.verify_transaction) do
batch.verify_transaction.hash
end
%{
"number" => batch.number,
"status" => batch_status(batch),
"timestamp" => batch.timestamp
"timestamp" => batch.timestamp,
"transactions" => Enum.map(batch.l2_transactions, fn tx -> tx.hash end),
"global_exit_root" => batch.global_exit_root,
"acc_input_hash" => batch.acc_input_hash,
"sequence_tx_hash" => sequence_tx_hash,
"verify_tx_hash" => verify_tx_hash,
"state_root" => batch.state_root
}
end

Loading…
Cancel
Save