Get all NFT TXs for a given wallet address

Hi there,

Want to use QuickNode to get all NFT related TXs [ERC-1155/ERC-721] for a given wallet address in a paginated way. I think the graphQL API may support this, but was unable to get create the proper query.

Ideally I want a solution that provides:

  • Works with Ethereum/Polygon chain NFTs. In the future likely need solution for Base/Zora too.
  • Shows all NFT related TXs for a wallet address where either
    • fromAddress is the specific wallet
    • toAddress is the specific wallet

Appreciate any assistance in advance.

1 Like

Hey Llama,

You should be able too with the graphQL API.

query Ethereum($filter: TokenEventsFilterInput) {
  ethereum {
    tokenEvents(filter: $filter) {
      edges {
        node {
          type
          transaction {
            blockNumber
            blockTimestamp
            contractAddress
            cumulativeGasUsed
            effectiveGasPrice
            fromAddress
            gas
            gasPrice
            gasUsed
            hash
            input
            maxFeePerGas
            maxPriorityFeePerGas
            toAddress
            transactionIndex
            type
            value
          }
        }
      }
    }
  }
}
"filter": {
    "toAddress": {
      "eq": "0x32135aeaB90aB298642921Fad2069d887349c823"
    }
  }
}

There is also a filter for fromAddress.

Let us know if this is what you’re looking for.

-Nick

1 Like

Gonna test it out and let you know. Looks perfect though.

1 Like

So @NickQuickNode got a second to try this out. Copy pasted directly to the playground creates query that does return TXs however the filter-ed address stuff is completely ignored or not honored. See screenshot where results toAddress is not equal to address in filter.

A couple of other tangential questions.

  1. Are addresses case insensitive for this type of query
  2. Any chance we can do “OR” logic inside the filter to get toAddress & fromAddress matches from a single query?

I did try to make this work on my own in the playground, have some pretty good experience w/GraphiQL playgrounds from my past. It seems the quicknode playground plays a little differently though haha.

1 Like

Hey Llama,

So in this case, we are returning the transaction details for transactions in which NFT transfers occurred to the specified wallet. The to address in the transaction itself is NOT what we are targeting, rather the address to which an NFT transfer occurred within the transaction.

You can look up the transaction hash in Etherscan, and view the logs tab, which is where NFT transfers appear on-chain. If this is NOT what you are trying to accomplish, please help us understand so we can potentially help make the correct query.

-Nick

Hey Nick,

I’m targeting all ERC-721/ERC-1155 related TXs where either fromAddress OR toAddress is a specific wallet address I set EX: “0x587B28da4701876bdB061Ae624739606BD1b56f6”.

QL snippet you gave doesn’t work, returns results where neither the fromAddress/toAddress are the wallet address specified in the filter.

Hey Llama,

You can try something like this. This returns transactions where the fromAddress of the transaction is the targeted address and any included token transfers within. You may edit the query to make it return the data you’re looking for.

Eg:

query Ethereum($filter: TransactionsFilterInput) {
  ethereum {
    transactions(filter: $filter) {
      edges {
        node {
          fromAddress
          toAddress
          hash
          tokenEvents {
            edges {
              node {
                blockNumber
                fromAddress
                toAddress
                type
              }
            }
          }
        }
      }
    }
  }
}`
  "filter": {
    "fromAddress": "0x32135aeaB90aB298642921Fad2069d887349c823"
  }
}

-Nick

this is great,this comunity is so huge im loving it

I am also gonna test it out… let’s check

Yeah, the queries are case insensitive. You can use “OR” logic within filters to match both toAddress and fromAddress in a single query. You can add more conditions with “OR” as you need.