fix transaction logs view

pull/2555/head
Ayrat Badykov 5 years ago
parent 7c036ccf4f
commit 23835d7dae
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 18
      apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex
  2. 2
      apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex
  3. 49
      apps/block_scout_web/priv/gettext/default.pot
  4. 49
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  5. 10
      apps/explorer/lib/explorer/chain/log.ex

@ -1,4 +1,20 @@
<div data-test="transaction_log" class="tile tile-muted">
<% decoded_result = decode(@log, @transaction) %>
<%= case decoded_result do %>
<%= {:error, :contract_not_verified, _cadidates} -> %>
<div class="alert alert-info">
<%= gettext "To see accurate decoded input data, the contract must be verified." %>
<%= case @transaction do %>
<% %{to_address: %{hash: hash}} -> %>
<%= gettext "Verify the contract " %><a href="<%= address_verify_contract_path(@conn, :new, hash)%>"><%= gettext "here" %></a>
<% _ -> %>
<%= nil %>
<% end %>
</div>
<% _ -> %>
<%= nil %>
<% end %>
<dl class="row">
<dt class="col-lg-2"> <%= gettext "Address" %> </dt>
<dd class="col-lg-10">
@ -84,7 +100,7 @@
<% end %>
</table>
</div>
<% {:error, :contract_not_verified, results} when is_list(results) and not results == [] -> %>
<% {:error, :contract_not_verified, results} -> %>
<%= for {:ok, method_id, text, mapping} <- results do %>
<dt class="col-md-2"><%= gettext "Decoded" %></dt>
<dd class="col-md-10">

@ -5,6 +5,6 @@ defmodule BlockScoutWeb.TransactionLogView do
alias Explorer.Chain.Log
def decode(log, transaction) do
Log.decode(log, transaction) |> IO.inspect()
Log.decode(log, transaction)
end
end

@ -98,7 +98,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:3
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19
#: lib/block_scout_web/views/address_view.ex:99
msgid "Address"
msgstr ""
@ -562,8 +562,8 @@ msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:68
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121
msgid "Name"
msgstr ""
@ -1132,10 +1132,10 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:16
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:28
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:89
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:44
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105
msgid "Decoded"
msgstr ""
@ -1146,7 +1146,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35
msgid "To see decoded input data, the contract must be verified."
msgstr ""
@ -1159,14 +1159,16 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38
msgid "Verify the contract "
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38
msgid "here"
msgstr ""
@ -1321,6 +1323,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6
msgid "To see accurate decoded input data, the contract must be verified."
msgstr ""
@ -1781,8 +1784,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:63
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:81
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:134
msgid "Copy Value"
msgstr ""
@ -1795,29 +1798,29 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:118
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:108
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:175
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:71
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:124
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:191
msgid "Data"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:31
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:47
msgid "Failed to decode log data."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:52
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:107
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:70
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:123
msgid "Indexed?"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:47
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:102
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118
msgid "Log Data"
msgstr ""
@ -1830,14 +1833,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:88
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:145
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:161
msgid "Topics"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:51
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122
msgid "Type"
msgstr ""

@ -98,7 +98,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:3
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19
#: lib/block_scout_web/views/address_view.ex:99
msgid "Address"
msgstr ""
@ -562,8 +562,8 @@ msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:52
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:59
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:19
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:68
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:121
msgid "Name"
msgstr ""
@ -1132,10 +1132,10 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:16
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:28
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:34
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:16
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:28
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:36
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:89
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:32
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:44
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:52
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:105
msgid "Decoded"
msgstr ""
@ -1146,7 +1146,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:19
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:19
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:35
msgid "To see decoded input data, the contract must be verified."
msgstr ""
@ -1159,14 +1159,16 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38
msgid "Verify the contract "
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:11
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:22
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:9
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:38
msgid "here"
msgstr ""
@ -1322,6 +1324,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_decoded_input.html.eex:8
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:6
msgid "To see accurate decoded input data, the contract must be verified."
msgstr ""
@ -1782,8 +1785,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:63
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:31
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:81
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:134
msgid "Copy Value"
msgstr ""
@ -1796,29 +1799,29 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:53
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:118
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:21
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:55
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:108
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:175
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:71
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:124
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:191
msgid "Data"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:31
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:31
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:47
msgid "Failed to decode log data."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:52
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:54
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:107
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:70
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:123
msgid "Indexed?"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:47
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:49
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:102
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:65
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:118
msgid "Log Data"
msgstr ""
@ -1831,14 +1834,14 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:88
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:145
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:161
msgid "Topics"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_logs/_logs.html.eex:51
#: lib/block_scout_web/templates/transaction/_decoded_input_body.html.eex:20
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:53
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:106
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:69
#: lib/block_scout_web/templates/transaction_log/_logs.html.eex:122
msgid "Type"
msgstr ""

@ -140,8 +140,14 @@ defmodule Explorer.Chain.Log do
|> Repo.all()
|> Enum.flat_map(fn contract_method ->
case find_and_decode([contract_method.abi], log, transaction) do
{:ok, _, _} = result -> [result]
_ -> []
{:ok, selector, mapping} ->
identifier = Base.encode16(selector.method_id, case: :lower)
text = function_call(selector.function, mapping)
[{:ok, identifier, text, mapping}]
_ ->
[]
end
end)

Loading…
Cancel
Save