Fix for zkEVM websocket connection

pull/7584/head
POA 1 year ago
parent bd7a7837a3
commit 158e64f332
  1. 3
      apps/block_scout_web/lib/block_scout_web/channels/zkevm_confirmed_batch_channel.ex
  2. 11
      apps/block_scout_web/lib/block_scout_web/views/api/v2/zkevm_view.ex

@ -9,9 +9,6 @@ defmodule BlockScoutWeb.ZkevmConfirmedBatchChannel do
intercept(["new_zkevm_confirmed_batch"])
def join("zkevm_batches:new_zkevm_confirmed_batch", _params, socket) do
require Logger
Logger.warn("zkevm_batches:new_zkevm_confirmed_batch")
{:ok, %{}, socket}
end

@ -7,20 +7,25 @@ defmodule BlockScoutWeb.API.V2.ZkevmView do
@spec render(binary(), map()) :: map() | non_neg_integer()
def render("zkevm_batch.json", %{batch: batch}) do
sequence_tx_hash =
if not is_nil(batch.sequence_transaction) do
if Map.has_key?(batch, :sequence_transaction) and not is_nil(batch.sequence_transaction) do
batch.sequence_transaction.hash
end
verify_tx_hash =
if not is_nil(batch.verify_transaction) do
if Map.has_key?(batch, :verify_transaction) and not is_nil(batch.verify_transaction) do
batch.verify_transaction.hash
end
l2_transactions =
if Map.has_key?(batch, :l2_transactions) do
Enum.map(batch.l2_transactions, fn tx -> tx.hash end)
end
%{
"number" => batch.number,
"status" => batch_status(batch),
"timestamp" => batch.timestamp,
"transactions" => Enum.map(batch.l2_transactions, fn tx -> tx.hash end),
"transactions" => l2_transactions,
"global_exit_root" => batch.global_exit_root,
"acc_input_hash" => batch.acc_input_hash,
"sequence_tx_hash" => sequence_tx_hash,

Loading…
Cancel
Save