getNFTs with contractAddresses filter does not work
outdoteth opened this issue · 3 comments
It fails to filter out the other addresses. For example on Ropsten:
const nfts = await alchemy.getNfts({
owner: "0xc9a6EC4aE16AD5A1B75Cf8f111FBD69eC3788774",
contractAddresses: ["0x18e132bE028b77e6bb9bE98620bB335005077907"],
});
console.log("nfts", nfts);
Response includes addresses other than "0x18e132bE028b77e6bb9bE98620bB335005077907":
On closer inspection of the network tab, the library is sending the following params:
/v1/getNFTs/?owner=0xc9a6EC4aE16AD5A1B75Cf8f111FBD69eC3788774&contractAddresses=0x18e132bE028b77e6bb9bE98620bB335005077907
But this differs from the example in the documentation which says it should be:
/v1/getNFTs/?owner=0xc9a6EC4aE16AD5A1B75Cf8f111FBD69eC3788774&contractAddresses[]=0x18e132bE028b77e6bb9bE98620bB335005077907
(Note the additional []
after contractAddresses).
After using the format in the documentation, I get the expected result:
Hmm, so I haven't confirmed this but I suspect this issue was introduced in this PR:
#82
See this issue here: medialize/URI.js#3
If I change it to be this then it works:
const nfts = await alchemy.getNfts({
owner: "0xc9a6EC4aE16AD5A1B75Cf8f111FBD69eC3788774",
"contractAddresses[]": ["0x18e132bE028b77e6bb9bE98620bB335005077907"],
});
console.log("nfts", nfts);
Hi there, thank you for the report! I am working on a fix.
Fix published in 1.2.2. Thank you very much for the report and sorry for the trouble!