web3j icon indicating copy to clipboard operation
web3j copied to clipboard

Return struct data from a view without requiring the creation of a custom class

Open cathalmf opened this issue 3 years ago • 2 comments

Feature description_

A clear and concise description of what the feature would be.

I would like a way to return struct data from a contracts view function without needing to add the struct definition as a class which extends DynamicStruct

Ideally we could specify the struct format like "(uint256,address,string)" or in the case of struct array "((uint256,address,string)[])"

The response could be something as simple as an ArrayList<Object>

Reason: I want to provide a way for the end user to call views on any contract without needing to add contract specific classes to my java project.

cathalmf avatar Oct 11 '22 10:10 cathalmf

Hi @cathalmf, if I understand this is similar to what this PR is proposing?

mohamedelshami avatar Oct 21 '22 09:10 mohamedelshami

Hi @cathalmf, if I understand this is similar to what this PR is proposing?

I dont think so. That still requires passing in type T which still means you need to have a definition of the struct in your Java code.

My idea would be to have a way to return an ArrayList containing the struct values.

cathalmf avatar Oct 21 '22 09:10 cathalmf