From 1b009499ed68ab170cb5535104edc98c08b86eb1 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 11 Jun 2019 14:28:32 +0300 Subject: [PATCH 01/18] export token transfers to csv file --- .../address_token_transfer_csv_exporter.ex | 119 ++++++++++++++++++ apps/explorer/mix.exs | 1 + ...dress_token_transfer_csv_exporter_test.exs | 72 +++++++++++ mix.lock | 1 + 4 files changed, 193 insertions(+) create mode 100644 apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex create mode 100644 apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs diff --git a/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex b/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex new file mode 100644 index 0000000000..2292a23c22 --- /dev/null +++ b/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex @@ -0,0 +1,119 @@ +defmodule Explorer.Chain.AddressTokenTransferCsvExporter do + @moduledoc """ + Exports token transfers to a csv file. + """ + + alias Explorer.{Chain, PagingOptions} + alias Explorer.Chain.{Address, Transaction, TokenTransfer} + alias NimbleCSV.RFC4180 + + @necessity_by_association [ + necessity_by_association: %{ + [created_contract_address: :names] => :optional, + [from_address: :names] => :optional, + [to_address: :names] => :optional, + [token_transfers: :token] => :optional, + [token_transfers: :to_address] => :optional, + [token_transfers: :from_address] => :optional, + [token_transfers: :token_contract_address] => :optional, + :block => :required + } + ] + + @page_size 150 + @paging_options %PagingOptions{page_size: @page_size + 1} + + def export(address) do + address + |> fetch_all_transactions(@paging_options) + |> to_token_transfers() + |> to_csv_format(address) + |> dump_to_stream() + end + + defp fetch_all_transactions(address, paging_options, acc \\ []) do + options = Keyword.merge(@necessity_by_association, paging_options: paging_options) + + transactions = + address + |> Chain.address_to_transactions_with_rewards(options) + |> Enum.filter(fn transaction -> Enum.count(transaction.token_transfers) > 0 end) + + new_acc = transactions ++ acc + + case Enum.split(transactions, @page_size) do + {_transactions, [%Transaction{block_number: block_number, index: index}]} -> + new_paging_options = %{@paging_options | key: {block_number, index}} + fetch_all_transactions(address, new_paging_options, new_acc) + + {_, []} -> + new_acc + end + end + + defp to_token_transfers(transactions) do + transactions + |> Enum.flat_map(fn transaction -> + transaction.token_transfers + |> Enum.map(fn transfer -> %{transfer | transaction: transaction} end) + end) + end + + defp dump_to_stream(transactions) do + transactions + |> RFC4180.dump_to_stream() + end + + defp to_csv_format(token_transfers, address) do + row_names = [ + "TxHash", + "BlockNumber", + "UnixTimestamp", + "FromAddress", + "ToAddress", + "TokenContractAddress", + "Type", + "TokenSymbol", + "TokensTransferred", + "TransactionFee", + "Status", + "ErrCode" + ] + + token_transfer_lists = + token_transfers + |> Stream.map(fn token_transfer -> + [ + to_string(token_transfer.transaction_hash), + token_transfer.transaction.block_number, + token_transfer.transaction.block.timestamp, + to_string(token_transfer.from_address), + to_string(token_transfer.to_address), + to_string(token_transfer.token_contract_address), + type(token_transfer, address), + token_transfer.token.symbol, + token_transfer.amount, + fee(token_transfer.transaction), + token_transfer.transaction.status, + token_transfer.transaction.error + ] + end) + + Stream.concat([row_names], token_transfer_lists) + end + + defp type(%TokenTransfer{from_address_hash: from_address}, %Address{hash: from_address}), do: "OUT" + + defp type(%TokenTransfer{to_address_hash: to_address}, %Address{hash: to_address}), do: "IN" + + defp type(_, _), do: "" + + defp fee(transaction) do + transaction + |> Chain.fee(:wei) + |> case do + {:actual, value} -> value + {:maximum, value} -> "Max of #{value}" + end + end +end diff --git a/apps/explorer/mix.exs b/apps/explorer/mix.exs index 09257b9aee..d73e0a9920 100644 --- a/apps/explorer/mix.exs +++ b/apps/explorer/mix.exs @@ -92,6 +92,7 @@ defmodule Explorer.Mixfile do {:mock, "~> 0.3.0", only: [:test], runtime: false}, {:mox, "~> 0.4", only: [:test]}, {:poison, "~> 3.1"}, + {:nimble_csv, "~> 0.6.0"}, {:postgrex, ">= 0.0.0"}, # For compatibility with `prometheus_process_collector`, which hasn't been updated yet {:prometheus, "~> 4.0", override: true}, diff --git a/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs b/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs new file mode 100644 index 0000000000..9989290264 --- /dev/null +++ b/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs @@ -0,0 +1,72 @@ +defmodule Explorer.Chain.AddressTokenTransferCsvExporterTest do + use Explorer.DataCase + + alias Explorer.Chain.AddressTokenTransferCsvExporter + + describe "export/1" do + test "exports token transfers to csv" do + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + token_transfer = insert(:token_transfer, transaction: transaction, from_address: address) + + [result] = + address + |> AddressTokenTransferCsvExporter.export() + |> Enum.to_list() + |> Enum.drop(1) + |> Enum.map(fn [ + tx_hash, + _, + block_number, + _, + timestamp, + _, + from_address, + _, + to_address, + _, + token_contract_address, + _, + type, + _, + token_symbol, + _, + tokens_transferred, + _, + transaction_fee, + _, + status, + _, + err_code, + _ + ] -> + %{ + tx_hash: tx_hash, + block_number: block_number, + timestamp: timestamp, + from_address: from_address, + to_address: to_address, + token_contract_address: token_contract_address, + type: type, + token_symbol: token_symbol, + tokens_transferred: tokens_transferred, + transaction_fee: transaction_fee, + status: status, + err_code: err_code + } + end) + + assert result.block_number == to_string(transaction.block_number) + assert result.tx_hash == to_string(transaction.hash) + assert result.from_address == to_string(token_transfer.from_address_hash) + assert result.to_address == to_string(token_transfer.to_address_hash) + assert result.timestamp == to_string(transaction.block.timestamp) + assert result.type == "OUT" + end + end +end diff --git a/mix.lock b/mix.lock index 5bcd8cacf1..d1011c206b 100644 --- a/mix.lock +++ b/mix.lock @@ -73,6 +73,7 @@ "mock": {:hex, :mock, "0.3.2", "e98e998fd76c191c7e1a9557c8617912c53df3d4a6132f561eb762b699ef59fa", [:mix], [{:meck, "~> 0.8.8", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm"}, "mox": {:hex, :mox, "0.4.0", "7f120840f7d626184a3d65de36189ca6f37d432e5d63acd80045198e4c5f7e6e", [:mix], [], "hexpm"}, "msgpax": {:hex, :msgpax, "2.2.2", "559a07806bbe5fdd31e4597455be030bd96356f7a621ca9eed832747c83bfb67", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm"}, + "nimble_csv": {:hex, :nimble_csv, "0.6.0", "a3673f26d41f986774fe6060e309615343d3cb83a6d435754d8b1fdbd5764879", [:mix], [], "hexpm"}, "nimble_parsec": {:hex, :nimble_parsec, "0.5.0", "90e2eca3d0266e5c53f8fbe0079694740b9c91b6747f2b7e3c5d21966bba8300", [:mix], [], "hexpm"}, "optimal": {:hex, :optimal, "0.3.6", "46bbf52fbbbd238cda81e02560caa84f93a53c75620f1fe19e81e4ae7b07d1dd", [:mix], [], "hexpm"}, "parallel_stream": {:hex, :parallel_stream, "1.0.6", "b967be2b23f0f6787fab7ed681b4c45a215a81481fb62b01a5b750fa8f30f76c", [:mix], []}, From 3b29b6b04908010b3075efbba5d08ceb0cb8009a Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 11 Jun 2019 14:35:46 +0300 Subject: [PATCH 02/18] fix credo --- .../lib/explorer/chain/address_token_transfer_csv_exporter.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex b/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex index 2292a23c22..4073245383 100644 --- a/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex +++ b/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex @@ -4,7 +4,7 @@ defmodule Explorer.Chain.AddressTokenTransferCsvExporter do """ alias Explorer.{Chain, PagingOptions} - alias Explorer.Chain.{Address, Transaction, TokenTransfer} + alias Explorer.Chain.{Address, TokenTransfer, Transaction} alias NimbleCSV.RFC4180 @necessity_by_association [ From e5f92472543e3dcd72202cddd7426fa94c4ee163 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 11 Jun 2019 14:48:49 +0300 Subject: [PATCH 03/18] fix test --- .../chain/address_token_transfer_csv_exporter_test.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs b/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs index 9989290264..24bd9d7f04 100644 --- a/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs +++ b/apps/explorer/test/explorer/chain/address_token_transfer_csv_exporter_test.exs @@ -63,8 +63,8 @@ defmodule Explorer.Chain.AddressTokenTransferCsvExporterTest do assert result.block_number == to_string(transaction.block_number) assert result.tx_hash == to_string(transaction.hash) - assert result.from_address == to_string(token_transfer.from_address_hash) - assert result.to_address == to_string(token_transfer.to_address_hash) + assert result.from_address == token_transfer.from_address_hash |> to_string() |> String.downcase() + assert result.to_address == token_transfer.to_address_hash |> to_string() |> String.downcase() assert result.timestamp == to_string(transaction.block.timestamp) assert result.type == "OUT" end From 5f77a6a879e143a5fe3369d56cb317fd07229633 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 11 Jun 2019 14:57:51 +0300 Subject: [PATCH 04/18] add token transfers csv endpoint --- .../address_transaction_controller.ex | 21 +++++++++++++++++++ .../lib/block_scout_web/router.ex | 2 ++ .../address_transaction_controller_test.exs | 18 ++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex index da22b8c042..808d470dde 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex @@ -10,6 +10,7 @@ defmodule BlockScoutWeb.AddressTransactionController do alias BlockScoutWeb.TransactionView alias Explorer.{Chain, Market} + alias Explorer.Chain.AddressTokenTransferCsvExporter alias Explorer.ExchangeRates.Token alias Indexer.Fetcher.CoinBalanceOnDemand alias Phoenix.View @@ -106,4 +107,24 @@ defmodule BlockScoutWeb.AddressTransactionController do not_found(conn) end end + + def token_transfers_csv(conn, %{"address_id" => address_hash_string}) do + with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), + {:ok, address} <- Chain.hash_to_address(address_hash) do + address + |> AddressTokenTransferCsvExporter.export() + |> Enum.into( + conn + |> put_resp_content_type("application/csv") + |> put_resp_header("content-disposition", "attachment; filename=transactions.csv") + |> send_chunked(200) + ) + else + :error -> + unprocessable_entity(conn) + + {:error, :not_found} -> + not_found(conn) + end + end end diff --git a/apps/block_scout_web/lib/block_scout_web/router.ex b/apps/block_scout_web/lib/block_scout_web/router.ex index 786c77cdff..b1a4ecc8d2 100644 --- a/apps/block_scout_web/lib/block_scout_web/router.ex +++ b/apps/block_scout_web/lib/block_scout_web/router.ex @@ -244,6 +244,8 @@ defmodule BlockScoutWeb.Router do get("/token_autocomplete", ChainController, :token_autocomplete) + get("/token_transfers_csv", AddressTransactionController, :token_transfers_csv) + get("/chain_blocks", ChainController, :chain_blocks, as: :chain_blocks) get("/api_docs", APIDocsController, :index) diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs index 028387501a..1f94a7b8ea 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs @@ -132,4 +132,22 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do end) end end + + describe "GET token_transfers_csv/2" do + test "exports token transfers to csv", %{conn: conn} do + address = insert(:address) + + transaction = + :transaction + |> insert(from_address: address) + |> with_block() + + insert(:token_transfer, transaction: transaction, from_address: address) + insert(:token_transfer, transaction: transaction, to_address: address) + + conn = get(conn, "/token_transfers_csv", %{"address_id" => to_string(address.hash)}) + + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + end + end end From 2e986c3aff97fa46b7ad93737c965e687d55b01f Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 11 Jun 2019 15:28:20 +0300 Subject: [PATCH 05/18] add download button --- .../controllers/address_transaction_controller.ex | 2 +- .../block_scout_web/templates/address_token/index.html.eex | 1 + .../explorer/chain/address_token_transfer_csv_exporter.ex | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex index 808d470dde..193d03f9c5 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex @@ -116,7 +116,7 @@ defmodule BlockScoutWeb.AddressTransactionController do |> Enum.into( conn |> put_resp_content_type("application/csv") - |> put_resp_header("content-disposition", "attachment; filename=transactions.csv") + |> put_resp_header("content-disposition", "attachment; filename=token_transfers.csv") |> send_chunked(200) ) else diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex index 43457d3bc1..fa9dc12bd7 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex @@ -5,6 +5,7 @@
<%= render BlockScoutWeb.AddressView, "_tabs.html", assigns %>
+ to_string(@address.hash)}) %>><%= gettext("Download all token transfers as csv") %>

<%= gettext "Tokens" %>

<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> diff --git a/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex b/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex index 4073245383..96bd56afef 100644 --- a/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex +++ b/apps/explorer/lib/explorer/chain/address_token_transfer_csv_exporter.ex @@ -87,9 +87,9 @@ defmodule Explorer.Chain.AddressTokenTransferCsvExporter do to_string(token_transfer.transaction_hash), token_transfer.transaction.block_number, token_transfer.transaction.block.timestamp, - to_string(token_transfer.from_address), - to_string(token_transfer.to_address), - to_string(token_transfer.token_contract_address), + token_transfer.from_address |> to_string() |> String.downcase(), + token_transfer.to_address |> to_string() |> String.downcase(), + token_transfer.token_contract_address |> to_string() |> String.downcase(), type(token_transfer, address), token_transfer.token.symbol, token_transfer.amount, From 06906b2f20cc1fbab81990260bfb63a275c99560 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 11 Jun 2019 15:34:49 +0300 Subject: [PATCH 06/18] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 11 ++++++++--- .../priv/gettext/en/LC_MESSAGES/default.po | 13 +++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index e9763e2287..f71be7b3dd 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -732,7 +732,7 @@ msgid "There are no token transfers for this address." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token/index.html.eex:18 +#: lib/block_scout_web/templates/address_token/index.html.eex:19 msgid "There are no tokens for this address." msgstr "" @@ -810,7 +810,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:8 -#: lib/block_scout_web/templates/address_token/index.html.eex:8 +#: lib/block_scout_web/templates/address_token/index.html.eex:9 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 #: lib/block_scout_web/views/address_view.ex:304 msgid "Tokens" @@ -1207,7 +1207,7 @@ msgstr "" #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 #: lib/block_scout_web/templates/address_logs/index.html.eex:21 -#: lib/block_scout_web/templates/address_token/index.html.eex:13 +#: lib/block_scout_web/templates/address_token/index.html.eex:14 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20 #: lib/block_scout_web/templates/address_transaction/index.html.eex:57 #: lib/block_scout_web/templates/address_validation/index.html.eex:22 @@ -1697,3 +1697,8 @@ msgstr "" #: lib/block_scout_web/templates/transaction/overview.html.eex:178 msgid " Token Transfer" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_token/index.html.eex:8 +msgid "Download all token transfers as csv" +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 654a848278..6d0d199372 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -732,7 +732,7 @@ msgid "There are no token transfers for this address." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token/index.html.eex:18 +#: lib/block_scout_web/templates/address_token/index.html.eex:19 msgid "There are no tokens for this address." msgstr "" @@ -810,7 +810,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:8 -#: lib/block_scout_web/templates/address_token/index.html.eex:8 +#: lib/block_scout_web/templates/address_token/index.html.eex:9 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 #: lib/block_scout_web/views/address_view.ex:304 msgid "Tokens" @@ -1207,7 +1207,7 @@ msgstr "" #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 #: lib/block_scout_web/templates/address_logs/index.html.eex:21 -#: lib/block_scout_web/templates/address_token/index.html.eex:13 +#: lib/block_scout_web/templates/address_token/index.html.eex:14 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20 #: lib/block_scout_web/templates/address_transaction/index.html.eex:57 #: lib/block_scout_web/templates/address_validation/index.html.eex:22 @@ -1693,7 +1693,12 @@ msgstr "" msgid "New Smart Contract Verification" msgstr "" -#, elixir-format, fuzzy +#, elixir-format #: lib/block_scout_web/templates/transaction/overview.html.eex:178 msgid " Token Transfer" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_token/index.html.eex:8 +msgid "Download all token transfers as csv" +msgstr "" From 5f9caa80636a35af989f05f95c316fec14c4e433 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 25 Jun 2019 16:49:11 +0300 Subject: [PATCH 07/18] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 57 +++++++++++++- .../priv/gettext/en/LC_MESSAGES/default.po | 77 ++++++++++++++++--- 2 files changed, 122 insertions(+), 12 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index a62c9c0844..a566768750 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1697,4 +1697,59 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/overview.html.eex:178 msgid " Token Transfer" -msgstr "" \ No newline at end of file +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:14 +msgid " is recommended." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15 +msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_token/index.html.eex:8 +msgid "Download all token transfers as csv" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 +msgid "ETH RPC API Documentation" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_topnav.html.eex:78 +msgid "Eth RPC" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:11 +msgid "However, in general, the" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:27 +msgid "There is no decompilded contracts for this address." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:7 +msgid "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:10 +msgid "This is useful to allow sending requests to blockscout without having to change anything about the request." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:12 +msgid "custom RPC" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 +msgid "here." +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 5e193fdeeb..f114a87464 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -105,7 +105,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/index.html.eex:4 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:59 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:60 msgid "Addresses" msgstr "" @@ -210,8 +210,8 @@ msgstr "" #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/overview.html.eex:144 #: lib/block_scout_web/templates/address/overview.html.eex:152 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:114 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:115 msgid "Close" msgstr "" @@ -626,8 +626,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/overview.html.eex:33 #: lib/block_scout_web/templates/address/overview.html.eex:143 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:35 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:105 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 msgid "QR Code" msgstr "" @@ -684,7 +684,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/overview.html.eex:34 -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:37 msgid "Show QR Code" msgstr "" @@ -834,7 +834,7 @@ msgid "Total Difficulty" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:75 msgid "Total Supply" msgstr "" @@ -881,7 +881,7 @@ msgid "Transactions sent" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:60 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:61 msgid "Transfers" msgstr "" @@ -943,7 +943,7 @@ msgid "Verify & publish" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:54 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:55 msgid "View Contract" msgstr "" @@ -1048,7 +1048,7 @@ msgid "Self-Destruct" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:62 +#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:63 msgid "Decimals" msgstr "" @@ -1697,4 +1697,59 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/overview.html.eex:178 msgid " Token Transfer" -msgstr "" \ No newline at end of file +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:14 +msgid " is recommended." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:15 +msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_token/index.html.eex:8 +msgid "Download all token transfers as csv" +msgstr "" + +#, elixir-format, fuzzy +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 +msgid "ETH RPC API Documentation" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/layout/_topnav.html.eex:78 +msgid "Eth RPC" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:11 +msgid "However, in general, the" +msgstr "" + +#, elixir-format, fuzzy +#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:27 +msgid "There is no decompilded contracts for this address." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:7 +msgid "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:10 +msgid "This is useful to allow sending requests to blockscout without having to change anything about the request." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:12 +msgid "custom RPC" +msgstr "" + +#, elixir-format, fuzzy +#: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 +msgid "here." +msgstr "" From c9dca5a319c97e2e9961867e89a1d1e1c01451b4 Mon Sep 17 00:00:00 2001 From: maxgrapps Date: Tue, 25 Jun 2019 17:18:25 +0300 Subject: [PATCH 08/18] added styles for 'download csv' button --- .../assets/css/components/_transaction.scss | 36 +++++++++++++++++++ .../templates/address_token/index.html.eex | 15 ++++++-- apps/block_scout_web/priv/gettext/default.pot | 10 +++--- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/apps/block_scout_web/assets/css/components/_transaction.scss b/apps/block_scout_web/assets/css/components/_transaction.scss index 5214b0b301..81bf95b9ee 100644 --- a/apps/block_scout_web/assets/css/components/_transaction.scss +++ b/apps/block_scout_web/assets/css/components/_transaction.scss @@ -4,3 +4,39 @@ line-height: 1.2; margin: 0 0 12px; } + +.transaction-bottom-panel { + display: flex; + flex-direction: column; + @media (min-width: 768px) { + flex-direction: row; + justify-content: space-between; + align-items: flex-end; + } +} + +.download-all-transactions { + text-align: center; + color: #a3a9b5; + font-size: 13px; + margin-top: 10px; + @media (min-width: 768px) { + margin-top: 30px; + } + .download-all-transactions-link { + text-decoration: none; + svg { + position: relative; + margin-left: 2px; + top: -3px; + path { + fill: $primary; + } + } + &:hover { + span { + text-decoration: underline; + } + } + } +} \ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex index fa9dc12bd7..ed5ffe2c0d 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex @@ -5,7 +5,6 @@
<%= render BlockScoutWeb.AddressView, "_tabs.html", assigns %>
- to_string(@address.hash)}) %>><%= gettext("Download all token transfers as csv") %>

<%= gettext "Tokens" %>

<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> @@ -21,8 +20,18 @@
- - <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + +
+ + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index f71be7b3dd..77f10d1581 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -732,7 +732,7 @@ msgid "There are no token transfers for this address." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token/index.html.eex:19 +#: lib/block_scout_web/templates/address_token/index.html.eex:18 msgid "There are no tokens for this address." msgstr "" @@ -810,7 +810,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:8 -#: lib/block_scout_web/templates/address_token/index.html.eex:9 +#: lib/block_scout_web/templates/address_token/index.html.eex:8 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 #: lib/block_scout_web/views/address_view.ex:304 msgid "Tokens" @@ -1207,7 +1207,7 @@ msgstr "" #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 #: lib/block_scout_web/templates/address_logs/index.html.eex:21 -#: lib/block_scout_web/templates/address_token/index.html.eex:14 +#: lib/block_scout_web/templates/address_token/index.html.eex:13 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20 #: lib/block_scout_web/templates/address_transaction/index.html.eex:57 #: lib/block_scout_web/templates/address_validation/index.html.eex:22 @@ -1699,6 +1699,6 @@ msgid " Token Transfer" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token/index.html.eex:8 -msgid "Download all token transfers as csv" +#: lib/block_scout_web/templates/address_token/index.html.eex:27 +msgid "CSV" msgstr "" From 89260ab9f3c4ce178df2631640c6fa0cc6ceb618 Mon Sep 17 00:00:00 2001 From: maxgrapps <50101080+maxgrapps@users.noreply.github.com> Date: Tue, 25 Jun 2019 17:20:28 +0300 Subject: [PATCH 09/18] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf08d79d76..7f6a2ebb65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [#2075](https://github.com/poanetwork/blockscout/pull/2075) - add blocks cache ### Fixes +- [#2242](https://github.com/poanetwork/blockscout/pull/2242) - added styles for 'download csv' button - [#2142](https://github.com/poanetwork/blockscout/pull/2142) - Removed posdao theme and logo, added 'page not found' image for goerli - [#2138](https://github.com/poanetwork/blockscout/pull/2138) - badge colors issue, api titles issue - [#2129](https://github.com/poanetwork/blockscout/pull/2129) - Fix for width of explorer elements From 073c52f8295ba4b660a6e49e56028358e019f54c Mon Sep 17 00:00:00 2001 From: maxgrapps Date: Wed, 26 Jun 2019 10:32:48 +0300 Subject: [PATCH 10/18] gettext fix --- .../lib/block_scout_web/templates/address_token/index.html.eex | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex index ed5ffe2c0d..4e78daee2f 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex @@ -32,6 +32,7 @@
<%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + From 3b06941b60396225783089764ff7f9bc3ee06e48 Mon Sep 17 00:00:00 2001 From: maxgrapps Date: Wed, 26 Jun 2019 10:46:10 +0300 Subject: [PATCH 11/18] new pot generated --- .../templates/address_token/index.html.eex | 5 ++--- apps/block_scout_web/priv/gettext/default.pot | 12 +++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex index 4e78daee2f..4b180fa761 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex @@ -23,8 +23,7 @@ - + diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 2821aa97b4..a0c6482690 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1700,8 +1700,6 @@ msgid " Token Transfer" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token/index.html.eex:27 -msgid "CSV" #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:14 msgid " is recommended." msgstr "" @@ -1711,11 +1709,6 @@ msgstr "" msgid "Anything not in this list is not supported. Click on the method to be taken to the documentation for that method, and check the notes section for any potential differences." msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_token/index.html.eex:8 -msgid "Download all token transfers as csv" -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:4 msgid "ETH RPC API Documentation" @@ -1755,3 +1748,8 @@ msgstr "" #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:9 msgid "here." msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/address_token/index.html.eex:26 +msgid "CSV" +msgstr "" From 9e1b6b3752ff0bcaf6cf86be6356caba8ead2356 Mon Sep 17 00:00:00 2001 From: maxgrapps Date: Thu, 27 Jun 2019 10:46:22 +0300 Subject: [PATCH 12/18] 'download csv' button added to different tabs --- .../address_internal_transaction/index.html.eex | 13 +++++++++++-- .../templates/address_transaction/index.html.eex | 13 +++++++++++-- .../templates/tokens/transfer/index.html.eex | 13 +++++++++++-- apps/block_scout_web/priv/gettext/default.pot | 3 +++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex index 3bc2e7fe9b..b3d92333a7 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_internal_transaction/index.html.eex @@ -67,8 +67,17 @@
- - <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + +
+ + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_transaction/index.html.eex index 11b4de110c..0dff8dbb20 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_transaction/index.html.eex @@ -64,8 +64,17 @@
- - <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + +
+ + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex index 980cc4b05a..8e12926fb9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex @@ -27,8 +27,17 @@
- - <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + +
+ + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> +
diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index a0c6482690..1ce79f9565 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1750,6 +1750,9 @@ msgid "here." msgstr "" #, elixir-format +#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73 #: lib/block_scout_web/templates/address_token/index.html.eex:26 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:70 +#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:33 msgid "CSV" msgstr "" From 9f82ea43f53a7f1b8ffc79149a2446667ea64811 Mon Sep 17 00:00:00 2001 From: maxgrapps <50101080+maxgrapps@users.noreply.github.com> Date: Thu, 27 Jun 2019 10:49:33 +0300 Subject: [PATCH 13/18] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c65d4c942..fdb24d1081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - [#2146](https://github.com/poanetwork/blockscout/pull/2146) - feat: add eth_getLogs rpc endpoint ### Fixes +- [#2257](https://github.com/poanetwork/blockscout/pull/2257) - 'download csv' button added to different tabs - [#2242](https://github.com/poanetwork/blockscout/pull/2242) - added styles for 'download csv' button - [#2238](https://github.com/poanetwork/blockscout/pull/2238) - header content alignment issue, hide navbar on outside click - [#2229](https://github.com/poanetwork/blockscout/pull/2229) - gap issue between qr and copy button in token transfers, top cards width and height issue From ffd966dd76219e239e978ba1d8fae1170daec1fa Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 27 Jun 2019 14:57:02 +0300 Subject: [PATCH 14/18] hide csv button --- apps/block_scout_web/assets/js/lib/async_listing_load.js | 8 ++++++++ .../templates/address_token/index.html.eex | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/assets/js/lib/async_listing_load.js b/apps/block_scout_web/assets/js/lib/async_listing_load.js index 3a3eb2fd6c..8610d901f6 100644 --- a/apps/block_scout_web/assets/js/lib/async_listing_load.js +++ b/apps/block_scout_web/assets/js/lib/async_listing_load.js @@ -219,6 +219,14 @@ export const elements = { $el.hide() } + }, + '[csv-download]': { + render ($el, state) { + if (state.emptyResponse) { + return $el.hide() + } + return $el.show() + } } } diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex index 4b180fa761..840d9cc1da 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_token/index.html.eex @@ -20,9 +20,9 @@
- +
- diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex index 8e12926fb9..66038da607 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex @@ -28,16 +28,16 @@
-
+ <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> -
+
From 8df146b4e621d999b308f0206287b0eb807d7d82 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 27 Jun 2019 17:34:50 +0300 Subject: [PATCH 16/18] Remove duplicate record from internalization files --- apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po | 5 ----- 1 file changed, 5 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 0cc1ee30e2..ee5b704cba 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -1719,11 +1719,6 @@ msgstr "" msgid "There is no decompilded contracts for this address." msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_decompiled_contract/index.html.eex:27 -msgid "There is no decompilded contracts for this address." -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/api_docs/eth_rpc.html.eex:7 msgid "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " From de58a6f7e70a8f36b0c7cc7ab1281945d3d1a197 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 27 Jun 2019 17:45:20 +0300 Subject: [PATCH 17/18] Fix gettext and format tests --- apps/block_scout_web/priv/gettext/default.pot | 7 +------ .../controllers/address_transaction_controller_test.exs | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 700328ec74..660be028e5 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1742,16 +1742,11 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73 #: lib/block_scout_web/templates/address_token/index.html.eex:26 -#: lib/block_scout_web/templates/address_transaction/index.html.eex:70 +#: lib/block_scout_web/templates/address_transaction/index.html.eex:72 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:33 msgid "CSV" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_transaction/index.html.eex:74 -msgid "CSV" -msgstr "" - #, elixir-format #: lib/block_scout_web/views/transaction_view.ex:44 msgid "ERC-20 " diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs index 5469ab6cc7..a29d6b9be6 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs @@ -147,6 +147,10 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do conn = get(conn, "/token_transfers_csv", %{"address_id" => to_string(address.hash)}) + assert conn.resp_body |> String.split("\n") |> Enum.count() == 4 + end + end + describe "GET transactions_csv/2" do test "download csv file with transactions", %{conn: conn} do address = insert(:address) From 9a301038cb848d2b890e93027106b9efb140d754 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Thu, 27 Jun 2019 17:51:33 +0300 Subject: [PATCH 18/18] credo test fix --- .../controllers/address_transaction_controller.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex index 8d144199c6..51503fd7c1 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex @@ -10,8 +10,7 @@ defmodule BlockScoutWeb.AddressTransactionController do alias BlockScoutWeb.TransactionView alias Explorer.{Chain, Market} - alias Explorer.Chain.AddressTokenTransferCsvExporter - alias Explorer.Chain.AddressTransactionCsvExporter + alias Explorer.Chain.{AddressTokenTransferCsvExporter, AddressTransactionCsvExporter} alias Explorer.ExchangeRates.Token alias Indexer.Fetcher.CoinBalanceOnDemand alias Phoenix.View