Discussions

Ask a Question
ANSWERED

getCoreAssetTransfers not returning any transfer history for my NFTs

I set up a couple of functions that should look through the transfer history of an address and then return the transfer history as far as I can tell from the docs. I cycle through the pages as needed with a helper function. I've tried this on a number of my NFTs and they are all returning an empty transfer history. Did I set these up wrong or something? The address that I am currently searching a transaction history for is 0x8e6e63e05fffc220f808674e6ce14c82799d9f84 and the id is 6074. This set of functions returns an empty array however. ``` const getTokenResponse = async (token, contractAddress, currentNftId, pageKey=null) => { const address = [contractAddress]; if (pageKey !== null) { const response = await alchemy.core.getAssetTransfers({ fromBlock: "0x0", contractAddresses: address, category: [token.tokenType.toLowerCase()], excludeZeroValue: false, pageKey: pageKey }); return response; } else { const response = await alchemy.core.getAssetTransfers({ fromBlock: "0x0", contractAddresses: address, category: [token.tokenType.toLowerCase()], excludeZeroValue: false, }); return response; } } export const getNFTTransferHistory = async (token, contractAddress, currentNftId) => { const address = [contractAddress]; let nftTxnHistoryItems = []; let continueSearching = true; let currentResponse = {} while (continueSearching) { if ('pageKey' in currentResponse && currentResponse['pageKey']) { currentResponse = await getTokenResponse(token, contractAddress, currentNftId, currentResponse['pageKey']); } else { currentResponse = await getTokenResponse(token, contractAddress, currentNftId); } if (!('pageKey' in currentResponse && currentResponse['pageKey'])) { continueSearching = false; } let txns = currentResponse.transfers.filter( (txn) => { token.tokenType.toLowerCase() === "erc721" ? fromHex(txn.erc721TokenId) : txn.erc1155Metadata[0].tokenId === nftId } ) if (txns.length > 0) { for (let i = 0; i < txns.length; i++) { nftTxnHistoryItems.push(txns[i]); } } } return nftTxnHistoryItems; } ```