In Solidity, function arguments are usually byte, uint, string types. So when calling contract functions through web3 object, do we need to convert arguments into proper types? Or there are implicit type conversions in web3? Can I just input string values in the javascript UI?
1 Answer
you don't need to convert the values into solidity types. web3js is a javascript API so it supports only the javascript type (details) but it doesn't matter. just use the string inputs from your form in var (javascript).
- Thank you Badr! But what if the function argument is an array? Can I just pass it an array of strings in javascript?Kangqi Li– Kangqi Li2016-11-06 19:01:41 +00:00Commented Nov 6, 2016 at 19:01
- check ethereum.stackexchange.com/questions/8362/…2016-11-06 19:24:22 +00:00Commented Nov 6, 2016 at 19:24
- I tried but it is weird. See my new question:ethereum.stackexchange.com/questions/10053/…Kangqi Li– Kangqi Li2016-11-16 05:29:55 +00:00Commented Nov 16, 2016 at 5:29