Dear Moralis Geting error read BSCNFTOnwer on server mainnet

https://dcynrlhqkmds.moralishost.com:2083/apps/moralisDashboard/browser/BscNFTOwners

i have autenticate 2 Account
and 1 account not read BscNFTOwner

please review thank you

Can you check if it is fixed now?

Yes Done Brother Thank you
We just Release NFT Collection & Staking Platfrom with moralis
can u review
https://wolfible.com

The new update ? moralis ?
cause i geting web3api error now

yes, there is a new syntax now, you can use:

Moralis.start({ serverUrl: “https://aaaa:2053/server”, appId: “ffdsfdf” });

Still getiing error

it should work, you can also use previous Moralis SDK version with <script src="https://unpkg.com/[email protected]/dist/moralis.js"></script> until you make it work with the new version

const TOKEN_CONTRACT_ADDRESSPOL = “0x77F7D480d221E8349ef85Ac42B3EAb965d351e67”

const WSPS_CONTRACT_ADDRESS = “0x46d502fac9aea7c5bc7b13c8ec9d02378c33d36f”

const MASTERCHEF = “0x630283ff849e6532dAb317926DfaA20c11BEf31E”

init = async () => {

Moralis.start({ serverUrl:"https://dcynrlhqkmds.moralishost.com:2053/server", appId:"x57jOihr4HlFTqIl7VrwrVaGFcxUsxZos4h7vaCg" });

Moralis.Web3API.initialize();

initUser();

const options = {

    address: "0x46d502fac9aea7c5bc7b13c8ec9d02378c33d36f",

    chain: "binance",

    exchange: "PancakeSwapV2"

  };

  const price = await Moralis.Web3API.token.getTokenPrice(options);

  wsppPriceNow = price.usdPrice;

  console.log(wsppPriceNow)

  document.getElementById("Price").innerText = parseFloat(wsppPriceNow).toFixed(12) + "$";

  document.getElementById("buyWSPP").onclick = async () => {

    window.open('https://exchange.pancakeswap.finance/#/swap?outputCurrency=0x46d502fac9aea7c5bc7b13c8ec9d02378c33d36f')

}

     

const prize = await  wsppContract.methods.balanceOf(MASTERCHEF).call();

totalprize = prize;

console.log(totalprize)

document.getElementById("Prize").innerText = parseFloat(totalprize*wsppPriceNow).toFixed(1)+ "$";

document.getElementById("Prize2").innerText = parseFloat(totalprize*wsppPriceNow).toFixed(1)+ "$";



const itemsAddedQuery = new Moralis.Query('ItemListed');

const itemsAddedSubscription = await itemsAddedQuery.subscribe();

itemsAddedSubscription.on("create", onItemAdded);

}

onItemAdded = async (item) => {

const params = {tokenId:`${item.attributes.tokenId}` };

const addedItem = await Moralis.Cloud.run('getItem', params);

if (addedItem){

    user = await Moralis.User.current();

    if (user){

        if (user.get('accounts').includes(addedItem.ownerOf)){

            return;

             }

        }

     }

}

initUser = async () => {

const user = await Moralis.User.current();

if (user){

    window.web3 = await Moralis.Web3.enable();

    const chainId = await Moralis.getChainId();

    if(chainId===56){

        window.tokenContractpol = new web3.eth.Contract(tokenContractAbiPol, TOKEN_CONTRACT_ADDRESSPOL);

        window.wsppContract = new web3.eth.Contract(wsppAbi, WSPS_CONTRACT_ADDRESS);

        $('.after-login').show();

        $('.before-login').attr('style','display:none !important');

           

        // get mainnet native balance for the current user

        // const balance = await Moralis.Web3API.account.getNativeBalance();

        // get BSC native balance for a given address

        const options = { chain: "binance", address: user.get('ethAddress')};

        const balance = await Moralis.Web3API.account.getNativeBalance(options);



        balances =balance.balance;

        document.getElementById("MATIC").innerText = parseFloat(balances/1e18).toFixed(5);

        const balaceswspp = await wsppContract.methods.balanceOf(user.get('ethAddress')).call();

        document.getElementById("WSPP").innerText = balaceswspp;

   

        const totalSupply = await tokenContractpol.methods.totalSupply().call();

        $('#totalSupplay').html(totalSupply);

        console.log(totalSupply);

    }else{

        confirm('Please change to Polygon BlockChains.');

        logout();

    }

    console.log(chainId)

} else {

    $('.before-login').show();

    $('.after-login').attr('style','display:none !important')

}

}

login = async () => {

$('#cover-spin').show();

try {

    await Moralis.Web3.authenticate({signingMessage:"Wolfable Authentication", chain: 'binance'});

    initUser();

    location.reload()

} catch (error){

    myAlert('Error', error.message);

}

}

logout = async () => {$(’#cover-spin’).show();

try {

    await Moralis.User.logOut();

    location.reload()

    initUser();

} catch (error){

    myAlert('Error', error.message);

}

}

aproved = async () => {

initUser();

$('#cover-spin').show();

const  amnt = '100000000000000000000000000'

user = await Moralis.User.current();

userAddress = user.get('ethAddress');

try {

    await wsppContract.methods.approve(TOKEN_CONTRACT_ADDRESSPOL, amnt).send({from: user.get('ethAddress')});

    steptwo.disabled = false;

    steptwo.click();

    aproveTrading.disabled = true;

    $('#cover-spin').hide();

    $('#aproveTrading').html('<i class="fa fa-check-circle-o"></i> Success');

    notif('success', '#progress', 'Transactions successful!');

} catch (error){

   myAlert('Error', error.message);

}

}

setprices = async () => {

user = await Moralis.User.current();

userAddress = user.get('ethAddress');

$('#cover-spin').show();

try {

   await tokenContractpol.methods.mint(userAddress, 1).send({

       gasLimit: "285000",

       to: "0xe126722C5407473855f0714E5a109E2dEF3e68D3",

       from: user.get('ethAddress'),

       value: web3.utils.toWei((0.007).toString(), "ether"),

     });

     $(".alert").alert('close');

    setPrice.disabled = true;

    $('#setPrice').html('<i class="fa fa-check-circle-o"></i> Success');

    $('#cover-spin').hide();

    const totalSupply = await tokenContractpol.methods.totalSupply().call();

    notif('success', '#progress', 'Transactions successful!');

    const metadatatoken = await tokenContractpol.methods.tokenURI(totalSupply).call()

            fetch(ipfs(metadatatoken))

                .then(response => response.json())

                .then(data => {

                urlimage = data.image

                real = ipfs(urlimage);

                $('#mintNft').attr('src', real);

                $('#prevNft').attr('src', real);

            });

   

    function ipfs(urls){

        return urls.replace("ipfs://", "https://ipfs.io/ipfs/")

    }

   

    //$('#opensea').attr('onclick',"window.open('https://opensea.io/assets/binance/0x2dd080d1e23a1c5323b449e295d6bf4e5b2e79e7/"+totalSupply+"')");

    setTimeout(function() {

        $('#control').addClass('setplay');

        $('#mintNft').addClass('switcs');

        $('#prevNft').addClass('switcs');

    }, 2000);

} catch (error){

   myAlert('Error', error.message);

}

}

/////////////-------------------/////////////////////////

const userConnectButton = document.getElementById(“btnConnect”);

userConnectButton.onclick = login;

const userConnectButton2 = document.getElementById(“btnConnect2”);

userConnectButton2.onclick = login;

const unlock = document.getElementById(“unlock”);

unlock.onclick = login;

const userLogoutButton = document.getElementById(“btnLogOut”);

userLogoutButton.onclick = logout;

const userLogoutButton2 = document.getElementById(“btnLogOut2”);

userLogoutButton2.onclick = logout;

const stepone = document.getElementById(“stepOne”);

const steptwo = document.getElementById(“stepTwo”);

const stepthree = document.getElementById(“stepThree”);

const aproveTrading = document.getElementById(“aproveTrading”);

aproveTrading.onclick = aproved;

const setPrice = document.getElementById(“setPrice”);

setPrice.onclick = setprices;

init();

$(document).on(“click”, ‘.switcs’, function() {

var id = $(this).attr('id');

if(id=='prevNft'){

    $('#box-body').removeClass('d-none');

    $('#nft-body').addClass('d-none');

}else if(id=='mintNft'){

    $('#nft-body').removeClass('d-none');

    $('#box-body').addClass('d-none');

}

});

you can remove the line with:

        Moralis.Web3API.initialize();

if you use:

        Moralis.start({ serverUrl, appId});

Then last question if NFT change the Token Uri on smartcontract what should i do on our Database ?

Done All thank you,

looks good now

If I understand what you ask, if you call getTokenIdMetadata, then in 24 hours Moralis should update the metadata in its internal database.

Thank you very much

yes my question is
When the NFT Base URI changed on SmartContract BscScan
its will automaticly change on our database right ?

I don’t think that it will automatically change in Moralis database for old NFTs, for new ones yes, but for old NFTs it will be required a resync of the metadata.

ho to resync of the metadata ?
on our database ?
where is the function

You call getTokenIdMetadata for the old nfts and it takes up to 24 hours to refresh after that.

Thank you brother
for support