mirror of https://github.com/poanetwork/ex_abi.git
Refactor docstrings and comments
This commit is contained in:
parent
27299ad667
commit
13a0060b39
|
@ -182,8 +182,28 @@ defmodule ABI.FunctionSelector do
|
|||
"outputs" => named_outputs
|
||||
} <-
|
||||
item
|
||||
# Workaround for missing "outputs" field.
|
||||
# This is a fix for https://github.com/poanetwork/ex_abi/issues/162
|
||||
# Workaround for ABIs that are missing the "outputs" field.
|
||||
#
|
||||
# For instance, consider this valid ABI:
|
||||
#
|
||||
# ```jsonc
|
||||
# // ...
|
||||
# {
|
||||
# "type": "function",
|
||||
# "stateMutability": "view",
|
||||
# "name": "assumeLastTokenIdMatches",
|
||||
# "inputs": [
|
||||
# {
|
||||
# "type": "uint256",
|
||||
# "name": "lastTokenId",
|
||||
# "internalType": "uint256"
|
||||
# }
|
||||
# ]
|
||||
# },
|
||||
# // ...
|
||||
# ```
|
||||
# If the "outputs" field is missing, we should assume it's an empty
|
||||
# list to continue parsing the ABI.
|
||||
|> Map.put_new("outputs", []),
|
||||
true <- simple_types?(named_inputs, item),
|
||||
true <- simple_types?(named_outputs, item) do
|
||||
|
|
|
@ -113,7 +113,8 @@ defmodule ABI.FunctionSelectorTest do
|
|||
end
|
||||
|
||||
@doc """
|
||||
Regression test for issue #162 (https://github.com/poanetwork/ex_abi/issues/162).
|
||||
Regression test to verify the correct parsing of ABIs that lack the
|
||||
"outputs" field.
|
||||
"""
|
||||
test "with the missing outputs field" do
|
||||
abi = [
|
||||
|
|
Loading…
Reference in New Issue