Hi there
hi need to use data from holderdata in outside nestest fetch how i can do this
fetch('https://deep-index.moralis.io/api/v2/nft/0x00000000000000000000/0/owners?chain=goerli&format=decimal&limit=100', options)
.then(response => response.json())
.then(response => {
console.log(response)
let ownerOfToken = 0;
let burnedOfToken = 0;
let HowManyHolder = response.result.length;
console.log("owner_of", response.result[2].owner_of)
console.log("How many Holder", HowManyHolder)
let holderData = [];
for (let i = 0; i < HowManyHolder; i++) {
if (response.result[i].owner_of == "0x000000000000000000000000000000000000dead" || response.result[i].owner_of == "0x0000000000000000000000000000000000000000 ") {
burnedOfToken = response.result[i].amount;
} else {
fetch('https://deep-index.moralis.io/api/v2/' + response.result[i].owner_of + '/nft?chain=goerli&format=decimal', options)
.then(response2 => response2.json())
.then(response2 => {
// console.log("from fetch 2", response2.total);
// holderData.push([response.result[i].owner_of, response2.total, "hello"]);
// console.table(holderData);
fetch('https://deep-index.moralis.io/api/v2/' + response.result[i].owner_of + '/balance?chain=goerli', options)
.then(response3 => response3.json())
.then(response3 => {
holderData.push([response.result[i].owner_of, response2.total, response3.balance]);
console.table(holderData); // i need to use this table
})
.catch(err => console.error(err));
})
.catch(err => console.error(err));
}
//holderData.push([response.result[i].owner_of]);
}
//holderData.push([0, "dddd"])
console.log("Burned", burnedOfToken);
// console.table(holderData)
})
.catch(err => console.error(err));