From ebc3afeb0b345595b5c4a116a97200446762c054 Mon Sep 17 00:00:00 2001 From: nikitosing Date: Thu, 15 Jul 2021 22:45:50 +0700 Subject: [PATCH] Fix html template for txs input --- CHANGELOG.md | 1 + .../views/abi_encoded_value_view.ex | 37 ++----------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c851c61275..70e81bd711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - [#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 - [#4384](https://github.com/blockscout/blockscout/pull/4384) - Fix Elixir version in `.tool-versions` diff --git a/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex b/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex index c801e7c9ea..87f9d59586 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex @@ -95,20 +95,11 @@ defmodule BlockScoutWeb.ABIEncodedValueView do |> Tuple.to_list() |> Enum.with_index() |> Enum.map(fn {value, i} -> - type = Enum.at(types, i) - - 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 + do_value_html(Enum.at(types, i), value) end) - "(" <> Enum.join(values_list, ",") <> ")" + delimited = Enum.intersperse(values_list, ",") + ~E|(<%= delimited %>)| end defp do_value_html(type, value, depth) do @@ -117,28 +108,6 @@ defmodule BlockScoutWeb.ABIEncodedValueView do [spacing, base_value_html(type, value)] 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 ~E|<%= hex(value) %>| end