Merge pull request #2529 from poanetwork/ab-show-token-transfers-with-eth-value

show both eth value and token transfers
pull/2532/head
Victor Baranov 5 years ago committed by GitHub
commit 994ac77837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 17
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  3. 4
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  4. 14
      apps/block_scout_web/priv/gettext/default.pot
  5. 14
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -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
- [#2376](https://github.com/poanetwork/blockscout/pull/2376) - Split API and WebApp routes
- [#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

@ -170,17 +170,32 @@
</div>
<%= 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) -> %>
<div class="col-md-12 col-lg-4 d-flex flex-column flex-md-row flex-lg-column pl-0">
<!-- Value -->
<div class="card card-background-1 flex-grow-1">
<div class="card-body card-body-flex-column-space-between">
<%= if @transaction.value.value != 0 do %>
<h2 class="card-title balance-card-title"><%= gettext "Ether" %> <%= gettext "Value" %></h2>
<div class="text-right">
<h3 class="address-balance-text">
<%= value(@transaction) %>
</h3>
<%= if !empty_exchange_rate?(@exchange_rate) do %>
<p class="address-current-balance"
data-wei-value=<%= @transaction.value.value %>
data-usd-exchange-rate=<%= @exchange_rate.usd_value %>>
</p>
<% end %>
</div>
<% end %>
<h2 class="card-title balance-card-title"><%= token_type_name(type)%><%= gettext " Token Transfer" %></h2>
<div class="text-right">
<%= for transfer <- aggregate_token_transfers(transaction_with_transfers.token_transfers) do %>
<h3 class="address-balance-text">
<%= token_transfer_amount(transfer) %>
<%= " "%>
<%= link(token_symbol(transfer.token), to: token_path(BlockScoutWeb.Endpoint, :show, transfer.token.contract_address_hash)) %>
</h3>

@ -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
@ -83,7 +83,7 @@ defmodule BlockScoutWeb.TransactionView do
case type do
:erc20 -> gettext("ERC-20 ")
:erc721 -> gettext("ERC-721 ")
:token_transfer -> ""
_ -> ""
end
end

@ -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:211
#: 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:239
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:233
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:211
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:229
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 ""

@ -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:211
#: 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:239
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:233
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:211
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:229
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 ""

Loading…
Cancel
Save