We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Based on: https://github.com/poanetwork/ex_abi/blob/master/lib/abi/type_decoder.ex#L140 and https://github.com/poanetwork/ex_abi/blob/master/lib/abi/function_selector.ex#L29
a function selector return types get completely ignored - so even basic function return data doesn't get parsed. For example:
selector = %ABI.FunctionSelector{ function: "getVersion", input_names: [], inputs_indexed: nil, method_id: <<13, 142, 110, 44>>, returns: [:string], type: :function, types: [] }
was parsed directly from our solidity contract abi (json):
abi_path |> File.read!() |> Jason.decode!() |> Map.fetch!("abi") |> ABI.parse_specification(include_events?: true)
data2 = method_id |> Encoding.to_hex() |> Kernel.<>(data) |> Encoding.from_hex ABI.find_and_decode([selector], data2)
where
iex(196)> method_id <<13, 142, 110, 44>> iex(197)> data "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d312e302e342b6136396337363300000000000000000000000000000000000000" iex(198)>
and returns this:
{%ABI.FunctionSelector{ function: "getVersion", input_names: [], inputs_indexed: nil, method_id: <<13, 142, 110, 44>>, returns: [:string], type: :function, types: [] }, []}
if we modify the selector to (returns and types were swaped):
selector = %ABI.FunctionSelector{ function: "getVersion", input_names: [], inputs_indexed: nil, method_id: <<13, 142, 110, 44>>, returns: [], type: :function, types: [:string], } ABI.find_and_decode([selector], data2) {%ABI.FunctionSelector{ function: "getVersion", input_names: [], inputs_indexed: nil, method_id: <<13, 142, 110, 44>>, returns: [], type: :function, types: [:string] }, ["1.0.4+a69c763"]}
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Based on:
https://github.com/poanetwork/ex_abi/blob/master/lib/abi/type_decoder.ex#L140
and
https://github.com/poanetwork/ex_abi/blob/master/lib/abi/function_selector.ex#L29
a function selector return types get completely ignored - so even basic function return data doesn't get parsed.
For example:
was parsed directly from our solidity contract abi (json):
where
and returns this:
if we modify the selector to (returns and types were swaped):
The text was updated successfully, but these errors were encountered: