Handle empty array type input

pull/3269/head
Victor Baranov 4 years ago
parent 31a907ff34
commit 9437a198d2
  1. 2
      CHANGELOG.md
  2. 8
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/contract.ex

@ -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

@ -91,7 +91,11 @@ defmodule EthereumJSONRPC.Contract do
convert_string_to_array(arg)
{:array, _} ->
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
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

Loading…
Cancel
Save