Add :tuple clause for do_copy_text

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

@ -5,7 +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
- [#4385](https://github.com/blockscout/blockscout/pull/4385) - Fix html template for transaction's input; Add copy text for tuples
### Chore
- [#4384](https://github.com/blockscout/blockscout/pull/4384) - Fix Elixir version in `.tool-versions`

@ -63,6 +63,17 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
hex(value)
end
defp do_copy_text({:tuple, types}, value) do
values =
value
|> Tuple.to_list()
|> Enum.with_index()
|> Enum.map(fn {val, ind} -> do_copy_text(Enum.at(types, ind), val) end)
|> Enum.intersperse(", ")
~E|(<%= values %>)|
end
defp do_copy_text(_type, value) do
to_string(value)
end

Loading…
Cancel
Save