diff --git a/CHANGELOG.md b/CHANGELOG.md index 89e0ba8279..bffe08040a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Fixes - [#3264](https://github.com/poanetwork/blockscout/pull/3264) - Fix encoding of address output if function input exists -- [#3259](https://github.com/poanetwork/blockscout/pull/3259) - Contract interaction: array input type parsing fix +- [#3259](https://github.com/poanetwork/blockscout/pull/3259), [#3269](https://github.com/poanetwork/blockscout/pull/3269) - Contract interaction: array input type parsing fix - [#3257](https://github.com/poanetwork/blockscout/pull/3257) - Contracts read/write: method_id instead function_name as a key - [#3256](https://github.com/poanetwork/blockscout/pull/3256) - Fix for invisible validator address at block page and wrong alert text color at xDai diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex index 8bd0401eea..470c4813bf 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex @@ -91,7 +91,11 @@ defmodule EthereumJSONRPC.Contract do convert_string_to_array(arg) {:array, _} -> - String.split(arg, ",") + if arg && arg !== "" do + String.split(arg, ",") + else + [] + end _ -> arg @@ -100,12 +104,16 @@ defmodule EthereumJSONRPC.Contract do end defp convert_string_to_array(arg) do - arg - |> String.split(",") - |> Enum.map(fn el -> - {int, _} = Integer.parse(el) - int - end) + if arg && arg !== "" do + arg + |> String.split(",") + |> Enum.map(fn el -> + {int, _} = Integer.parse(el) + int + end) + else + [] + end end defp define_function(functions, target_method_id) do