0

I'm making this asynchronous call to get data from a server.

const NFTMetaHashes = tokenIds.map(async (id: any) => {
    const NFTHash = await contract.nftEngine.methods.tokenURI(id).call();
    console.log('hash', NFTHash);
    return NFTHash;      
});
console.log('hashes', NFTMetaHashes);

When i log NFTHash it gives me the desired string value. But the NFTMetaHashes gives me this output -

hashes (12) [Promise, Promise, Promise, Promise, Promise, Promise, Promise, Promise, Promise, Promise, Promise, Promise]

How do I resolve this Promise to get an array of NFTHash?

vaibhav deep
  • 403
  • 4
  • 14

0 Answers0