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> </dd>
</dl> </dl>
<%= unless @transaction.input.bytes in [<<>>, nil] do %> <%= unless value_transfer?(@transaction) do %>
<dl class="row"> <dl class="row">
<dt class="col-sm-3 text-muted"><%= gettext "Raw Input" %></dt> <dt class="col-sm-3 text-muted"><%= gettext "Raw Input" %></dt>
<dd class="col-sm-9"> <dd class="col-sm-9">
@ -141,9 +141,12 @@
</div> </div>
</div> </div>
<div class="row"> <%= unless should_decode?(@transaction) do %>
<div class="col-md-12"> <div class="row">
<%= render BlockScoutWeb.TransactionView, "_decoded_input.html", Map.put(assigns, :decoded_input_data, decoded_input_data) %> <div class="col-md-12">
<%= render BlockScoutWeb.TransactionView, "_decoded_input.html", Map.put(assigns, :decoded_input_data, decoded_input_data) %>
</div>
</div> </div>
</div> <% end %>
</section> </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_number: nil, inserted_at: time}), do: time
def block_timestamp(%Transaction{block: %Block{timestamp: 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 def confirmations(%Transaction{block: block}, named_arguments) when is_list(named_arguments) do
case block do case block do
nil -> 0 nil -> 0
@ -73,6 +79,10 @@ defmodule BlockScoutWeb.TransactionView do
Cldr.Number.to_string!(gas) Cldr.Number.to_string!(gas)
end end
def should_decode?(transaction) do
contract_creation?(transaction) || value_transfer?(transaction)
end
def decoded_input_data(transaction) do def decoded_input_data(transaction) do
Transaction.decoded_input_data(transaction) Transaction.decoded_input_data(transaction)
# {:error, :contract_not_verified} # {:error, :contract_not_verified}

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

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

Loading…
Cancel
Save