I am trying to decode a String with this code that I found but I have not been able to do it.

String to = inputdata.substring(10, 74);
String value = inputdata.substring(74, 138);

Method refMethod = TypeDecoder.class.getDeclaredMethod("decode", String.class, int.class, Class.class);

String cadena = (String) refMethod.invoke(null, to, 0, String.class);
Uint256 amount = (Uint256) refMethod.invoke(null, value, 0, Uint256.class);

I can get uint256 but not the string

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.