Function Error With My Solidity Map(int,string) While Using Javascript To Return Values To Html.
I can't get my labels to update with a JavaScript function call to my Solidity smart contract function. I'm trying to create an (integer, string) map in solidity to display values
Solution 1:
So when you say that it returns NULL, you mean that the result
in the callback function is NULL, correct? If so I have a few guesses but nothing concrete:
- Your input is somehow translated wrong when passed to the function. It expects a uint256 and you give the number literal 1. I have to assume this should work but I usually stick to wrapping my numbers in BigNumber and have never used a literal (but again, why wouldn't it work).
- You are using strings in Solidity. In order to have absolute control over my struct sizes and memory usage I nearly never use dynamic arrays. They definitely have uses, but usually a
mapping
can do what a dynamic array can do, and 32 characters (bytes32
) is more than enough for most cases astring
would be used in. I'm not exactly sure where this could be causing an issue but I figured I'd point it out. - Maybe your version of web3 is wrong. I know some versions are fine with simply calling the function, while others prefer call / send to be used (depending on whether it's a constant function). If you're using 1.0 this could be the case as seen in the docs.
Post a Comment for "Function Error With My Solidity Map(int,string) While Using Javascript To Return Values To Html."