[SOLVED] Cant get NFTs from OTHER signed in users

Hi, I have a test DApp that has two users, both users have nfts from the same contract however when attempting to display user 2 NFT collection I’m met with the following error in chrome console.

VM2784:2 Uncaught (in promise) Error: No provider selected for request eth_chainId

code to being used to fetch NFTs

   //users enjimon
        const userOptions = { chain: 'mumbai', address: currentUser.get('ethAddress'), token_address: CONTRACT_ADDRESS };
        const userNFTs = await Moralis.Web3API.account.getNFTsForContract(userOptions);
        let userEnjimonCounter = userNFTs.result.length;
        let usersEnjimon = [];
        let usersContractEnjimon = [];

There are no errors in moralis logs

how does the code look like when it works?

I don’t see a problem in this code

I know it’s strange the code that works is exactly the same, and functions normally. Its just when I log in from a different wallet address it throws the error. I’ll have to go through line by line with a fresh pair of eyes. cause it makes no sense. other than that the code runs fine testing from the deployers wallet address. As always, Thank you for your time @cryptokid really appreciate your assistance.

On what network is that? It looks like an error related to MetaMask connection

its on mumbai, I will try and update the metamask extension

Oddly enough the problem is persistent even after updating metamask.

However I managed to transfer the NFT to a different wallet address and used the brave browser and I could indeed see both users NFTs when logged in from either account within brave, but not so from google chrome and that is new.

same error when it doesn’t work? do you know from what line is that error generated?

same error when it doesn’t work. It does not state which line is triggering the error.

here is the .js I’m only fetching the users nfts on init

/* Moralis init code */
const serverUrl = "https://i65nweyr9d9c.usemoralis.com:2053/server";
const appId = "gwhAajNieO72VxG53x8fqELwgKAPzWDB0NSyO3y6";
const CONTRACT_ADDRESS = "0xa98d4f3f8f45c11d1423d122b618bf6f7c0892ac";


init = async () => {

    await Moralis.start({ serverUrl, appId });

    currentUser = await Moralis.User.current();
    

    if(!currentUser){
       
       window.location.pathname = "./dapp.html";
    }else{

        currentUser = await Moralis.User.current();

          //users enjimon
        const userOptions = { chain: 'mumbai', address: currentUser.get('ethAddress'), token_address: CONTRACT_ADDRESS };
        const userNFTs = await Moralis.Web3API.account.getNFTsForContract(userOptions);
        let userEnjimonCounter = userNFTs.result.length;
        let usersEnjimon = [];
        let usersContractEnjimon = [];

        if(userNFTs.total == 0){
            renderEnjimonMsg();
        }else{

            for(let x = 0; x < userEnjimonCounter; x++){
            if(userNFTs.result[x].token_address == 0xa98d4f3f8f45c11d1423d122b618bf6f7c0892ac && userNFTs.result[x].token_id >= 7){
                    fetch(userNFTs.result[x].token_uri)
                    .then(res => res.json())
                    .then(out =>{
                    usersEnjimon.push(out);
                    usersContractEnjimon.push(userNFTs.result[x]);
                    }).catch(err => err);
                    }
                }

        await getUserEnjimon(usersEnjimon, usersContractEnjimon);
  }
   }

}

async function getUserEnjimon(usersEnjimon, contractEnjimon){

    let resData = [];
    let nftOwners = [];
    let nftIds = [];
    setTimeout(function(){
     
      for(let count = 0; count < contractEnjimon.length; count++){
     
        
        let targetData = ( contractEnjimon[count].amount);
        let ownerData = (contractEnjimon[count].token_address);
    
        nftOwners.push(ownerData);
        nftIds.push(contractEnjimon[count].token_id)
        resData.push(targetData);
        
  }
  
  }, 1000);
   
  
  await renderUserEnjimon(usersEnjimon, resData, nftOwners, nftIds);
  
   
  };

async function renderUserEnjimon(usersEnjimon, resData, nftOwners, nftIds){
   console.log(usersEnjimon);
  
    const parent = document.getElementById("tamedEnjimon");
    
    const web3Provider = await Moralis.enableWeb3();
    
    setTimeout(async function(){
      for(let i =0; i <  usersEnjimon.length; i++ ){
        const nft =  usersEnjimon[i];
        const resdata =  resData[i];
        const nftids =  nftIds[i];

        const options = {
            contractAddress: CONTRACT_ADDRESS,
            functionName: "getTokenDetails",
            abi: contractAbi,
            params: {
              tokenId: nftids
            },
          };
        
        
        const details =  await Moralis.executeFunction(options);


        let now = new Date();  
        //let maxTime = details.lastTrained;
          
        let unixTimeNow = Math.floor(now.getTime() / 1000); //convert to seconds. solidity works in seconds. JS works in ms
  
        let restLeft = (parseInt(details.lastTrained) + 28880) - unixTimeNow; 
        let maxRest = parseInt(details.lastTrained) + 28880;


        let restPercentageLeft = restLeft / maxRest; //rest


        let restPerecntageString = (restPercentageLeft * 100) + "%";
        let canTrain = new Date( (parseInt(details.lastTrained) + 28880) * 1000); 

        if(now > canTrain){
            canTrain = "<b>$Enjimon is fully rested!</b>"
        }else
        {
            canTrain = canTrain;
        }

                   //run everytime the alotted time hits.
                    let interval = setInterval(() => {
                    let now = new Date(); 
                    let maxRest = parseInt(details.lastTrained) + 28880;
                    let unixTimeNow = Math.floor(now.getTime() / 1000); 
        
                    let restLeft = ( parseInt(details.lastTrained) + 28880 ) - unixTimeNow;
                    let restPercentageLeft = restLeft / maxRest; 
                    let restPercentageString = (restPercentageLeft * 10000000)  + "%";
        
        
                    $(`#enjimon_${nftids} .rest-bar`).css("width", restPercentageString );
        
                }, 5000);

        let htmlString = ` 
            <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="enjimon_${nftids}"> 
            <img src="${nft.image}" class="card-img-top" style="height: 450px;" alt="">
                <div class="card-body ">
                    <div style="display: flex; justify-content: space-between">
                                        <h5 class="card-title">${nft.name}</h5>
                    <p class="card-text">| LVL: ${details.level}</p>
                    </div>

                    <p class="card-text">${nft.description}</p>

                    <p class="card-text">HP: ${details.healthPoints}</p>
                    <p class="card-text">ATK: ${details.attack}</p>
                    <p class="card-text">DEF: ${details.defense}</p>

                    <div class="progress" style="margin-bottom: 10px;">
                    <div class="progress-bar rest-bar" style="width: ${restPerecntageString};">Remaing rest time</div>
                    </div>
                    <p class="card-text">Rest: <span class="enjimon_training">${canTrain}</span></p>

                    <div style="display: flex; justify-content: center;">
                    <a  onclick="train(${nftids})" class="btn btn-primary trainBtn"style="margin-bottom: 5px; margin-right: 5px;">Train</a>
                    <a  onclick="givePotion(${nftids})" class="btn btn-success feedBtn" style="margin-bottom: 5px; margin-right: 5px;">Potions</a>
                    <a  onclick="giveEATK(${nftids})" class="btn btn-success trainBtn"style="margin-bottom: 5px; margin-right: 5px;">eATK</a>
                    <a  onclick="giveEDEF(${nftids})" class="btn btn-success trainBtn"style="margin-bottom: 5px; margin-right: 5px;">eDEF</a>
                    <a  onclick="giveElixer(${nftids})" class="btn btn-success trainBtn"style="margin-bottom: 5px; margin-right: 5px;">Elixer</a>
                    </div>
                    <br>
                    
                    <hr>
                    <div style="display: flex; justify-content: space-between;">
                    <p class="card-text"><b>ID: ${nftids}</b></p>
                    <p class="card-text">TUE: ${details.TVL}</p>
                    <p class="card-text">amount: ${resdata}</p>
                    </div>
                </div>
            </div>
        `;
      
        let col = document.createElement("div");
        col.className = "col col-md-4";
        col.style = "margin-bottom: 30px";
        col.innerHTML = htmlString;
        parent.appendChild(col);
    }
  
  }, 1000);


  
};

function renderEnjimonMsg(){
  
    const parent = document.getElementById("tamedEnjimon");
    
  
    setTimeout(function(){
      
  
        let htmlString = ` 
            <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="noItems"> 
                <div class="card-body ">
                    <h5 class="card-title">Trainers</h5>
                    <p class="card-text">You Do Not own any $Enjimon</p>
                    
  
                    </div>
  
                </div>
            </div>
        `;
      
        let col = document.createElement("div");
        col.className = "col col-md-4";
        col.style = "margin-bottom: 30px";
        col.innerHTML = htmlString;
        parent.appendChild(col);
    
  
  }, 1000);
  
  }

train = async (nftids) => {
    const options = {
        contractAddress: CONTRACT_ADDRESS,
        functionName: "train",
        abi: contractAbi,
        params: {
          tokenId: nftids
        },
      };

    const train =  Moralis.executeFunction(options)
    .on("receipt", function(receipt){ 
        
        console.log(receipt);
        alert("training Completed");
        setTimeout(refreshContract, 3000);
    });

}

givePotion = async (nftids) => {
   
    const options = {
        contractAddress: CONTRACT_ADDRESS,
        functionName: "givePotion",
        abi: contractAbi,
        params: {
          enjimonId: nftids
        },
      };


const potion =  Moralis.executeFunction(options)
    .on("receipt", function(receipt){
        console.log(receipt);
        alert("$Enjimon given potion, and health has increased!");
        setTimeout(refreshContract, 3000);
    });
}

giveEATK = async (nftids) => {
    const options = {
        contractAddress: CONTRACT_ADDRESS,
        functionName: "giveEATK",
        abi: contractAbi,
        params: {
          enjimonId: nftids
        },
      };

    const eATK =  Moralis.executeFunction(options)
    .on("receipt", function(receipt){
        console.log(receipt);
        alert("$Enjimon has been given eATK and attack power has increased!");
        setTimeout(refreshContract, 3000);
    });
}

giveEDEF = async (nftids) => {
    
    const options = {
        contractAddress: CONTRACT_ADDRESS,
        functionName: "giveEDEF",
        abi: contractAbi,
        params: {
          enjimonId: nftids
        },
      };

    const eDEF =  Moralis.executeFunction(options)
    .on("receipt", function(receipt){
        console.log(receipt);
        alert("$Enjimon has been given eDEF and defense power has increased!");
        setTimeout(refreshContract, 3000);
    });

      

}

giveElixer = async (nftids) => {
    const options = {
        contractAddress: CONTRACT_ADDRESS,
        functionName: "giveElixer",
        abi: contractAbi,
        params: {
          enjimonId: nftids
        },
      };

    const elixer =  Moralis.executeFunction(options)
    .on("receipt", function(receipt){
        console.log(receipt);
        alert("$Enjimon has been given rare Elixer crystal all stats have increased!");
        setTimeout(refreshContract, 3000);
    });
   
}

init();

you could add some logging here, to see what are the userOptions before the call and after that what is in userNFTs

1 Like

In another place within my DApp I have separate logic that displays user NFTs, and contract NFTs, market etc just without the user interactivity between their digital asset, and it works fine in chrome as well. for Users from either account the DApp functions as intended, its only from within chrome and when I go to utilize logic from my ‘tamedEnjimon.js’ file does the error present itself.

this logic functions fine. main dapp.js

/* Moralis init code */
const serverUrl = "https://i65nweyr9d9c.usemoralis.com:2053/server";
const appId = "gwhAajNieO72VxG53x8fqELwgKAPzWDB0NSyO3y6";
const CONTRACT_ADDRESS = "0xA98d4f3f8F45C11d1423D122b618Bf6F7C0892AC";
const ADMIN = "0xaf9fa351b47ee3ebfb03907c1319e518f617dc4e";
let currentUser;
displayApusLabs();

 init = async () => {

  await Moralis.start({serverUrl, appId});

  currentUser = await Moralis.User.current();

  if(!currentUser){ 
    $('#myEnjimon').hide();
    $('#BattleArena').hide();
    $('#liveChat').hide();
    $('#btn-logout').hide();
    $('#apusItems').hide();
    $('#apusEnjimon').hide();
    $('#ownedItems').hide();
    $('#topTrainer').hide();
    $('#TrainerShop').hide();
    $('#mint').hide();
    $('#trainEnjimon').hide();

    $('#btn-login').show(); 

  }else{
    $('#btn-logout').show();
    $('#myEnjimon').show();
    $('#BattleArena').show();
    $('#liveChat').show();
    $('#apusItems').show();
    $('#apusEnjimon').show();
    $('#ownedItems').show();
    $('#topTrainer').show();
    $('#TrainerShop').show();
    $('#mint').show();
    $('#trainEnjimon').show();

    $('#btn-login').hide();
   

    //accessing token metadata via uri - only Enjimon
    const options = {address: CONTRACT_ADDRESS, chain: 'mumbai'}; 
    let NFTs = await Moralis.Web3API.token.getAllTokenIds(options);
    let counter = NFTs.result.length;
    let apusEnjimon = [];
    let contractNFTs = []
         
    for(let x = 0; x < counter; x++){
        if(NFTs.result[x].token_address == 0xA98d4f3f8F45C11d1423D122b618Bf6F7C0892AC && NFTs.result[x].token_id <= 6){
              fetch(NFTs.result[x].token_uri)
              .then(res => res.json())
              .then(out =>{
                apusEnjimon.push(out);
                contractNFTs.push(NFTs.result[x]);
                }).catch(err => err);
              }
          }

    //accessing token metadata via uri
    const enjimonOptions = {address: CONTRACT_ADDRESS, chain: "mumbai"}; 
    let enjimonNFTs = await Moralis.Web3API.token.getAllTokenIds(enjimonOptions);
    let enjimonCounter = enjimonNFTs.result.length;
    let apusEnjimons = [];
    let contractEnjimon = []
           
    for(let x = 0; x < enjimonCounter; x++){
          if(enjimonNFTs.result[x].token_address == 0xA98d4f3f8F45C11d1423D122b618Bf6F7C0892AC && enjimonNFTs.result[x].token_id >= 7){
                fetch(enjimonNFTs.result[x].token_uri)
                .then(res => res.json())
                .then(out =>{
                    apusEnjimons.push(out);
                    contractEnjimon.push(enjimonNFTs.result[x]);
                  }).catch(err => err);
                }
            }
     
  //users items
  const usersOptions = { chain: 'mumbai', address: currentUser.get('ethAddress'), token_address: CONTRACT_ADDRESS};
  const usersNFTs = await Moralis.Web3API.account.getNFTsForContract(usersOptions);
  let usersItemCounter = usersNFTs.result.length;
  let usersItems = [];
  let usersContractItems = [];
 
  if(usersNFTs.total == 0){
    renderItemsMsg();
   
  }else{

    for(let x = 0; x < usersItemCounter; x++){
      if(usersNFTs.result[x].token_address == 0xA98d4f3f8F45C11d1423D122b618Bf6F7C0892AC && usersNFTs.result[x].token_id <= 6){
            fetch(usersNFTs.result[x].token_uri)
            .then(res => res.json())
            .then(out =>{
              usersItems.push(out);
              usersContractItems.push(usersNFTs.result[x]);
              }).catch(err => err);
            }
        }

        await getUserItems(usersItems, usersContractItems);
  }

  //users enjimon
  const userOptions = { chain: 'mumbai', address: currentUser.get('ethAddress'), token_address: CONTRACT_ADDRESS};
  const userNFTs = await Moralis.Web3API.account.getNFTsForContract(userOptions);
  let userEnjimonCounter = userNFTs.result.length;
  let usersEnjimon = [];
  let usersContractEnjimon = [];

  if(userNFTs.total == 0){
    renderEnjimonMsg();
  }else{

    for(let x = 0; x < userEnjimonCounter; x++){
      if(userNFTs.result[x].token_address == 0xA98d4f3f8F45C11d1423D122b618Bf6F7C0892AC && userNFTs.result[x].token_id >= 7){
            fetch(userNFTs.result[x].token_uri)
            .then(res => res.json())
            .then(out =>{
              usersEnjimon.push(out);
              usersContractEnjimon.push(userNFTs.result[x]);
              }).catch(err => err);
            }
        }

        await getUserEnjimon(usersEnjimon, usersContractEnjimon);
  }
    //Code Executions 
    await getItems(apusEnjimon, contractNFTs);
    await getEnjimon(apusEnjimons, contractEnjimon);  
  }
}

/* Authentication code */
async function login() {
  let user = Moralis.User.current();
  if (!user) {
    user = await Moralis.authenticate({ signingMessage: "Log in to Access Wallet Monsters Apus" })
      .then(function (user) {
        alert("Welcome to the Apus Sector Trainer: " + user.get("ethAddress"));
        console.log("logged in user:", user);
        console.log(user.get("ethAddress"));
        location.reload();
      })
      .catch(function (error) {
        console.log(error);
      });
  }
}

async function logOut() {
  await Moralis.User.logOut();

  alert("Log out successfull");
  console.log("logged out");

  location.reload();
}
//Fetching NFT Functions
async function getItems(apusEnjimon, contractNFTs){

  let resData = [];
  let nftOwners = [];
  let nftIds = [];
  setTimeout(function(){
   
    for(let count = 0; count < contractNFTs.length; count++){
   
      
      let targetData = ( contractNFTs[count].amount);
      let ownerData = (contractNFTs[count].token_address);
  
      nftOwners.push(ownerData);
      nftIds.push(contractNFTs[count].token_id)
      resData.push(targetData);
      
}

//console.log(nftIds);
//console.log(nftOwners);
//console.log(resData);
}, 1000);
 

await renderInventory(apusEnjimon, resData, nftOwners, nftIds);

 
};
async function getEnjimon(apusEnjimons, contractEnjimon){

  let resData = [];
  let nftOwners = [];
  let nftIds = [];
  setTimeout(function(){
   
    for(let count = 0; count < contractEnjimon.length; count++){
   
      
      let targetData = ( contractEnjimon[count].amount);
      let ownerData = (contractEnjimon[count].token_address);
  
      nftOwners.push(ownerData);
      nftIds.push(contractEnjimon[count].token_id)
      resData.push(targetData);
      
}

console.log(nftIds);
console.log(nftOwners);
console.log(resData);
}, 1000);
 

await renderItems(apusEnjimons, resData, nftOwners, nftIds);

 
};
async function getUserItems(usersItems, usersContractItems){

  let resData = [];
  let nftOwners = [];
  let nftIds = [];
  setTimeout(function(){
   
    for(let count = 0; count < usersContractItems.length; count++){
   
      
      let targetData = ( usersContractItems[count].amount);
      let ownerData = (usersContractItems[count].token_address);
  
      nftOwners.push(ownerData);
      nftIds.push(usersContractItems[count].token_id)
      resData.push(targetData);
      
}

console.log(nftIds);
console.log(nftOwners);
console.log(resData);
}, 1000);
 

await renderUserItems(usersItems, resData, nftOwners, nftIds);

 
};

async function getUserEnjimon(usersEnjimon, contractEnjimon){

  let resData = [];
  let nftOwners = [];
  let nftIds = [];
  setTimeout(function(){
   
    for(let count = 0; count < contractEnjimon.length; count++){
   
      
      let targetData = ( contractEnjimon[count].amount);
      let ownerData = (contractEnjimon[count].token_address);
  
      nftOwners.push(ownerData);
      nftIds.push(contractEnjimon[count].token_id)
      resData.push(targetData);
      
}

console.log(nftIds);
console.log(nftOwners);
console.log(resData);
}, 1000);
 

await renderUserEnjimon(usersEnjimon, resData, nftOwners, nftIds);

 
};
//Render Data functions
async function renderInventory(apusTokens, resData, nftOwners, nftIds){
  //console.log(apusTokens);
 
  


  const parent = document.getElementById("appManager");
  //const stepParent = document.getElementById("knownEnjimon");

  setTimeout(function(){
    for(let i =0; i <  apusTokens.length; i++ ){
      const nft =  apusTokens[i];
      const resdata =  resData[i];
     // const nftowners =  nftOwners[i];
      const nftids =  nftIds[i];

      let htmlString = ` 
          <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="enjimon_${nftids}"> 
          <img src="${nft.image}" class="card-img-top" style="height: 450px;" alt="">
              <div class="card-body ">
                  <h5 class="card-title">${nft.name}</h5>
                  <p class="card-text">${nft.description}</p>
                  
                  <hr>
                  <div style="display: flex; justify-content: space-between;">
                  <p class="card-text"><b>ID: ${nftids}</b></p>
                  <p class="card-text">In Existence: ${resdata}</p>
                  </div>

              </div>
          </div>
      `;
    
      let col = document.createElement("div");
      col.className = "col col-md-4";
      col.style = "margin-bottom: 30px";
      col.innerHTML = htmlString;
      parent.appendChild(col);
  }

}, 1000);



 // let countString = `
 //         <p>$Enjimon Discovered: ${EXISTENCE}<p>
 // `;

  //stepParent.innerHTML = countString;
}
async function renderItems(apusEnjimons, resData, nftOwners, nftIds){
  console.log(apusEnjimons);
 

  const parent = document.getElementById("itemManager");
  

  setTimeout(function(){
    for(let i =0; i <  apusEnjimons.length; i++ ){
      const nft =  apusEnjimons[i];
      const resdata =  resData[i];
     // const nftowners =  nftOwners[i];
      const nftids =  nftIds[i];

      let htmlString = ` 
          <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="enjimon_${nftids}"> 
          <img src="${nft.image}" class="card-img-top" style="height: 450px;" alt="">
              <div class="card-body ">
                  <h5 class="card-title">${nft.name}</h5>
                  <p class="card-text">${nft.description}</p>
                  
                  <hr>
                  <div style="display: flex; justify-content: space-between;">
                  <p class="card-text"><b>ID: ${nftids}</b></p>
                  <p class="card-text">In Existence: ${resdata}</p>
                  </div>

              </div>
          </div>
      `;
    
      let col = document.createElement("div");
      col.className = "col col-md-4";
      col.style = "margin-bottom: 30px";
      col.innerHTML = htmlString;
      parent.appendChild(col);
  }

}, 1000);

}
async function renderUserItems(usersItems, resData, nftOwners, nftIds){
  console.log(usersItems);
 

  const parent = document.getElementById("usersItems");
  

  setTimeout(function(){
    for(let i =0; i <  usersItems.length; i++ ){
      const nft =  usersItems[i];
      const resdata =  resData[i];
     // const nftowners =  nftOwners[i];
      const nftids =  nftIds[i];

      let htmlString = ` 
          <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="enjimon_${nftids}"> 
          <img src="${nft.image}" class="card-img-top" style="height: 450px;" alt="">
              <div class="card-body ">
                  <h5 class="card-title">${nft.name}</h5>
                  <p class="card-text">${nft.description}</p>
                  
                  <hr>
                  <div style="display: flex; justify-content: space-between;">
                  <p class="card-text"><b>ID: ${nftids}</b></p>
                  <p class="card-text">amount: ${resdata}</p>
                  </div>
              </div>
          </div>
      `;
    
      let col = document.createElement("div");
      col.className = "col col-md-4";
      col.style = "margin-bottom: 30px";
      col.innerHTML = htmlString;
      parent.appendChild(col);
  }

}, 1000);

}

async function renderUserEnjimon(usersEnjimon, resData, nftOwners, nftIds){
  console.log(usersEnjimon);
 

  const parent = document.getElementById("usersEnjimon");
  

  setTimeout(function(){
    for(let i =0; i <  usersEnjimon.length; i++ ){
      const nft =  usersEnjimon[i];
      const resdata =  resData[i];
     // const nftowners =  nftOwners[i];
      const nftids =  nftIds[i];

      let htmlString = ` 
          <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="enjimon_${nftids}"> 
          <img src="${nft.image}" class="card-img-top" style="height: 450px;" alt="">
              <div class="card-body ">
                  <h5 class="card-title">${nft.name}</h5>
                  <p class="card-text">${nft.description}</p>
                  
                  <hr>
                  <div style="display: flex; justify-content: space-between;">
                  <p class="card-text"><b>ID: ${nftids}</b></p>
                  <p class="card-text">amount: ${resdata}</p>
                  </div>
              </div>
          </div>
      `;
    
      let col = document.createElement("div");
      col.className = "col col-md-4";
      col.style = "margin-bottom: 30px";
      col.innerHTML = htmlString;
      parent.appendChild(col);
  }

}, 1000);

}
//Display msg for users with no items/enjimon
function renderItemsMsg(){
  
  const parent = document.getElementById("usersItems");
  

  setTimeout(function(){
    

      let htmlString = ` 
          <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="noItems"> 
              <div class="card-body ">
                  <h5 class="card-title">Trainers</h5>
                  <p class="card-text">No Items in inventory</p>
                  

                  </div>

              </div>
          </div>
      `;
    
      let col = document.createElement("div");
      col.className = "col col-md-4";
      col.style = "margin-bottom: 30px";
      col.innerHTML = htmlString;
      parent.appendChild(col);
  

}, 1000);

}
function renderEnjimonMsg(){
  
  const parent = document.getElementById("usersEnjimon");
  

  setTimeout(function(){
    

      let htmlString = ` 
          <div class="card cards text-white bg-dark mb-3 sm light-b-shadow" id="noItems"> 
              <div class="card-body ">
                  <h5 class="card-title">Trainers</h5>
                  <p class="card-text">You Do Not own any $Enjimon</p>
                  

                  </div>

              </div>
          </div>
      `;
    
      let col = document.createElement("div");
      col.className = "col col-md-4";
      col.style = "margin-bottom: 30px";
      col.innerHTML = htmlString;
      parent.appendChild(col);
  

}, 1000);

}

//Mint
mintMonster = async () => {
  let user = await Moralis.User.current();
  const admin = user.get('ethAddress');
  const web3Provider = await Moralis.enableWeb3();

  if(admin != ADMIN){
      alert("Not authorized to use this function");
  }else{

      let Name = document.getElementById('name_input').value;
      let Health = parseInt(document.getElementById('health_input').value);
      let Defense = parseInt(document.getElementById('defense_input').value);
      let Attack = parseInt(document.getElementById('attack_input').value);
      let Level = parseInt(document.getElementById('level_input').value);
      let EnjimonType = document.getElementById('enjimonType_input').value;
  
      const options = {
        contractAddress: CONTRACT_ADDRESS,
        functionName: "mintMonster",
        abi: contractAbi,
        params: {
          enjimonName: Name,
          healthPoints: Health,
          defense: Defense,
          attack: Attack,
          level: Level,
          enjimonType: EnjimonType
        },
      };
    
    
    const mint =  await Moralis.executeFunction(options)
      .on("receipt", function(receipt){
          alert("Mint Completed");
          console.log(receipt);
          setTimeout(refreshMint, 3000);
      });

  }


  
}

function refreshMint(){
  location.reload(); 
}
//Purchases
buyUuji = async() => {

  const web3Provider = await Moralis.enableWeb3();

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "buyUUJI",
    abi: contractAbi,
    msgValue: "5000000000000000000"
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)
}

buyHP = async()=> {

  let amount = parseInt(document.getElementById('hp_input').value);
  const total = amount * 250000000000000000;

  const web3Provider = await Moralis.enableWeb3();

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "buyHP",
    abi: contractAbi,
    params:{
      amount: amount
    },
    msgValue: total,
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)

}

buyElixer = async()=> {

  let amount = parseInt(document.getElementById('elixer_input').value);
  const total = amount * 1300000000000000000;

  const web3Provider = await Moralis.enableWeb3();

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "buyElixer",
    abi: contractAbi,
    params:{
      amount: amount
    },
    msgValue: total,
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)

}

buyWalle = async()=> {

  let amount = parseInt(document.getElementById('walle_input').value);
  const total = amount * 500000000000000000;

  const web3Provider = await Moralis.enableWeb3();

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "buyWalle",
    abi: contractAbi,
    params:{
      amount: amount
    },
    msgValue: total,
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)

}
buyRevive = async()=> {

  let amount = parseInt(document.getElementById('revive_input').value);
  const total = amount * 500000000000000000;

  const web3Provider = await Moralis.enableWeb3();

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "buyRevive",
    abi: contractAbi,
    params:{
      amount: amount
    },
    msgValue: total,
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)

}
//BattleMode
battlesPending = async() => {
  const web3Provider = await Moralis.enableWeb3();
  const battles = document.getElementById("pendingBattles");

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "pendingBattleAmount",
    abi: contractAbi
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)

  let htmlStringBalance = `

  <p> ${receipt}<b style="color:red"> Pending</b></p>

`;

  battles.innerHTML = htmlStringBalance;
}

requestBattle = async() => {
  const web3Provider = await Moralis.enableWeb3();
  const opponent = document.getElementById("Opponent_address").value;
  const enjimonId = parseInt(document.getElementById("challenger_enjimon").value);

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "initBattle",
    abi: contractAbi,
    params:{ _opponent: opponent,
            challengerEnjimon: enjimonId
    }
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)
}

battleReq = async () => {
  let battles = await Moralis.Cloud.run("battles");
  const table = document.getElementById('RequestedBattles');

  battles.forEach( async (battles)  =>{
      let row = table.insertRow();
      let challenger = row.insertCell(0);
      challenger.innerHTML = await battles.attributes.challenger;
      let opponent = row.insertCell(1);
      opponent.innerHTML = await battles.attributes.opponent;
      let date = row.insertCell(2);
      date.innerHTML = await  battles.attributes.createdAt;
  })
}

CancelBattle = async () => {

  const web3Provider = await Moralis.enableWeb3();

  const battleId = parseInt(document.getElementById("battle_id").value);

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "cancelBattle",
    abi: contractAbi,
    params:{ _battleId: battleId       
    }
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)
}

approveBattle = async () => {

  const web3Provider = await Moralis.enableWeb3();

  const battleId = parseInt(document.getElementById("approve_id").value);
  const enjimonId = parseInt(document.getElementById("defender_enjimon").value);

  const options = {
    contractAddress: CONTRACT_ADDRESS,
    functionName: "approveBattle",
    abi: contractAbi,
    params:{ _battleId: battleId,
             defendingEnjimon: enjimonId       
    }
  };
  
  const receipt = await Moralis.executeFunction(options);
  console.log(receipt)
}

testUser = async() => {


  
  const params = Moralis.User;
  const battle = await Moralis.Cloud.run("cancelbattle", params);


  console.log(battle);
}


//Handlers, toggles, and helpers
function displayApusItems(){
  $('#appManager').toggle();

  $('#itemManager').hide();
  $('#usersItems').hide();
  $('#usersEnjimon').hide();
  $('#apusLab').hide();
  $('#mintEnjimon').hide();
  $('#trainerShop').hide();
  $('#battleArena').hide();

}
function displayApusEnjimon(){
  $('#itemManager').toggle();

  $('#appManager').hide();
  $('#usersItems').hide();
  $('#usersEnjimon').hide();
  $('#apusLab').hide();
  $('#mintEnjimon').hide();
  $('#trainerShop').hide();
  $('#battleArena').hide();
}
function displayUsersItems(){
  $('#usersItems').toggle();

  $('#appManager').hide();
  $('#itemManager').hide();
  $('#usersEnjimon').hide();
  $('#apusLab').hide();
  $('#mintEnjimon').hide();
  $('#trainerShop').hide();
  $('#battleArena').hide();
}
function displayUsersEnjimon(){
  $('#usersEnjimon').toggle();

  $('#appManager').hide();
  $('#itemManager').hide();
  $('#usersItems').hide();
  $('#apusLab').hide();
  $('#mintEnjimon').hide();
  $('#trainerShop').hide();
  $('#battleArena').hide();
}
function displayApusLabs(){
  $('#apusLab').toggle();

  $('#trainerShop').hide();
  $('#appManager').hide();
  $('#itemManager').hide();
  $('#usersItems').hide();
  $('#usersEnjimon').hide();
  $('#mintEnjimon').hide();
  $('#battleArena').hide();
  
}
function displayTrainerShop(){
  $('#trainerShop').toggle();

  $('#appManager').hide();
  $('#itemManager').hide();
  $('#usersItems').hide();
  $('#usersEnjimon').hide();
  $('#mintEnjimon').hide();
  $('#apusLab').hide();
  $('#battleArena').hide();

}

function displayBattleArena(){
  $('#battleArena').toggle();

  $('#appManager').hide();
  $('#itemManager').hide();
  $('#usersItems').hide();
  $('#usersEnjimon').hide();
  $('#mintEnjimon').hide();
  $('#apusLab').hide();
  $('#trainerShop').hide();

}

displayMintEnjimon = async() =>{
  let user = await Moralis.User.current();
  const admin = user.get('ethAddress');

  if(admin == ADMIN){
    $('#mintEnjimon').toggle();

    $('#appManager').hide();
    $('#itemManager').hide();
    $('#usersItems').hide();
    $('#usersEnjimon').hide();
    $('#apusLab').hide();
    $('#trainerShop').hide();
    $('#battleArena').hide();

  }else{
    alert("Admin Only");
  }

}



document.getElementById("btn-login").onclick = login;
document.getElementById("btn-logout").onclick = logOut;
document.getElementById("apusItems").onclick = displayApusItems; //just items
document.getElementById("apusEnjimon").onclick = displayApusEnjimon;
document.getElementById("ownedItems").onclick = displayUsersItems;
document.getElementById("myEnjimon").onclick = displayUsersEnjimon;
document.getElementById("apusHome").onclick = displayApusLabs;
document.getElementById("mint").onclick = displayMintEnjimon;
document.getElementById("submit_mintMonster").onclick = mintMonster;
document.getElementById("TrainerShop").onclick = displayTrainerShop;
document.getElementById("uujiBuy").onclick = buyUuji; 
document.getElementById("hpBuy").onclick = buyHP; 
document.getElementById("elixerBuy").onclick = buyElixer; 
document.getElementById("walleBuy").onclick = buyWalle; 
document.getElementById("reviveBuy").onclick = buyRevive; 
document.getElementById("BattleArena").onclick = displayBattleArena; 
document.getElementById("pendings").onclick = battlesPending;
document.getElementById("battleSubmit").onclick = requestBattle;
document.getElementById("cancel_battle").onclick = CancelBattle;
document.getElementById("approvalSubmit").onclick = approveBattle;
$(document).ready(function(){
    
  init();

  battleReq();

});

You can close this thank you. The error is being called with metamask and coin base wallet extension in chrome. Removing the coin base extension resolved the issue.