Good day all. Since introducing getalltokenIds (rinkeby) to my frontend, my project has gotten a lot slower… Not really sure if this is due to it still being on a dev environment, whether I need to upgrade my server or whether I need to find a way to store the results of the calls to speed things up… It seems my cpu on moralis server is relatively low so I am unsure as to how to go about this
How are you making those calls? You could make them without needing a Moralis server if you are doing them server side.
This is how I am making the call
const {isInitialized, Moralis, account,isWeb3Enabled, enableWeb3} = useMoralis()
const router=useRouter()
const id = router.query.id
console.log(account)
const fetchContract = async()=>{
const options = {
chain: "rinkeby",
address: id,
};
const nfts = await Moralis.Web3API.token.getAllTokenIds(options);
let nftBalance = nfts.result;
console.log(nftBalance);
setNftBalances(nftBalance)
}
useEffect(() => {
if (isInitialized && isWeb3Enabled) {
fetchContract()
}
else{
enableWeb3()
}
}, [isInitialized] && isWeb3Enabled)
Not sure I follow… Would appreciate any resources you may have where I can read up on your answer - thanks
You could add some timestamp to console.log to identify what is the slow part. You can also look in network tab to see if that api call is really slow.
1 Like