TronLink / tronlink-extension

TronLink Chrome Extension
2 stars 3 forks source link

.call() always returns an empty array #329

Open IlijazM opened 2 years ago

IlijazM commented 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:

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]];
}
ahmadsaeed8081 commented 1 year ago

Did you find out the solution ?

ahmadsaeed8081 commented 1 year ago

i'm getting the same error

IlijazM commented 1 year ago

no sorry