From 81eb64a9c411514795affeedd755e591fb5c7bc5 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 7 Aug 2019 10:48:06 +0300 Subject: [PATCH 1/6] do not aggregate NFT token transfers --- .../block_scout_web/views/transaction_view.ex | 38 +++++++++++++------ .../views/transaction_view_test.exs | 14 +++++++ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index 61a0d471b1..41c8eaf844 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -42,22 +42,36 @@ defmodule BlockScoutWeb.TransactionView do def aggregate_token_transfers(token_transfers) do token_transfers |> Enum.reduce(%{}, fn token_transfer, acc -> - new_entry = %{ - token: token_transfer.token, - amount: token_transfer.amount, - token_id: token_transfer.token_id - } - - existing_entry = Map.get(acc, token_transfer.token_contract_address, %{new_entry | amount: Decimal.new(0)}) - - Map.put(acc, token_transfer.token_contract_address, %{ - new_entry - | amount: Decimal.add(new_entry.amount, existing_entry.amount) - }) + aggregate_reducer(token_transfer, acc) end) |> Enum.map(fn {_key, value} -> value end) end + def aggregate_reducer(%{amount: amount} = token_transfer, acc) when is_nil(amount) do + new_entry = %{ + token: token_transfer.token, + amount: nil, + token_id: token_transfer.token_id + } + + Map.put(acc, token_transfer.token_contract_address, new_entry) + end + + def aggregate_reducer(token_transfer, acc) do + new_entry = %{ + token: token_transfer.token, + amount: token_transfer.amount, + token_id: token_transfer.token_id + } + + existing_entry = Map.get(acc, token_transfer.token_contract_address, %{new_entry | amount: Decimal.new(0)}) + + Map.put(acc, token_transfer.token_contract_address, %{ + new_entry + | amount: Decimal.add(new_entry.amount, existing_entry.amount) + }) + end + def token_type_name(type) do case type do :erc20 -> gettext("ERC-20 ") diff --git a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs index 8598f3826a..179ffd6d33 100644 --- a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs @@ -268,5 +268,19 @@ defmodule BlockScoutWeb.TransactionViewTest do assert Enum.count(result) == 1 assert List.first(result).amount == Decimal.new(3) end + + test "does not aggregate NFT tokens" do + transaction = + :transaction + |> insert() + |> with_block() + + token_transfer = insert(:token_transfer, transaction: transaction, amount: nil) + + result = TransactionView.aggregate_token_transfers([token_transfer, token_transfer, token_transfer]) + + assert Enum.count(result) == 1 + assert List.first(result).amount == nil + end end end From 9b93475c13f1f74f8928f72136e639fae5aca846 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 7 Aug 2019 10:49:58 +0300 Subject: [PATCH 2/6] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae8b4df2c5..0138400a00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#2456](https://github.com/poanetwork/blockscout/pull/2456) - fetch pending transactions for geth ### Fixes +- [#2515](https://github.com/poanetwork/blockscout/pull/2515) - do not aggregate NFT token transfers - [#2503](https://github.com/poanetwork/blockscout/pull/2503) - Mitigate autocompletion library influence to page loading performance - [#2502](https://github.com/poanetwork/blockscout/pull/2502) - increase reward task timeout - [#2463](https://github.com/poanetwork/blockscout/pull/2463) - dark theme fixes From a290e262160b754d12b115b2b373a955cec8392c Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 7 Aug 2019 10:52:46 +0300 Subject: [PATCH 3/6] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 36 +++++++++---------- .../priv/gettext/en/LC_MESSAGES/default.po | 36 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 95bb1f079b..b50cbe0b56 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:163 +#: lib/block_scout_web/views/transaction_view.ex:177 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -276,12 +276,12 @@ msgid "Contract Address Pending" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:240 +#: lib/block_scout_web/views/transaction_view.ex:254 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:239 +#: lib/block_scout_web/views/transaction_view.ex:253 msgid "Contract Creation" msgstr "" @@ -356,12 +356,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:167 +#: lib/block_scout_web/views/transaction_view.ex:181 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:165 +#: lib/block_scout_web/views/transaction_view.ex:179 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -466,7 +466,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:306 -#: lib/block_scout_web/views/transaction_view.ex:293 +#: lib/block_scout_web/views/transaction_view.ex:307 msgid "Internal Transactions" msgstr "" @@ -493,7 +493,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:312 -#: lib/block_scout_web/views/transaction_view.ex:294 +#: lib/block_scout_web/views/transaction_view.ex:308 msgid "Logs" msgstr "" @@ -506,8 +506,8 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:148 -#: lib/block_scout_web/views/transaction_view.ex:148 +#: lib/block_scout_web/views/transaction_view.ex:162 +#: lib/block_scout_web/views/transaction_view.ex:162 msgid "Max of" msgstr "" @@ -598,8 +598,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:58 -#: lib/block_scout_web/views/transaction_view.ex:162 -#: lib/block_scout_web/views/transaction_view.ex:196 +#: lib/block_scout_web/views/transaction_view.ex:176 +#: lib/block_scout_web/views/transaction_view.ex:210 msgid "Pending" msgstr "" @@ -686,7 +686,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:164 +#: lib/block_scout_web/views/transaction_view.ex:178 msgid "Success" msgstr "" @@ -791,7 +791,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:5 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4 -#: lib/block_scout_web/views/transaction_view.ex:238 +#: lib/block_scout_web/views/transaction_view.ex:252 msgid "Token Transfer" msgstr "" @@ -801,7 +801,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:292 +#: lib/block_scout_web/views/transaction_view.ex:306 msgid "Token Transfers" msgstr "" @@ -835,7 +835,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 -#: lib/block_scout_web/views/transaction_view.ex:241 +#: lib/block_scout_web/views/transaction_view.ex:255 msgid "Transaction" msgstr "" @@ -1499,7 +1499,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:295 +#: lib/block_scout_web/views/transaction_view.ex:309 msgid "Raw Trace" msgstr "" @@ -1707,12 +1707,12 @@ msgid "Change Network" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:63 +#: lib/block_scout_web/views/transaction_view.ex:77 msgid "ERC-20 " msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:64 +#: lib/block_scout_web/views/transaction_view.ex:78 msgid "ERC-721 " 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 6ecd22e7fa..5dd7061364 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 @@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:163 +#: lib/block_scout_web/views/transaction_view.ex:177 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -276,12 +276,12 @@ msgid "Contract Address Pending" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:240 +#: lib/block_scout_web/views/transaction_view.ex:254 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:239 +#: lib/block_scout_web/views/transaction_view.ex:253 msgid "Contract Creation" msgstr "" @@ -356,12 +356,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:167 +#: lib/block_scout_web/views/transaction_view.ex:181 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:165 +#: lib/block_scout_web/views/transaction_view.ex:179 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -466,7 +466,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:306 -#: lib/block_scout_web/views/transaction_view.ex:293 +#: lib/block_scout_web/views/transaction_view.ex:307 msgid "Internal Transactions" msgstr "" @@ -493,7 +493,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:312 -#: lib/block_scout_web/views/transaction_view.ex:294 +#: lib/block_scout_web/views/transaction_view.ex:308 msgid "Logs" msgstr "" @@ -506,8 +506,8 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:148 -#: lib/block_scout_web/views/transaction_view.ex:148 +#: lib/block_scout_web/views/transaction_view.ex:162 +#: lib/block_scout_web/views/transaction_view.ex:162 msgid "Max of" msgstr "" @@ -598,8 +598,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:58 -#: lib/block_scout_web/views/transaction_view.ex:162 -#: lib/block_scout_web/views/transaction_view.ex:196 +#: lib/block_scout_web/views/transaction_view.ex:176 +#: lib/block_scout_web/views/transaction_view.ex:210 msgid "Pending" msgstr "" @@ -686,7 +686,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:164 +#: lib/block_scout_web/views/transaction_view.ex:178 msgid "Success" msgstr "" @@ -791,7 +791,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:5 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4 -#: lib/block_scout_web/views/transaction_view.ex:238 +#: lib/block_scout_web/views/transaction_view.ex:252 msgid "Token Transfer" msgstr "" @@ -801,7 +801,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:292 +#: lib/block_scout_web/views/transaction_view.ex:306 msgid "Token Transfers" msgstr "" @@ -835,7 +835,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 -#: lib/block_scout_web/views/transaction_view.ex:241 +#: lib/block_scout_web/views/transaction_view.ex:255 msgid "Transaction" msgstr "" @@ -1500,7 +1500,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:295 +#: lib/block_scout_web/views/transaction_view.ex:309 msgid "Raw Trace" msgstr "" @@ -1708,12 +1708,12 @@ msgid "Change Network" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:63 +#: lib/block_scout_web/views/transaction_view.ex:77 msgid "ERC-20 " msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:64 +#: lib/block_scout_web/views/transaction_view.ex:78 msgid "ERC-721 " msgstr "" From 7d38bab8ad8ec0da43cdc210ed0c4ebf581e2e1b Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 7 Aug 2019 11:01:59 +0300 Subject: [PATCH 4/6] show all nft tokens --- .../block_scout_web/views/transaction_view.ex | 33 +++++++++++-------- .../views/transaction_view_test.exs | 2 +- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index 41c8eaf844..13c2d1032f 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -40,36 +40,43 @@ defmodule BlockScoutWeb.TransactionView do end def aggregate_token_transfers(token_transfers) do - token_transfers - |> Enum.reduce(%{}, fn token_transfer, acc -> - aggregate_reducer(token_transfer, acc) - end) - |> Enum.map(fn {_key, value} -> value end) + {transfers, nft_transfers} = + token_transfers + |> Enum.reduce({%{}, []}, fn token_transfer, acc -> + aggregate_reducer(token_transfer, acc) + end) + + final_transfers = Enum.map(transfers, fn {_key, value} -> value end) + + final_transfers ++ nft_transfers end - def aggregate_reducer(%{amount: amount} = token_transfer, acc) when is_nil(amount) do + defp aggregate_reducer(%{amount: amount} = token_transfer, {acc1, acc2}) when is_nil(amount) do new_entry = %{ token: token_transfer.token, amount: nil, token_id: token_transfer.token_id } - Map.put(acc, token_transfer.token_contract_address, new_entry) + {acc1, [new_entry | acc2]} end - def aggregate_reducer(token_transfer, acc) do + defp aggregate_reducer(token_transfer, {acc1, acc2}) do new_entry = %{ token: token_transfer.token, amount: token_transfer.amount, token_id: token_transfer.token_id } - existing_entry = Map.get(acc, token_transfer.token_contract_address, %{new_entry | amount: Decimal.new(0)}) + existing_entry = Map.get(acc1, token_transfer.token_contract_address, %{new_entry | amount: Decimal.new(0)}) + + new_acc1 = + Map.put(acc1, token_transfer.token_contract_address, %{ + new_entry + | amount: Decimal.add(new_entry.amount, existing_entry.amount) + }) - Map.put(acc, token_transfer.token_contract_address, %{ - new_entry - | amount: Decimal.add(new_entry.amount, existing_entry.amount) - }) + {new_acc1, acc2} end def token_type_name(type) do diff --git a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs index 179ffd6d33..69cca69f41 100644 --- a/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs @@ -279,7 +279,7 @@ defmodule BlockScoutWeb.TransactionViewTest do result = TransactionView.aggregate_token_transfers([token_transfer, token_transfer, token_transfer]) - assert Enum.count(result) == 1 + assert Enum.count(result) == 3 assert List.first(result).amount == nil end end From 10c28f84bf9e588cab19c879d0dda1166b612d73 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 7 Aug 2019 11:02:31 +0300 Subject: [PATCH 5/6] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 36 +++++++++---------- .../priv/gettext/en/LC_MESSAGES/default.po | 36 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index b50cbe0b56..34db86b3a1 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:177 +#: lib/block_scout_web/views/transaction_view.ex:184 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -276,12 +276,12 @@ msgid "Contract Address Pending" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:254 +#: lib/block_scout_web/views/transaction_view.ex:261 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:253 +#: lib/block_scout_web/views/transaction_view.ex:260 msgid "Contract Creation" msgstr "" @@ -356,12 +356,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:181 +#: lib/block_scout_web/views/transaction_view.ex:188 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:179 +#: lib/block_scout_web/views/transaction_view.ex:186 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -466,7 +466,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:306 -#: lib/block_scout_web/views/transaction_view.ex:307 +#: lib/block_scout_web/views/transaction_view.ex:314 msgid "Internal Transactions" msgstr "" @@ -493,7 +493,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:312 -#: lib/block_scout_web/views/transaction_view.ex:308 +#: lib/block_scout_web/views/transaction_view.ex:315 msgid "Logs" msgstr "" @@ -506,8 +506,8 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:162 -#: lib/block_scout_web/views/transaction_view.ex:162 +#: lib/block_scout_web/views/transaction_view.ex:169 +#: lib/block_scout_web/views/transaction_view.ex:169 msgid "Max of" msgstr "" @@ -598,8 +598,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:58 -#: lib/block_scout_web/views/transaction_view.ex:176 -#: lib/block_scout_web/views/transaction_view.ex:210 +#: lib/block_scout_web/views/transaction_view.ex:183 +#: lib/block_scout_web/views/transaction_view.ex:217 msgid "Pending" msgstr "" @@ -686,7 +686,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:178 +#: lib/block_scout_web/views/transaction_view.ex:185 msgid "Success" msgstr "" @@ -791,7 +791,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:5 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4 -#: lib/block_scout_web/views/transaction_view.ex:252 +#: lib/block_scout_web/views/transaction_view.ex:259 msgid "Token Transfer" msgstr "" @@ -801,7 +801,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:306 +#: lib/block_scout_web/views/transaction_view.ex:313 msgid "Token Transfers" msgstr "" @@ -835,7 +835,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 -#: lib/block_scout_web/views/transaction_view.ex:255 +#: lib/block_scout_web/views/transaction_view.ex:262 msgid "Transaction" msgstr "" @@ -1499,7 +1499,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:309 +#: lib/block_scout_web/views/transaction_view.ex:316 msgid "Raw Trace" msgstr "" @@ -1707,12 +1707,12 @@ msgid "Change Network" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:77 +#: lib/block_scout_web/views/transaction_view.ex:84 msgid "ERC-20 " msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:78 +#: lib/block_scout_web/views/transaction_view.ex:85 msgid "ERC-721 " 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 5dd7061364..a5956c5c04 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 @@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:177 +#: lib/block_scout_web/views/transaction_view.ex:184 msgid "(Awaiting internal transactions for status)" msgstr "" @@ -276,12 +276,12 @@ msgid "Contract Address Pending" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:254 +#: lib/block_scout_web/views/transaction_view.ex:261 msgid "Contract Call" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:253 +#: lib/block_scout_web/views/transaction_view.ex:260 msgid "Contract Creation" msgstr "" @@ -356,12 +356,12 @@ msgid "Error trying to fetch balances." msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:181 +#: lib/block_scout_web/views/transaction_view.ex:188 msgid "Error: %{reason}" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:179 +#: lib/block_scout_web/views/transaction_view.ex:186 msgid "Error: (Awaiting internal transactions for reason)" msgstr "" @@ -466,7 +466,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 #: lib/block_scout_web/views/address_view.ex:306 -#: lib/block_scout_web/views/transaction_view.ex:307 +#: lib/block_scout_web/views/transaction_view.ex:314 msgid "Internal Transactions" msgstr "" @@ -493,7 +493,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 #: lib/block_scout_web/views/address_view.ex:312 -#: lib/block_scout_web/views/transaction_view.ex:308 +#: lib/block_scout_web/views/transaction_view.ex:315 msgid "Logs" msgstr "" @@ -506,8 +506,8 @@ msgid "Market Cap" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:162 -#: lib/block_scout_web/views/transaction_view.ex:162 +#: lib/block_scout_web/views/transaction_view.ex:169 +#: lib/block_scout_web/views/transaction_view.ex:169 msgid "Max of" msgstr "" @@ -598,8 +598,8 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:58 -#: lib/block_scout_web/views/transaction_view.ex:176 -#: lib/block_scout_web/views/transaction_view.ex:210 +#: lib/block_scout_web/views/transaction_view.ex:183 +#: lib/block_scout_web/views/transaction_view.ex:217 msgid "Pending" msgstr "" @@ -686,7 +686,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8 -#: lib/block_scout_web/views/transaction_view.ex:178 +#: lib/block_scout_web/views/transaction_view.ex:185 msgid "Success" msgstr "" @@ -791,7 +791,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:5 #: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4 -#: lib/block_scout_web/views/transaction_view.ex:252 +#: lib/block_scout_web/views/transaction_view.ex:259 msgid "Token Transfer" msgstr "" @@ -801,7 +801,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/views/tokens/overview_view.ex:35 -#: lib/block_scout_web/views/transaction_view.ex:306 +#: lib/block_scout_web/views/transaction_view.ex:313 msgid "Token Transfers" msgstr "" @@ -835,7 +835,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/_logs.html.eex:3 -#: lib/block_scout_web/views/transaction_view.ex:255 +#: lib/block_scout_web/views/transaction_view.ex:262 msgid "Transaction" msgstr "" @@ -1500,7 +1500,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_tabs.html.eex:24 #: lib/block_scout_web/templates/transaction_raw_trace/index.html.eex:7 -#: lib/block_scout_web/views/transaction_view.ex:309 +#: lib/block_scout_web/views/transaction_view.ex:316 msgid "Raw Trace" msgstr "" @@ -1708,12 +1708,12 @@ msgid "Change Network" msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:77 +#: lib/block_scout_web/views/transaction_view.ex:84 msgid "ERC-20 " msgstr "" #, elixir-format -#: lib/block_scout_web/views/transaction_view.ex:78 +#: lib/block_scout_web/views/transaction_view.ex:85 msgid "ERC-721 " msgstr "" From d2c9c731bf09d03b9e9408cb89dc36aad1c09519 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 7 Aug 2019 11:46:28 +0300 Subject: [PATCH 6/6] Update transaction_view.ex --- .../lib/block_scout_web/views/transaction_view.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex index 13c2d1032f..dfbf58eb6b 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex @@ -46,7 +46,7 @@ defmodule BlockScoutWeb.TransactionView do aggregate_reducer(token_transfer, acc) end) - final_transfers = Enum.map(transfers, fn {_key, value} -> value end) + final_transfers = Map.values(transfers) final_transfers ++ nft_transfers end