Incorrect wrapping of two-dimensional arrays
Opened this issue · 0 comments
ApereLieZ commented
Incorrect wrapping of two-dimensional arrays
Steps To Reproduce
- Define an ABI with a two-dimensional array:
{
"internalType": "uint256[][]",
"name": "results",
"type": "uint256[][]"
}
Use the following Java class to wrap the data:
public RemoteCall<ProposalInfo> getInfo(BigInteger id) {
final Function function = new Function(FUNC_INFO, Arrays.asList(new Uint256(id)), Arrays.asList(new TypeReference<ExampleStruct>() {
}));
return executeRemoteCallSingleValueReturn(function, ExampleStruct.class);
}
...
public static class ExampleStruct extends DynamicStruct {
...
public final DynamicArray<DynamicArray<Uint256>> results;
public ProposalInfo(..., @Parameterized(type = Uint256.class) DynamicArray<DynamicArray<Uint256>> results) {
super(..., results);
...
this.results = results;
}
}
Expected behavior
The results field should be of type DynamicArray<DynamicArray<Uint256>>
, correctly representing a two-dimensional array of Uint256.
Actual behavior
The results field is incorrectly returned as DynamicArray<Uint256>
instead of DynamicArray<DynamicArray<Uint256>>
.
Environment
Describe the environment in which the issue occurs
- Web3j 4.12.0
- Java 17
- Operating System (mac os)