Fix html template for txs input

pull/4385/head
nikitosing 3 years ago committed by Viktor Baranov
parent ab4ab4686a
commit ebc3afeb0b
  1. 1
      CHANGELOG.md
  2. 37
      apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex

@ -5,6 +5,7 @@
### Fixes ### Fixes
- [#4388](https://github.com/blockscout/blockscout/pull/4388) - Fix internal server error on contract page for insctances without sourcify envs - [#4388](https://github.com/blockscout/blockscout/pull/4388) - Fix internal server error on contract page for insctances without sourcify envs
- [#4385](https://github.com/blockscout/blockscout/pull/4385) - Fix html template for transaction's input
### Chore ### Chore
- [#4384](https://github.com/blockscout/blockscout/pull/4384) - Fix Elixir version in `.tool-versions` - [#4384](https://github.com/blockscout/blockscout/pull/4384) - Fix Elixir version in `.tool-versions`

@ -95,20 +95,11 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
|> Tuple.to_list() |> Tuple.to_list()
|> Enum.with_index() |> Enum.with_index()
|> Enum.map(fn {value, i} -> |> Enum.map(fn {value, i} ->
type = Enum.at(types, i) do_value_html(Enum.at(types, i), value)
case type do
{:tuple, types} ->
do_value_html_from_tuple(types, value)
_ ->
res = do_value_html(type, value)
[_, {:safe, html_val}] = res
html_val
end
end) end)
"(" <> Enum.join(values_list, ",") <> ")" delimited = Enum.intersperse(values_list, ",")
~E|(<%= delimited %>)|
end end
defp do_value_html(type, value, depth) do defp do_value_html(type, value, depth) do
@ -117,28 +108,6 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
[spacing, base_value_html(type, value)] [spacing, base_value_html(type, value)]
end end
defp do_value_html_from_tuple(types, values) do
values_list =
values
|> Tuple.to_list()
|> Enum.with_index()
|> Enum.map(fn {value, i} ->
type = Enum.at(types, i)
case type do
:address ->
[_, {:safe, html_val}] = do_value_html(:address_text, value)
html_val
_ ->
[_, {:safe, html_val}] = do_value_html(type, value)
html_val
end
end)
Enum.join(values_list, ",")
end
defp base_value_html(_, {:dynamic, value}) do defp base_value_html(_, {:dynamic, value}) do
~E|<%= hex(value) %>| ~E|<%= hex(value) %>|
end end

Loading…
Cancel
Save