|
|
@ -180,6 +180,42 @@ defmodule BlockScoutWeb.AddressTransactionController do |
|
|
|
|> send_chunked(200) |
|
|
|
|> send_chunked(200) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defp items_csv( |
|
|
|
|
|
|
|
conn, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
"address_id" => address_hash_string, |
|
|
|
|
|
|
|
"from_period" => from_period, |
|
|
|
|
|
|
|
"to_period" => to_period |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
csv_export_module |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
when is_binary(address_hash_string) do |
|
|
|
|
|
|
|
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), |
|
|
|
|
|
|
|
{:ok, address} <- Chain.hash_to_address(address_hash), |
|
|
|
|
|
|
|
true <- Application.get_env(:block_scout_web, :recaptcha)[:is_disabled] do |
|
|
|
|
|
|
|
address |
|
|
|
|
|
|
|
|> csv_export_module.export(from_period, to_period) |
|
|
|
|
|
|
|
|> Enum.reduce_while(put_resp_params(conn), fn chunk, conn -> |
|
|
|
|
|
|
|
case Conn.chunk(conn, chunk) do |
|
|
|
|
|
|
|
{:ok, conn} -> |
|
|
|
|
|
|
|
{:cont, conn} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{:error, :closed} -> |
|
|
|
|
|
|
|
{:halt, conn} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
:error -> |
|
|
|
|
|
|
|
unprocessable_entity(conn) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{:error, :not_found} -> |
|
|
|
|
|
|
|
not_found(conn) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{:recaptcha, false} -> |
|
|
|
|
|
|
|
not_found(conn) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp items_csv( |
|
|
|
defp items_csv( |
|
|
|
conn, |
|
|
|
conn, |
|
|
|
%{ |
|
|
|
%{ |
|
|
@ -232,6 +268,22 @@ defmodule BlockScoutWeb.AddressTransactionController do |
|
|
|
) |
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def transactions_csv(conn, %{ |
|
|
|
|
|
|
|
"address_id" => address_hash_string, |
|
|
|
|
|
|
|
"from_period" => from_period, |
|
|
|
|
|
|
|
"to_period" => to_period |
|
|
|
|
|
|
|
}) do |
|
|
|
|
|
|
|
items_csv( |
|
|
|
|
|
|
|
conn, |
|
|
|
|
|
|
|
%{ |
|
|
|
|
|
|
|
"address_id" => address_hash_string, |
|
|
|
|
|
|
|
"from_period" => from_period, |
|
|
|
|
|
|
|
"to_period" => to_period |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
AddressTransactionCsvExporter |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def transactions_csv(conn, %{ |
|
|
|
def transactions_csv(conn, %{ |
|
|
|
"address_id" => address_hash_string, |
|
|
|
"address_id" => address_hash_string, |
|
|
|
"from_period" => from_period, |
|
|
|
"from_period" => from_period, |
|
|
|