You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have a question on how to encode a uint256[] parameter. Creating a tuple for the following works just fine:
Function func = new Function("test(uint256[],bool)");
BigInteger[] bigints = new BigInteger[] { BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9) };
Tuple args = Tuple.of(bigints, true);
ByteBuffer bb = func.encodeCall(args);
System.out.println(Function.formatCall(bb.array()));
but if the function argument is a pure uint256[] such as
Function func = new Function("test(uint256[])");
BigInteger[] bigints = new BigInteger[] { BigInteger.valueOf(7), BigInteger.valueOf(8), BigInteger.valueOf(9) };
Tuple args = Tuple.of(bigints);
ByteBuffer bb = func.encodeCall(args);
System.out.println(Function.formatCall(bb.array()));
the encoding fails with the following trace:
java.lang.IllegalArgumentException: tuple length mismatch: actual != expected: 3 != 1
at com.esaulpaugh.headlong.abi.TupleType.validate(TupleType.java:146)
at com.esaulpaugh.headlong.abi.Function.validatedCallLength(Function.java:193)
at com.esaulpaugh.headlong.abi.Function.encodeCall(Function.java:205)
Any suggestions on how to pass the pure uint256[] correctly in this case?
Thank you
The text was updated successfully, but these errors were encountered:
Hi, I have a question on how to encode a uint256[] parameter. Creating a tuple for the following works just fine:
but if the function argument is a pure uint256[] such as
the encoding fails with the following trace:
Any suggestions on how to pass the pure uint256[] correctly in this case?
Thank you
The text was updated successfully, but these errors were encountered: