Merge branch 'master' into ab-first-page-navigation

pull/2519/head
Victor Baranov 5 years ago committed by GitHub
commit 344f2fec13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 5
      apps/block_scout_web/assets/css/theme/_dark-theme.scss
  3. 24
      apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex
  4. 31
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  5. 2
      apps/block_scout_web/mix.exs
  6. 36
      apps/block_scout_web/priv/gettext/default.pot
  7. 36
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  8. 14
      apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs
  9. 4
      mix.lock

@ -7,6 +7,9 @@
### Fixes
- [#2519](https://github.com/poanetwork/blockscout/pull/2519) - enable `First` page button in pagination
- [#2515](https://github.com/poanetwork/blockscout/pull/2515) - do not aggregate NFT token transfers
- [#2512](https://github.com/poanetwork/blockscout/pull/2512) - alert link fix
- [#2508](https://github.com/poanetwork/blockscout/pull/2508) - logs view columns fix
- [#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
@ -16,6 +19,7 @@
- [#2425](https://github.com/poanetwork/blockscout/pull/2425) - Force to show address view for checksummed address even if it is not in DB
### Chore
- [#2516](https://github.com/poanetwork/blockscout/pull/2516) - update absinthe plug from fork
- [#2473](https://github.com/poanetwork/blockscout/pull/2473) - get rid of cldr warnings
- [#2402](https://github.com/poanetwork/blockscout/pull/2402) - bump otp version to 22.0
- [#2492](https://github.com/poanetwork/blockscout/pull/2492) - hide decoded row if event is not decoded

@ -680,4 +680,9 @@ $labels-dark: #8a8dba; // header nav, labels
color: #3f436b !important;
border-right-color: #3f436b !important;
}
// alert link
.alert-link {
color: $dark-secondary;
}
}

@ -1,7 +1,7 @@
<div data-test="transaction_log" class="tile tile-muted">
<dl class="row">
<dt class="col-md-1"> <%= gettext "Address" %> </dt>
<dd class="col-md-11">
<dt class="col-lg-2"> <%= gettext "Address" %> </dt>
<dd class="col-lg-10">
<h3 class="">
<%= link(
@log.address,
@ -13,8 +13,8 @@
</dd>
<%= case decode(@log, @transaction) do %>
<% {:error, :contract_not_verified} -> %>
<dt class="col-md-1"><%= gettext "Decoded" %></dt>
<dd class="col-md-11">
<dt class="col-lg-2"><%= gettext "Decoded" %></dt>
<dd class="col-lg-10">
<div class="alert alert-info">
<%= gettext "To see decoded input data, the contract must be verified." %>
<%= case @transaction do %>
@ -25,16 +25,16 @@
<% end %>
</div>
<% {:error, :could_not_decode} -> %>
<dt class="col-md-1"><%= gettext "Decoded" %></dt>
<dd class="col-md-11">
<dt class="col-lg-2"><%= gettext "Decoded" %></dt>
<dd class="col-lg-10">
<div class="alert alert-danger">
<%= gettext "Failed to decode log data." %>
</div>
<% {:error, :no_matching_function} -> %>
<%= nil %>
<% {:ok, method_id, text, mapping} -> %>
<dt class="col-md-1"><%= gettext "Decoded" %></dt>
<dd class="col-md-11">
<dt class="col-lg-2"><%= gettext "Decoded" %></dt>
<dd class="col-lg-10">
<table summary="Transaction Info" class="table thead-light table-bordered transaction-input-table">
<tr>
<td>Method Id</td>
@ -88,8 +88,8 @@
<%= nil %>
<% end %>
<dt class="col-md-1"><%= gettext "Topics" %></dt>
<dd class="col-md-11">
<dt class="col-lg-2"><%= gettext "Topics" %></dt>
<dd class="col-lg-10">
<div class="raw-transaction-log-topics">
<%= unless is_nil(@log.first_topic) do %>
<div class="text-dark">
@ -117,10 +117,10 @@
<% end %>
</div>
</dd>
<dt class="col-md-1">
<dt class="col-lg-2">
<%= gettext "Data" %>
</dt>
<dd class="col-md-11">
<dd class="col-lg-10">
<%= unless is_nil(@log.data) do %>
<div class="text-dark raw-transaction-log-data">
<%= @log.data %>

@ -40,22 +40,43 @@ defmodule BlockScoutWeb.TransactionView do
end
def aggregate_token_transfers(token_transfers) do
{transfers, nft_transfers} =
token_transfers
|> Enum.reduce(%{}, fn token_transfer, acc ->
|> Enum.reduce({%{}, []}, fn token_transfer, acc ->
aggregate_reducer(token_transfer, acc)
end)
final_transfers = Map.values(transfers)
final_transfers ++ nft_transfers
end
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
}
{acc1, [new_entry | acc2]}
end
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)})
Map.put(acc, token_transfer.token_contract_address, %{
new_acc1 =
Map.put(acc1, token_transfer.token_contract_address, %{
new_entry
| amount: Decimal.add(new_entry.amount, existing_entry.amount)
})
end)
|> Enum.map(fn {_key, value} -> value end)
{new_acc1, acc2}
end
def token_type_name(type) do

@ -64,7 +64,7 @@ defmodule BlockScoutWeb.Mixfile do
# Integrates Absinthe subscriptions with Phoenix
{:absinthe_phoenix, git: "https://github.com/ayrat555/absinthe_phoenix.git", branch: "master"},
# Plug support for Absinthe
{:absinthe_plug, git: "https://github.com/ayrat555/absinthe_plug.git", branch: "ab-allow-to-set-default-query"},
{:absinthe_plug, git: "https://github.com/ayrat555/absinthe_plug.git", branch: "ab-enable-default-query"},
# Absinthe support for the Relay framework
{:absinthe_relay, "~> 1.4"},
{:bypass, "~> 1.0", only: :test},

@ -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: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:240
#: lib/block_scout_web/views/transaction_view.ex:261
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:239
#: 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:167
#: lib/block_scout_web/views/transaction_view.ex:188
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:165
#: 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:293
#: 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:294
#: 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:148
#: lib/block_scout_web/views/transaction_view.ex:148
#: 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:162
#: lib/block_scout_web/views/transaction_view.ex:196
#: 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:164
#: 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:238
#: 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:292
#: 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:241
#: 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:295
#: 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:63
#: lib/block_scout_web/views/transaction_view.ex:84
msgid "ERC-20 "
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:64
#: lib/block_scout_web/views/transaction_view.ex:85
msgid "ERC-721 "
msgstr ""

@ -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: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:240
#: lib/block_scout_web/views/transaction_view.ex:261
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:239
#: 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:167
#: lib/block_scout_web/views/transaction_view.ex:188
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:165
#: 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:293
#: 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:294
#: 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:148
#: lib/block_scout_web/views/transaction_view.ex:148
#: 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:162
#: lib/block_scout_web/views/transaction_view.ex:196
#: 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:164
#: 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:238
#: 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:292
#: 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:241
#: 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:295
#: 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:63
#: lib/block_scout_web/views/transaction_view.ex:84
msgid "ERC-20 "
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:64
#: lib/block_scout_web/views/transaction_view.ex:85
msgid "ERC-721 "
msgstr ""

@ -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) == 3
assert List.first(result).amount == nil
end
end
end

@ -2,8 +2,8 @@
"abi": {:hex, :abi, "0.1.12", "87ae04cb09e2308db7b3c350584dc3934de0e308f6a056ba82be5756b081a1ca", [:mix], [{:exth_crypto, "~> 0.1.4", [hex: :exth_crypto, repo: "hexpm", optional: false]}], "hexpm"},
"abnf2": {:hex, :abnf2, "0.1.2", "6f8792b8ac3288dba5fc889c2bceae9fe78f74e1a7b36bea9726ffaa9d7bef95", [:mix], []},
"absinthe": {:hex, :absinthe, "1.4.14", "fef224a6aac63d6eaafbc0cb96040a8abcd572275b9b4db69d46329acdcae7c7", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
"absinthe_phoenix": {:git, "https://github.com/ayrat555/absinthe_phoenix.git", "4104c7213c328c3698b52710d49cd6d85449305c", [branch: "master"]},
"absinthe_plug": {:git, "https://github.com/ayrat555/absinthe_plug.git", "e74da0a6e004fe4126885b5f5f60a3e72abd70bb", [branch: "ab-allow-to-set-default-query"]},
"absinthe_phoenix": {:git, "https://github.com/ayrat555/absinthe_phoenix.git", "0f5127844a9e4e1c5fecb1fcee225894a2af6336", [branch: "master"]},
"absinthe_plug": {:git, "https://github.com/ayrat555/absinthe_plug.git", "cbe1c170e11e60b3b0146b925a1ce6ec562840ce", [branch: "ab-enable-default-query"]},
"absinthe_relay": {:hex, :absinthe_relay, "1.4.6", "ec0e2288994b388556247cf9601245abec785cdf206d6e844f2992d29de21624", [:mix], [{:absinthe, "~> 1.4.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:ecto, "~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
"accept": {:hex, :accept, "0.3.3", "548ebb6fb2e8b0d170e75bb6123aea6ceecb0189bb1231eeadf52eac08384a97", [:rebar3], [], "hexpm"},
"artificery": {:hex, :artificery, "0.2.6", "f602909757263f7897130cbd006b0e40514a541b148d366ad65b89236b93497a", [:mix], [], "hexpm"},

Loading…
Cancel
Save