You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code for getting the owners of an NFT collection at a specific block height always returns the same list, presumably the owners at the latest block, even if I input a block height before the contract existed.
How to reproduce:
importdotenvfrom'dotenv';import{Alchemy,Network}from"alchemy-sdk";dotenv.config();constconfig={apiKey: process.env.ALCHEMY_KEY,network: Network.ETH_MAINNET,};constalchemy=newAlchemy(config);constmain=async()=>{// BAYC contract addressconstaddress="0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D";// Block number or heightconstblock="1";// Get owners constowners=awaitalchemy.nft.getOwnersForContract(address,{block: block});console.log(owners);};construnMain=async()=>{try{awaitmain();process.exit(0);}catch(error){console.log(error);process.exit(1);}};runMain();
Also important to note that the documentation seems outdated, because it is calling getOwnersForContract with arguments that do not match the function signature: const owners = await alchemy.nft.getOwnersForContract(address, false, block);
Thankfully, the endpoint at ${baseURL}/getOwnersForCollection/?contractAddress=${address}&block=${block} seems to work correctly and gives varying lists of owners depending on the block I try.
The text was updated successfully, but these errors were encountered:
I have followed all functions calls and arrived at sendAxiosRequest, and to my surprise Alchemy's SDK was using API v3.
Below is the configuration to the axios request (edited the source to add a console log).
This will ignore the params because the block param was removed in V3. This is why my fetch directly on the URL, using v2, worked. So the SDK's docs are still about V2 but the calls are done on V3, or am I confused?
[REQUIRED] Environment
[REQUIRED] Describe the problem
Code for getting the owners of an NFT collection at a specific block height always returns the same list, presumably the owners at the latest block, even if I input a block height before the contract existed.
How to reproduce:
Also important to note that the documentation seems outdated, because it is calling getOwnersForContract with arguments that do not match the function signature:
const owners = await alchemy.nft.getOwnersForContract(address, false, block);
Thankfully, the endpoint at ${baseURL}/getOwnersForCollection/?contractAddress=${address}&block=${block} seems to work correctly and gives varying lists of owners depending on the block I try.
The text was updated successfully, but these errors were encountered: