3

basically I have this ABI for a contract

{"internalType":"bytes","name":"_DATA","type":"bytes"}],"name":"function","outputs":

I'm wondering if it's possible to fetch the value from _DATA and if it is, how would one achieve that?

1 Answer 1

4

The "internalType" is the representation used by solidity.

For example the contract

contract B {
    struct View {
        uint x;
    }
    function foo(View memory bad) public view {
        this;
    }
}

Will produce the following ABI

[
    {
        "inputs": [
            {
                "components": [
                    {
                        "internalType": "uint256",
                        "name": "x",
                        "type": "uint256"
                    }
                ],
                "internalType": "struct B.View",
                "name": "bad",
                "type": "tuple"
            }
        ],
        "name": "foo",
        "outputs": [],
        "stateMutability": "view",
        "type": "function"
    }
]

The "type" says it is a tuple, but the "internalType" indicates it is a struct B.View.

The internal type is useful for debugging, but it is not required for the contract to encode/decode parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.