hi there,
i have difficulties to show value when i called a function. It did well on remix, but did not show up when i call it using javascript.
here’s how it looks in the remix (successfully return the value).
and here is how it looks in index.html console log.
i did check several times on the ABI and contract address, no issue except this function.
any idea why?
here is the javascript in the index.html.
async function ShowtimeLock() {
let user = Moralis.User.current(); const walletAddress = user.get('ethAddress'); const web3 = await Moralis.enableWeb3(); const chainIdDec = await web3.eth.getChainId(); if (chainIdDec == 97 ) { const web3 = await Moralis.enableWeb3(); let slockcontract = new web3.eth.Contract(LockABI,LockContract); const bukakunci = await slockcontract.methods.ShowUnlockTime("0xb15fa3FFe0292892abc77bD3bA50409d3628DB8A").call(); console.log(bukakunci); } else { console.log("Connect to BSC Test Network!") }
}
here is the ABI for particular function
{
“inputs”: [
{
“internalType”: “address”,
“name”: “token”,
“type”: “address”
}
],
“name”: “ShowUnlockTime”,
“outputs”: [
{
“internalType”: “uint256”,
“name”: “”,
“type”: “uint256”
}
],
“stateMutability”: “view”,
“type”: “function”
},