getassettransfers last block indexed by alchemy
Hi, I am currently using 'latest' as the toBlock parameter. How can I know which block is the last one you indexed?. I want to know this so the next time I sync with your data I will query from that block + 1 onwards.
Posted by Josue Julcarima over 1 year ago
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;
}
```
Posted by [email protected] over 1 year ago
Transactions with same hash
Why do I get transactions with same hash when I use getAssetTransfers call for a particular address ?
For example, while getting transactions for address 0xcd531ae9efcce479654c4926dec5f6209531ca7b, I get two objects with same hash value?
[
{
blockNum: '0xf8fbe2',
uniqueId: '0x41f43d9358d65230d7993c6e39c232570379e3750e06dd5f7b5b91c39364c780:log:47',
hash: '0x41f43d9358d65230d7993c6e39c232570379e3750e06dd5f7b5b91c39364c780',
from: '0xcd531ae9efcce479654c4926dec5f6209531ca7b',
to: '0xc6bd16f378127a0dda3b773ec2401ed25c0a163e',
value: 6579818.844366,
erc721TokenId: null,
erc1155Metadata: null,
tokenId: null,
asset: 'USDC',
category: 'erc20',
rawContract: {
value: '0x05fbfbc3d0ce',
address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
decimal: '0x6'
},
metadata: { blockTimestamp: '2023-01-02T06:51:11.000Z' }
},
{
blockNum: '0xf8fbe2',
uniqueId: '0x41f43d9358d65230d7993c6e39c232570379e3750e06dd5f7b5b91c39364c780:external',
hash: '0x41f43d9358d65230d7993c6e39c232570379e3750e06dd5f7b5b91c39364c780',
from: '0xcd531ae9efcce479654c4926dec5f6209531ca7b',
to: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
value: 0,
erc721TokenId: null,
erc1155Metadata: null,
tokenId: null,
asset: 'ETH',
category: 'external',
rawContract: { value: '0x0', address: null, decimal: '0x12' },
metadata: { blockTimestamp: '2023-01-02T06:51:11.000Z' }
}
]
Posted by Shailesh Shivam over 1 year ago
alchemy_getAssetTransfers transfer size is different
I fetched eth transfers using alchemy_getAssetTransfers rpc.
But size of transfer is different from the last I called the rpc
It seems result of latest block is missing when I called and I filled after a few seconds elapsed.
When can I expect the full result of the last block after Initial fetching of latest block?
Posted by brad over 1 year ago