Aptos Creature On TradePort Aptos NFT Marketplace

How to Track NFT Marketplace Sales on the Aptos Blockchain

Jacob HoekertJacob Hoekert
Mar 10, 2023|3 min read

As an NFT collector on Aptos Network, I was fascinated by the free mint that Aptos Creature pulled off yesterday. The discord community had SALES bots firing off for ALL markets even before Topaz had the metadata scraped.

How? indexer.xyz

If you're curious about how they did it and want to track NFT sales on Aptos Network, you've come to the right place! In this tutorial, I'll guide you through building a GraphQL query using the indexer.xyz interface that will allow you to track sales of NFTs on Aptos Network.

Prerequisites

To follow along with this tutorial, you'll need to have a basic understanding of GraphQL and the indexer.xyz interface. If you're new to GraphQL, check out this resource to learn the basics.

Building the Query

Let's start by breaking down the query that we'll be building.

query MyQuery {
  aptos {
    action(
      where: {
        action: {_eq: "list"},
        collection: {slug: {_eq: "aptos-creature-d8ea7549"}}
      }
    ) {
      usd_price
      tx_id
      buyer
      block_time
      list_price
      nft_meta {
        image
        name
        token_id
      }
    }
  }
}

This query is designed to retrieve information about all NFT sales on Aptos Network across all marketplaces for the aptos-creature-d8ea7549 collection.

Query Breakdown

Here's a breakdown of the different parts of the query:

  • query MyQuery: This is the name of the query we're running.
  • aptos: This is the root query for the Aptos Network data.
  • action: This is the sub-query that will return the sales data.
  • where: This is a filter for the action query. Here, we're filtering by:
  • action: {_eq: "list"}: This filters the results to only include sales where the action was a listing (as opposed to a purchase, for example).
  • collection: {slug: {_eq: "aptos-creature-d8ea7549"}}: This filters the results to only include NFTs from the aptos-creature-d8ea7549 collection.
  • usd_price, tx_id, buyer, block_time, list_price: These are the specific fields that we're requesting information for. In this case, we're asking for the USD price of the sale, the transaction ID, the buyer's address, the block time of the sale, and the list price of the NFT.
  • nft_meta: This is a sub-query that will return metadata about the NFT being sold.
  • image, name, token_id: These are the specific fields that we're requesting information for from the nft_meta sub-query. In this case, we're asking for the image, name, and token ID of the NFT.

Customizing the Query

To customize this query to track NFT sales for a different collection on Aptos Network, you'll need to update the collection field within the where clause. Simply replace aptos-creature-d8ea7549 with the slug of the collection you're interested in.

Running the Query

Now that we have our query built, let's run it using the indexer.xyz interface.

  • Navigate to the indexer.xyz website.
  • In the top right corner of the page, click the "API Explorer" button to open the query editor.
  • In the query editor, paste the query we just built.
  • Click the "play" button in the top left corner of the editor to run the query.

Once the query has run, you'll see a JSON response with the sales data for the NFTs listed in the collection you specified.

Conclusion

Using the indexer.xyz interface, we can easily track NFT sales on Aptos Network by building a customized GraphQL query. By filtering the results using the where clause and specifying which fields we want to retrieve, we can get detailed information about NFT sales in a specific collection.

With this knowledge, you can now track NFT sales on Aptos Network for any collection you're interested in! Happy collecting!