My code was working 2 weeks ago and now for some reason it is not now. I am requesting the number of holders for BRETT token on BASE NETWORK. I saw there were some outages on the base api wondering if it has anything to do with that ? Here is the code for my request please let me know if there are any errors with it ?
const fetchHoldersData = async () => {
const access_token = process.env.NEXT_PUBLIC_BIT_QUERY_API_KEY;
const url_graphql = "https://streaming.bitquery.io/graphql";
const query = `
{
EVM(dataset: archive, network: base) {
TokenHolders(
date: "${new Date().toISOString().split('T')[0]}"
tokenSmartContract: "0x532f27101965dd16442E59d40670FaF5eBB142E4"
where: { Balance: { Amount: { gt: "0" } } }
) {
uniq(of: Holder_Address)
}
}
}
`;
try {
const response = await fetch(url_graphql, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${access_token}`,
},
body: JSON.stringify({ query }),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
holdersCount = data.data.EVM.TokenHolders[0].uniq;
console.log("Holders count updated:", holdersCount);
} catch (error) {
console.error('Error fetching holders data:', error);
}
};