Given for example this transaction, is there a way of getting exactly what ERC721 tokens have been transferred by it?

To clarify, it would be this detail here:

enter image description here

Is it possible to get this information using ethers or Web3 via the txHash?

2 Answers 2

const { ethers } = require("ethers");

const txHash = "0xabcdef123456...";
const provider = new ethers.providers.JsonRpcProvider("YOUR_INFURA_ENDPOINT");

(async () => {
    const txReceipt = await provider.getTransactionReceipt(txHash);
    const abi = [ /* ERC721 ABI */ ];
    const iface = new ethers.utils.Interface(abi);

    txReceipt.logs.forEach(log => {
        const parsedLog = iface.parseLog(log);
        if (parsedLog.name === "Transfer") {
            console.log(`ERC721 token ${parsedLog.values.tokenId} transferred from ${parsedLog.values.from} to ${parsedLog.values.to}`);

Get a list of 'ERC-721 Token Transfer Events' by Address Returns the list of ERC-721 ( NFT ) tokens transferred by an address, with optional filtering by token contract.


Usage: ERC-721 transfers from an address, specify the address parameter ERC-721 transfers from a contract address, specify the contract address parameter ERC-721 transfers from an address filtered by a token contract, specify both address and contract address parameters.

  • As I said, I have the txHash and I want to know what ERC721 were transferred by that transaction, not what ERC721 were transferred by an address (in this case, the address that transferred the tokens is the null address - if I get all the transfers by that address I will just have all the mints that took place and I don't want that). Feb 12 at 23:57
  • ok i understand Feb 15 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.