chore: hide decoded input for transfers/contract creations

pull/1119/head
zachdaniel 6 years ago
parent 8f05ada7f4
commit 705d7fb2a8
  1. 13
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  2. 10
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  3. 28
      apps/block_scout_web/priv/gettext/default.pot
  4. 28
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -75,7 +75,7 @@
</dd>
</dl>
<%= unless @transaction.input.bytes in [<<>>, nil] do %>
<%= unless value_transfer?(@transaction) do %>
<dl class="row">
<dt class="col-sm-3 text-muted"><%= gettext "Raw Input" %></dt>
<dd class="col-sm-9">
@ -141,9 +141,12 @@
</div>
</div>
<div class="row">
<div class="col-md-12">
<%= render BlockScoutWeb.TransactionView, "_decoded_input.html", Map.put(assigns, :decoded_input_data, decoded_input_data) %>
<%= unless should_decode?(@transaction) do %>
<div class="row">
<div class="col-md-12">
<%= render BlockScoutWeb.TransactionView, "_decoded_input.html", Map.put(assigns, :decoded_input_data, decoded_input_data) %>
</div>
</div>
</div>
<% end %>
</section>

@ -20,6 +20,12 @@ defmodule BlockScoutWeb.TransactionView do
def block_timestamp(%Transaction{block_number: nil, inserted_at: time}), do: time
def block_timestamp(%Transaction{block: %Block{timestamp: time}}), do: time
def value_transfer?(%Transaction{input: %{bytes: bytes}}) when bytes in [<<>>, nil] do
true
end
def value_transfer?(_), do: false
def confirmations(%Transaction{block: block}, named_arguments) when is_list(named_arguments) do
case block do
nil -> 0
@ -73,6 +79,10 @@ defmodule BlockScoutWeb.TransactionView do
Cldr.Number.to_string!(gas)
end
def should_decode?(transaction) do
contract_creation?(transaction) || value_transfer?(transaction)
end
def decoded_input_data(transaction) do
Transaction.decoded_input_data(transaction)
# {:error, :contract_not_verified}

@ -56,7 +56,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:58
#: lib/block_scout_web/views/transaction_view.ex:63
msgid "(Awaiting internal transactions for status)"
msgstr ""
@ -283,12 +283,12 @@ msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:133
#: lib/block_scout_web/views/transaction_view.ex:142
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:132
#: lib/block_scout_web/views/transaction_view.ex:141
msgid "Contract Creation"
msgstr ""
@ -394,12 +394,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:62
#: lib/block_scout_web/views/transaction_view.ex:67
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:60
#: lib/block_scout_web/views/transaction_view.ex:65
msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
@ -509,7 +509,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:43
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:213
#: lib/block_scout_web/views/transaction_view.ex:182
#: lib/block_scout_web/views/transaction_view.ex:191
msgid "Internal Transactions"
msgstr ""
@ -535,7 +535,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:21
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:48
#: lib/block_scout_web/templates/transaction_log/index.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:183
#: lib/block_scout_web/views/transaction_view.ex:192
msgid "Logs"
msgstr ""
@ -547,7 +547,7 @@ msgid "Market Cap"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:49
#: lib/block_scout_web/views/transaction_view.ex:54
msgid "Max of"
msgstr ""
@ -684,8 +684,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:55
#: lib/block_scout_web/views/transaction_view.ex:57
#: lib/block_scout_web/views/transaction_view.ex:89
#: lib/block_scout_web/views/transaction_view.ex:62
#: lib/block_scout_web/views/transaction_view.ex:98
msgid "Pending"
msgstr ""
@ -790,7 +790,7 @@ msgid "Showing 250 addresses of"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:59
#: lib/block_scout_web/views/transaction_view.ex:64
msgid "Success"
msgstr ""
@ -901,7 +901,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/views/transaction_view.ex:131
#: lib/block_scout_web/views/transaction_view.ex:140
msgid "Token Transfer"
msgstr ""
@ -913,7 +913,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
#: lib/block_scout_web/views/tokens/overview_view.ex:35
#: lib/block_scout_web/views/transaction_view.ex:181
#: lib/block_scout_web/views/transaction_view.ex:190
msgid "Token Transfers"
msgstr ""
@ -955,7 +955,7 @@ msgid "Total transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:134
#: lib/block_scout_web/views/transaction_view.ex:143
msgid "Transaction"
msgstr ""

@ -56,7 +56,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:58
#: lib/block_scout_web/views/transaction_view.ex:63
msgid "(Awaiting internal transactions for status)"
msgstr ""
@ -283,12 +283,12 @@ msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:133
#: lib/block_scout_web/views/transaction_view.ex:142
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:132
#: lib/block_scout_web/views/transaction_view.ex:141
msgid "Contract Creation"
msgstr ""
@ -394,12 +394,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:62
#: lib/block_scout_web/views/transaction_view.ex:67
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:60
#: lib/block_scout_web/views/transaction_view.ex:65
msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
@ -509,7 +509,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:43
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:213
#: lib/block_scout_web/views/transaction_view.ex:182
#: lib/block_scout_web/views/transaction_view.ex:191
msgid "Internal Transactions"
msgstr ""
@ -535,7 +535,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:21
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:48
#: lib/block_scout_web/templates/transaction_log/index.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:183
#: lib/block_scout_web/views/transaction_view.ex:192
msgid "Logs"
msgstr ""
@ -547,7 +547,7 @@ msgid "Market Cap"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:49
#: lib/block_scout_web/views/transaction_view.ex:54
msgid "Max of"
msgstr ""
@ -684,8 +684,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:55
#: lib/block_scout_web/views/transaction_view.ex:57
#: lib/block_scout_web/views/transaction_view.ex:89
#: lib/block_scout_web/views/transaction_view.ex:62
#: lib/block_scout_web/views/transaction_view.ex:98
msgid "Pending"
msgstr ""
@ -790,7 +790,7 @@ msgid "Showing 250 addresses of"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:59
#: lib/block_scout_web/views/transaction_view.ex:64
msgid "Success"
msgstr ""
@ -901,7 +901,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/views/transaction_view.ex:131
#: lib/block_scout_web/views/transaction_view.ex:140
msgid "Token Transfer"
msgstr ""
@ -913,7 +913,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
#: lib/block_scout_web/views/tokens/overview_view.ex:35
#: lib/block_scout_web/views/transaction_view.ex:181
#: lib/block_scout_web/views/transaction_view.ex:190
msgid "Token Transfers"
msgstr ""
@ -955,7 +955,7 @@ msgid "Total transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:134
#: lib/block_scout_web/views/transaction_view.ex:143
msgid "Transaction"
msgstr ""

Loading…
Cancel
Save