Hi all, recently joined the community and looking to join the academy as well.
Love your work guys. I hope somebody can help debug this.
I got carried away following Philip’s Ultimate NFT course & got stuck for 2 days at:
function fetchNFTMetadata(NFTs) {
let promises = [];
for (let i; i < NFTs.length; i++) {
let nft = NFTs[i];
let id = nft.token_id;
// Calling Moralis Cloud function for static JSON file.
promises.push(fetch("https://ojuwkzwm1af5.usemoralis.com:2053/server/functions/getNFT?_ApplicationId=zT4AIsHtDbdrZn0J90ciEjFDraFmddBz42Dxqbmw&nftId=" +id)
.then(res => res.json())
.then(res => JSON.parse(res.result))
.then(res => {nft.metadata = res})
.then( () => {return nft;}))
}
return Promise.all(promises);
}
async function initializeApp() {
let currentUser = Moralis.User.current();
if (!currentUser) {
currentUser = await Moralis.Web3.authenticate();
}
const options = { address: "0x10ce6c0a658a1ffd4c5af3996a628ad6d49715ae", chain: "BSC" };
let NFTs = await Moralis.Web3API.token.getAllTokenIds(options);
let NFTWithMetadata = await fetchNFTMetadata(NFTs.result);
console.log(NFTWithMetadata);
}
initializeApp();
All I get is a
Would anybody spare a second please?
I can manage to return unsanitised object, but I can’t manage to sanitse in order to render the data on screen.