For some reason this works as expected:
const metadatasExternal = await Promise.all(
NFTs.map(n => axios.get(n.metadataOnchain?.data.uri!))
)
But this doesn't:
const metadatasExternal = await Promise.all(
NFTs.map(n => ({
metadataPDA: n.metadataPDA,
metadataExternal: axios.get(n.metadataOnchain?.data.uri!),
}))
)
Specifically the promises aren't being resolved. This is what I get back:
{
metadataPDA: PublicKey {}
metadataExternal: Promise { <pending> }
},
Why is that? And how do I fix it? I specifically need to include the metadataPDA key in each promise, otherwise I can't match them to another data structure in the code.