From 5f63afc81b62f60d13d2d344125f09166b1abb23 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 8 Aug 2019 13:22:07 +0300 Subject: [PATCH 1/6] show both eth value and token transfers --- .../templates/transaction/overview.html.eex | 16 +++++++++++++++- .../block_scout_web/views/transaction_view.ex | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index e804ec81d9..5161c1a357 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -170,11 +170,25 @@ <%= case token_transfer_type(@transaction) do %> - <% {type, transaction_with_transfers} when is_atom(type) -> %> + <% {type, %{token_transfers: token_transfers} = transaction_with_transfers} when is_list(token_transfers) -> %>
+ <% if @transaction.value.value != 0 do %> +

<%= gettext "Ether" %> <%= gettext "Value" %>

+
+

+ <%= value(@transaction) %> +

+ <%= if !empty_exchange_rate?(@exchange_rate) do %> +

+ data-usd-exchange-rate=<%= @exchange_rate.usd_value %>> +

+ <% end %> +
+ <% end %>

<%= token_type_name(type)%><%= gettext " Token Transfer" %>

<%= for transfer <- aggregate_token_transfers(transaction_with_transfers.token_transfers) do %> 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 d4b8b68f1a..f24723cc26 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 @@ -36,7 +36,7 @@ defmodule BlockScoutWeb.TransactionView do transaction_with_transfers = Repo.preload(transaction, token_transfers: :token) type = Chain.transaction_token_transfer_type(transaction) - if type, do: {type, transaction_with_transfers} + if type, do: {type, transaction_with_transfers}, else: {nil, transaction_with_transfers} end def aggregate_token_transfers(token_transfers) do @@ -62,7 +62,7 @@ defmodule BlockScoutWeb.TransactionView do case type do :erc20 -> gettext("ERC-20 ") :erc721 -> gettext("ERC-721 ") - :token_transfer -> "" + _ -> "" end end From bcb4fd9bc56dbd11ef2e66e3c5f6ded714da46fc Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 8 Aug 2019 13:25:22 +0300 Subject: [PATCH 2/6] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 14 ++++++++------ .../priv/gettext/en/LC_MESSAGES/default.po | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 95bb1f079b..88943cb5ce 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -371,7 +371,8 @@ msgstr "" #: lib/block_scout_web/templates/layout/app.html.eex:56 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_tile.html.eex:30 -#: lib/block_scout_web/templates/transaction/overview.html.eex:196 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 +#: lib/block_scout_web/templates/transaction/overview.html.eex:210 #: lib/block_scout_web/views/wei_helpers.ex:78 msgid "Ether" msgstr "" @@ -483,7 +484,7 @@ msgid "Less than" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:224 +#: lib/block_scout_web/templates/transaction/overview.html.eex:238 msgid "Limit" msgstr "" @@ -897,7 +898,7 @@ msgid "Unique Token" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:218 +#: lib/block_scout_web/templates/transaction/overview.html.eex:232 msgid "Used" msgstr "" @@ -917,7 +918,8 @@ msgid "Validations" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:196 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 +#: lib/block_scout_web/templates/transaction/overview.html.eex:210 msgid "Value" msgstr "" @@ -1492,7 +1494,7 @@ msgid "View All Transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:214 +#: lib/block_scout_web/templates/transaction/overview.html.eex:228 msgid "Gas" msgstr "" @@ -1641,7 +1643,7 @@ msgid "New Smart Contract Verification" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:178 +#: lib/block_scout_web/templates/transaction/overview.html.eex:192 msgid " Token Transfer" 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..3bb4435f39 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 @@ -371,7 +371,8 @@ msgstr "" #: lib/block_scout_web/templates/layout/app.html.eex:56 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_tile.html.eex:30 -#: lib/block_scout_web/templates/transaction/overview.html.eex:196 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 +#: lib/block_scout_web/templates/transaction/overview.html.eex:210 #: lib/block_scout_web/views/wei_helpers.ex:78 msgid "Ether" msgstr "POA" @@ -483,7 +484,7 @@ msgid "Less than" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:224 +#: lib/block_scout_web/templates/transaction/overview.html.eex:238 msgid "Limit" msgstr "" @@ -897,7 +898,7 @@ msgid "Unique Token" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:218 +#: lib/block_scout_web/templates/transaction/overview.html.eex:232 msgid "Used" msgstr "" @@ -917,7 +918,8 @@ msgid "Validations" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:196 +#: lib/block_scout_web/templates/transaction/overview.html.eex:179 +#: lib/block_scout_web/templates/transaction/overview.html.eex:210 msgid "Value" msgstr "" @@ -1493,7 +1495,7 @@ msgid "View All Transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:214 +#: lib/block_scout_web/templates/transaction/overview.html.eex:228 msgid "Gas" msgstr "" @@ -1642,7 +1644,7 @@ msgid "New Smart Contract Verification" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:178 +#: lib/block_scout_web/templates/transaction/overview.html.eex:192 msgid " Token Transfer" msgstr "" From ab74a87d21ee7d540872cb4720683231eda88581 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 8 Aug 2019 13:26:40 +0300 Subject: [PATCH 3/6] add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 213c27d218..09940ab594 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Current ### Features +- [#2529](https://github.com/poanetwork/blockscout/pull/2529) - show both eth value and token transfers on transaction overview page - [#2477](https://github.com/poanetwork/blockscout/pull/2477) - aggregate token transfers on transaction page - [#2458](https://github.com/poanetwork/blockscout/pull/2458) - Add LAST_BLOCK var to add ability indexing in the range of blocks - [#2456](https://github.com/poanetwork/blockscout/pull/2456) - fetch pending transactions for geth From 875aa08690f2d6374e11280e817557f197a82839 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 8 Aug 2019 17:13:55 +0300 Subject: [PATCH 4/6] fix rendering --- .../lib/block_scout_web/templates/transaction/overview.html.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index 5161c1a357..72c63ff612 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -175,7 +175,7 @@
- <% if @transaction.value.value != 0 do %> + <%= if @transaction.value.value != 0 do %>

<%= gettext "Ether" %> <%= gettext "Value" %>

From 0030a336c48990aac03df93579d31cdd863220f7 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 8 Aug 2019 20:06:20 +0300 Subject: [PATCH 5/6] fix ticker --- .../lib/block_scout_web/templates/transaction/overview.html.eex | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index 72c63ff612..7b6cffe454 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -195,6 +195,7 @@

<%= token_transfer_amount(transfer) %> + <%= " "%> <%= link(token_symbol(transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, transfer.token.contract_address_hash)) %>

From a2317ac18cee0e6bbcd271d8de776a6bb5913c99 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 9 Aug 2019 10:30:18 +0300 Subject: [PATCH 6/6] fix gettext --- apps/block_scout_web/priv/gettext/default.pot | 10 +++++----- .../priv/gettext/en/LC_MESSAGES/default.po | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 94873cba42..c589dcb46d 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -372,7 +372,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_tile.html.eex:30 #: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:210 +#: lib/block_scout_web/templates/transaction/overview.html.eex:211 #: lib/block_scout_web/views/wei_helpers.ex:78 msgid "Ether" msgstr "" @@ -484,7 +484,7 @@ msgid "Less than" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:238 +#: lib/block_scout_web/templates/transaction/overview.html.eex:239 msgid "Limit" msgstr "" @@ -898,7 +898,7 @@ msgid "Unique Token" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:232 +#: lib/block_scout_web/templates/transaction/overview.html.eex:233 msgid "Used" msgstr "" @@ -919,7 +919,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:210 +#: lib/block_scout_web/templates/transaction/overview.html.eex:211 msgid "Value" msgstr "" @@ -1494,7 +1494,7 @@ msgid "View All Transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:228 +#: lib/block_scout_web/templates/transaction/overview.html.eex:229 msgid "Gas" 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 3e14b036f3..79077d86c4 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 @@ -372,7 +372,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_tile.html.eex:30 #: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:210 +#: lib/block_scout_web/templates/transaction/overview.html.eex:211 #: lib/block_scout_web/views/wei_helpers.ex:78 msgid "Ether" msgstr "POA" @@ -484,7 +484,7 @@ msgid "Less than" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:238 +#: lib/block_scout_web/templates/transaction/overview.html.eex:239 msgid "Limit" msgstr "" @@ -898,7 +898,7 @@ msgid "Unique Token" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:232 +#: lib/block_scout_web/templates/transaction/overview.html.eex:233 msgid "Used" msgstr "" @@ -919,7 +919,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/overview.html.eex:179 -#: lib/block_scout_web/templates/transaction/overview.html.eex:210 +#: lib/block_scout_web/templates/transaction/overview.html.eex:211 msgid "Value" msgstr "" @@ -1495,7 +1495,7 @@ msgid "View All Transactions" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/overview.html.eex:228 +#: lib/block_scout_web/templates/transaction/overview.html.eex:229 msgid "Gas" msgstr ""