Iāve been having a few issues going through the Youtube videos, and my renderGame() function hasnāt been processing.
I saw it might be the version of Web3 and to type contract instead of Contract but it gave another error when trying to getAllTokensForUser
The NFTs are visible in the Terminal but might not be posting, I saw the first NFT created but itās gone. I read in another Thread it might be because Iām using a local Ganache server.
Currently Iām receiving an error about the Contract and Web3 warnings:
Uncaught (in promise) TypeError: Cannot read property āContractā of undefined
This is my code:
async function renderGame(){
$("#login_button").hide();
$("#zilla_row").html("");
//Get and Render properties from Smart Contract
window.Web3 = await Moralis.Web3.enable();
let abi = await getAbi();
let contract = new web3.eth.Contract(abi, CONTRACT_ADDRESS);
let array = await contract.methods.getAllTokensForUser(ethereum.selectedAddress).call({from: ethereum.selectedAddress});
if(array.length == 0) return;
array.forEach( async (ZillaId) => {
let details = await contract.methods.getTokenDetails(ZillaId).call({from: ethereum.selectedAddress});
renderzilla(ZillaId, details);
});
$("#game").show();
And this is my Server URL