Closed ShoaibKakal closed 2 years ago
a Function that takes a struct as an argument would be something like Function("addUser(())")
where ()
is the struct (i.e. tuple).
If that struct contains a string
, the representation of the argument would be (string)
i.e. Function("addUser((string))")
Great! would love to contribute by adding documentation of this library once i got some grip
Thanks @esaulpaugh but after doing this i got an error on encodeCallWithArgs()
that tuple index 0: class mismatch: java.lang.String != com.esaulpaugh.headlong.abi.Tuple ((string) requires Tuple but found String)
My current code looks like this
val headLongFun = com.esaulpaugh.headlong.abi.Function("addUser((string))")
val headLongEncode =
headLongFun.encodeCallWithArgs("esaulpaugh")
I tried using .encode()
but same error:
val args = Tuple.of("esaulpaugh")
val headLongFun = com.esaulpaugh.headlong.abi.Function("addUser((string))")
val headLongEncode =
headLongFun.encodeCall(args)
Solved it buy passing: val args = Tuple.of(Tuple.of("esaulpaugh"))
, Tuple inside tuple.
I've a function that takes a struct as an argument.
How can i parse this in headlong?
If i do the following, it does not work
val headLongFun = com.esaulpaugh.headlong.abi.Function("addUser(string)")