0

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);
refMethod.setAccessible(true);

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

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.