I was fetching NFTs from certain contract for connected wallet using alchemy-sdk
, and it was working fine, NFTs were retrieved and displayed on the frontend app.
But unfortunately this solution stopped working and I can't tell even from when.
This is my alchemy
instance declared inside of a class
and its settings:
const settings = {
apiKey: process.env.POLYGON_API_KEY,
network: Network.MATIC_MAINNET
};
alchemy: Alchemy = new Alchemy(settings);
This is my backend service function where I'm calling the alchemy-sdk
to get NFTs data:
async getAddressNfts(address: string): Promise<NFTsResponseInterface[]> {
try {
const response: OwnedNftsResponse = await this.alchemy.nft.getNftsForOwner(address, {
contractAddresses: [collectionPolygonAddress]
});
const nftsResponse: NFTsResponseInterface[] = response.ownedNfts.map((item) => ({
tokenId: item.tokenId,
image: item.rawMetadata.image
}));
return nftsResponse;
} catch (error) {
console.log(error);
return [];
}
}
And error that I'm getting is saying that I exceeded requests capacity. But I did not.
Alchemy dashboard is showing barely 30 requests (with automatic retries) after couple of tries:
I also tried creating new api key, but with no luck.
I tried as well different settings, without specified api key, requesting to Alchemy default RPC, but it was throwing the same errors.
And just in case this is how I'm requesting to the backend for NFTs:
const getNftsData = async () => {
try {
const { data } = await getNfts(connectedAccount);
setAccountNFTs(data);
} catch (error) {
toast.error("Problem fetching your Crooked Snouts", { theme: "colored" });
}
}
useEffect(() => {
if(connectedAccount) {
getNftsData();
}
}, [connectedAccount]);
Somebody can help with that? Or check if your applications with alchemy-sdk
are working properly?\ Unfortunatelly on Alchemy discord nobody responds.