Open IlijazM opened 2 years ago
When I call a view function of my smart contract I always get an empty array as a response:
contract.methods .getCurrentLobby() .call({ from: account }) .then(console.log) // This will return []
.send() works and looking up the variable works too except it doesn't show me the content of arrays. I init the contract like so:
.send()
var contractAddress = "TJMB56gK11MgkCnHH5CzskxVWwiooVZkm2"; var tronLinkInterval = setInterval(async () => { if (window.tronWeb && window.tronWeb.defaultAddress.base58) { clearInterval(tronLinkInterval); window.account = tronWeb.defaultAddress.base58; window.contract = await tronWeb.contract().at(contractAddress); contract.getCurrentLobby().call(); } }, 10);
That's my smart contract function:
function getCurrentLobby() public view returns (Lobby memory) { return lobbiesById[lobbyIdsByAddress[msg.sender]]; }
Did you find out the solution ?
i'm getting the same error
no sorry
When I call a view function of my smart contract I always get an empty array as a response:
.send()
works and looking up the variable works too except it doesn't show me the content of arrays. I init the contract like so:That's my smart contract function: