I haven't worked with web3.js in two years, and back then I didn't have any of these issues. Now I keep running into this error when calling a contract function that takes an address and a uint256 to return an object I use to populate a table on the front end:
Error: Uncaught (in promise) o: Web3 validator found 1 error[s]: value "0" at "/1" must pass "address" validation at u.validate (https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js:2:601874) at t.Web3Validator.validate (https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js:2:603466) at Object. (https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js:2:430532) at PopulateStakeTable (http://192.168.0.17:3000/js/tokenstake.js:117:53)
The function works fine when I interact with the contract on Polygonscan passing and address and 0 as the values.
From the ABI: {"inputs":[ {"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}], "name":"yourStakes", "outputs":[{"internalType":"uint40","name":"stakeId","type":"uint40"},...
The JavaScript
for(var i = 0; i < stakeCount; i++){ var stake = await rewardsContract.methods.yourStakes(activeAccount, i).call(); ...}
I console log that the activeAccount is correctly passing to the call, but I don't understand why it is saying the value 0 must pass address validation when the contract function expects uint256.
Any idea what I'm doing wrong?