From 80f1b6665d7394e0740eadd52c1108047f5d50b2 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 15 Aug 2019 15:58:01 +0300 Subject: [PATCH] add log decoding candidates to frontend --- .../templates/transaction_log/_logs.html.eex | 56 ++++++++++++++++++- .../views/transaction_log_view.ex | 2 +- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex index c63502669b..f55d52b6aa 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_log/_logs.html.eex @@ -83,7 +83,61 @@ <% end %> - + + <% {:error, :contract_not_verified, results} when is_list(results) and not results == [] -> %> + <%= for {:ok, method_id, text, mapping} <- results do %> +
<%= gettext "Decoded" %>
+
+ + + + + + + + + +
Method Id0x<%= method_id %>
Call<%= text %>
+
+ " class="table thead-light table-bordered"> + + + + + + + + <%= for {name, type, indexed?, value} <- mapping do %> + + + + + + + + <% end %> +
<%= gettext "Name" %><%= gettext "Type" %><%= gettext "Indexed?" %><%= gettext "Data" %>
+ <%= case BlockScoutWeb.ABIEncodedValueView.copy_text(type, value) do %> + <% :error -> %> + <%= nil %> + <% copy_text -> %> + + + + + + <% end %> + <%= name %><%= type %><%= indexed? %> +
<%= BlockScoutWeb.ABIEncodedValueView.value_html(type, value) %>
+
+
+ <% end %> <% _ -> %> <%= nil %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex index 50d406433c..16378418fb 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/transaction_log_view.ex @@ -5,6 +5,6 @@ defmodule BlockScoutWeb.TransactionLogView do alias Explorer.Chain.Log def decode(log, transaction) do - Log.decode(log, transaction) + Log.decode(log, transaction) |> IO.inspect end end