Merge pull request #4776 from blockscout/np-add-reverted-msgs-view

Added view for unsuccessfully fetched values from read functions
pull/4777/head
Victor Baranov 3 years ago committed by GitHub
commit 2bd8c5ff34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 8
      apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex
  3. 9
      apps/block_scout_web/lib/block_scout_web/views/smart_contract_view.ex
  4. 4
      apps/block_scout_web/priv/gettext/default.pot
  5. 4
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -1,6 +1,7 @@
## Current ## Current
### Features ### Features
- [#4776](https://github.com/blockscout/blockscout/pull/4776) - Added view for unsuccessfully fetched values from read functions
- [#4761](https://github.com/blockscout/blockscout/pull/4761) - ERC-1155 support - [#4761](https://github.com/blockscout/blockscout/pull/4761) - ERC-1155 support
- [#4739](https://github.com/blockscout/blockscout/pull/4739) - Improve logs and inputs decoding - [#4739](https://github.com/blockscout/blockscout/pull/4739) - Improve logs and inputs decoding
- [#4747](https://github.com/blockscout/blockscout/pull/4747) - Advanced CSV export - [#4747](https://github.com/blockscout/blockscout/pull/4747) - Advanced CSV export

@ -105,7 +105,8 @@
<div data-function-response></div> <div data-function-response></div>
</div> </div>
<% else %> <% else %>
<%= if outputs?(function["outputs"]) do %> <%= cond do %>
<%= outputs?(function["outputs"]) -> %>
<% length = Enum.count(function["outputs"]) %> <% length = Enum.count(function["outputs"]) %>
<%= for {output, index} <- Enum.with_index(function["outputs"]) do %> <%= for {output, index} <- Enum.with_index(function["outputs"]) do %>
<%= if address?(output["type"]) do %> <%= if address?(output["type"]) do %>
@ -131,6 +132,11 @@
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>
<% error?(function["outputs"]) -> %>
<% {:error, text_error} = function["outputs"] %>
<div class="alert alert-danger py-2 word-break-all" style="margin-bottom: 0;"><%= text_error %></div>
<% true -> %>
<% nil %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

@ -26,6 +26,15 @@ defmodule BlockScoutWeb.SmartContractView do
def outputs?(outputs) when is_nil(outputs), do: false def outputs?(outputs) when is_nil(outputs), do: false
def error?(outputs) when not is_nil(outputs) do
case outputs do
{:error, _} -> true
_ -> false
end
end
def error?(outputs) when is_nil(outputs), do: false
def address?(type), do: type in ["address", "address payable"] def address?(type), do: type in ["address", "address payable"]
def int?(type), do: String.contains?(type, "int") && !String.contains?(type, "[") def int?(type), do: String.contains?(type, "int") && !String.contains?(type, "[")

@ -999,7 +999,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_token/overview.html.eex:1 #: lib/block_scout_web/templates/address_token/overview.html.eex:1
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:89 lib/block_scout_web/templates/smart_contract/_functions.html.eex:89 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:89 lib/block_scout_web/templates/smart_contract/_functions.html.eex:89
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:125 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:126
msgid "ETH" msgid "ETH"
msgstr "" msgstr ""
@ -2938,7 +2938,7 @@ msgid "Vyper contract"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:124 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:125
msgid "WEI" msgid "WEI"
msgstr "" msgstr ""

@ -999,7 +999,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address_token/overview.html.eex:1 #: lib/block_scout_web/templates/address_token/overview.html.eex:1
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:89 lib/block_scout_web/templates/smart_contract/_functions.html.eex:89 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:89 lib/block_scout_web/templates/smart_contract/_functions.html.eex:89
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:125 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:126
msgid "ETH" msgid "ETH"
msgstr "" msgstr ""
@ -2938,7 +2938,7 @@ msgid "Vyper contract"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:124 #: lib/block_scout_web/templates/smart_contract/_functions.html.eex:125
msgid "WEI" msgid "WEI"
msgstr "" msgstr ""

Loading…
Cancel
Save