I'm having issues with the returned data from Etherscan API. I'm using two endpoints:
(1) Normal Transactions by Address
https://api.etherscan.io/api?module=account&action=txlist
(2) Erc721 Transaction by Address
https://api.etherscan.io/api?module=account&action=tokennfttx
0x0b8f4c4e7626a91460dac057eb43e0de59d5b44f
0x6b2103201b968e5ad9a26041127080c4969b10191c8ad94082980487d6fbd9aa
--> mint event
I can see this transaction when calling (2), but this endpoint doesn't deliver the value transferred. I used to get the value by calling (1) and going through the list and match the tx hashes, but it is not listed. On Etherscan you can see the mint event with a transferred value of 0.05 Eth (https://etherscan.io/tx/0x6b2103201b968e5ad9a26041127080c4969b10191c8ad94082980487d6fbd9aa). But from where is this information? How do I find the transferred value?
Now another example where this is working:
0xB2Ebc9b3a788aFB1E942eD65B59E9E49A1eE500D
0x57ece5c8b9f040f43faac83a68883a5324f2ef6d36ad0018dc6813a0c851ff74
I can see the transaction when calling (2) and also see the matching tx hash when calling (1)
Any support and hint is much appreciated!
The txlist
endpoint (docs) returns a list of native transactions sent from
and to
the specified address. But it doesn't take into account token transfers.
Several Transfer()
event logs (standardized way to signal a token transfer, mint or burn) were emitted as a result of the 0x6b... transaction, and one of them contains the 0x0b... address as one of its parameters (specifically as the token receiver).
However, the native transaction was not sent from
or to
the 0x0b...
address. That's why it's not being returned in the endpoint.
In your second example, the 0x57... native transaction was actually sent from the 0xB2... address. That's why it's included in the txlist
endpoint response.
It also contains the Transfer()
event log signaling a token mint to the very same 0xB2... address, but that's the unimportant factor. It wouldn't make a difference (related to the txlist
endpoint) if the token was transferred to any other address or not transferred at all.