Skip to content
New issue

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

ABI.parse_specification ignores function objects without outputs field #162

Closed
fedor-ivn opened this issue Mar 5, 2024 · 0 comments · Fixed by #163
Closed

ABI.parse_specification ignores function objects without outputs field #162

fedor-ivn opened this issue Mar 5, 2024 · 0 comments · Fixed by #163

Comments

@fedor-ivn
Copy link
Contributor

Recently we came across such a contract, where one of the methods (assumeLastTokenIdMatches) does not have an array of outputs in its ABI:

// ...
    {
        "type": "function",
        "stateMutability": "view",
        "name": "assumeLastTokenIdMatches",
        "inputs": [
            {
                "type": "uint256",
                "name": "lastTokenId",
                "internalType": "uint256"
            }
        ]
    },
// ...

If I try to parse this ABI using ABI.parse_specification, the function assumeLastTokenIdMatches is skipped:

iex(1)> File.read!("contract-abi.json") |> Jason.decode! |> ABI.parse_specification |> Enum.filter(fn %ABI.FunctionSelector{function: name} -> name == "assumeLastTokenIdMatches" end)
[]

contract-abi.json

Possibly, the problem is somewhere here:

with %{
"name" => function_name,
"inputs" => named_inputs,
"outputs" => named_outputs
} <- item,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant