Bad data returned, with NFT Owners (queued)

I’m trying to get the owners of this asset:
0x8297d8e55C27AA6CE2d8a65b1Fa3Debb02410efC
with the token id 3

Problem is that I get bad data, I’m getting over 1k owners - this contract and token have only 261 owners. Everytime I request this data, this value keeps on increasing and a lot of the owners are still missing.

Not sure if this has anything to do with it but it does say “status”:“QUEUED” at the end.

I’m using this to get the data:


curl -X 'GET' \
				 'https://deep-index.moralis.io/api/v2/nft/0x8297d8e55C27AA6CE2d8a65b1Fa3Debb02410efC/3/owners?chain=eth&format=decimal' \
				 -H 'accept: application/json' \
				 -H 'X-API-Key: aPiKeYGoEshErE'
1 Like

I get only 204 owners when using pagination for that endpoint that you pasted

same as what etherscan says for that particular token id:
https://etherscan.io/token/0x8297d8e55C27AA6CE2d8a65b1Fa3Debb02410efC?a=3#inventory

Yeah I think I’m doing something very wrong, what are you doing to get 204 owners?

iterate by using pagination

This is what I’m doing - does this seem to be correct usage of pagination to you?

do {
			let response = null;
			while (response == null) {
					options = {
						address: ContractAddress,
						token_id: TokenId,
						chain: "eth",
						limit: 100,
						cursor: cursor,
					};

				try {
					console.log("Getting with", options);
					response = await Moralis.Web3API.token.getNFTOwners(options);
				} catch (err) {
					console.log(err);
				}
			}
			//Compiles a list of the owners
			for (const owner of response.result) {
				let CurrentAddress = owner.owner_of.toLowerCase();
				ownersList.push(CurrentAddress);
			}

			cursor = response.cursor;
} while (cursor != "" && cursor != null);

something has to be wrong, I don’t know exactly what, you can try to add more debugging

Yeah you’re right - it wasn’t with anything to do with this, it was elsewhere. Apologies.

1 Like