diff --git a/.gitignore b/.gitignore index cb5a36b8..bba87b64 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,9 @@ npm-debug.log # Ignore docker volumes .volumes +# Ignore .env +.env + # Ignore juno files juno_files diff --git a/lib/starknet_explorer/events.ex b/lib/starknet_explorer/events.ex index 42829636..278787bf 100644 --- a/lib/starknet_explorer/events.ex +++ b/lib/starknet_explorer/events.ex @@ -204,18 +204,18 @@ defmodule StarknetExplorer.Events do Enum.flat_map_reduce(1..1000, nil, fn _, acc -> if acc == "last_page_reached" do {:halt, acc} - end - - case try_fetch_next_page(block_hash, network, acc) do - {:ok, %{"events" => events, "continuation_token" => continuation_token}} -> - {events, continuation_token} - - # when no continuation token is present, this means that we reached the end of the events. - {:ok, %{"events" => events}} -> - {events, "last_page_reached"} - - _err -> - {:halt, acc} + else + case try_fetch_next_page(block_hash, network, acc) do + {:ok, %{"events" => events, "continuation_token" => continuation_token}} -> + {events, continuation_token} + + # when no continuation token is present, this means that we reached the end of the events. + {:ok, %{"events" => events}} -> + {events, "last_page_reached"} + + _err -> + {:halt, acc} + end end end)