web3j 12.0.0
the solidity source code like this
abi.encode(_from, _to, _value)
Here is my JAVA test code, step 1 I encoded a DynamicStruct, and step 2, how to decode back to a DynamicStruct object? I tried and failed.
@Test
public void test_typeDecoder() {
//encoded = "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000001e078";
String encoded =
TypeEncoder.encode(
new DynamicStruct(
new Address("0x01"),
new Address("0x02"),
new Uint256(123000)));
//Decode fails with: TypeReferenced struct must contain a constructor with types that extend Type
//DynamicStruct struct = TypeDecoder.decodeDynamicStruct(encoded, 0, TypeReference.create(DynamicStruct.class));
//Decode fails with: Array types must be wrapped in a TypeReference
//DynamicStruct struct = TypeDecoder.decode(encoded, DynamicStruct.class);
}
I trid TypeDecoder.decodeDynamicStruct / TypeDecoder.decode, but failed.
Please give me a hand, thanks.