Listed NFT
Ternoa indexer is a record of the Ternoa Chain data. You can query data for some specific entities (NFT, Collection, Marketplace(...)) using graphql. In this example, we use the graphql-request library.
Step 1: nftEntity query preparation
You first need to prepare a stringified query to get NFT data from a specific marketplace id. Here are detailed the parameters available for the nftEntity
concerning the NFT listing on a marketplace:
Do not hesitate to adapt the information you require in your query. You can check all the fields queryable for the NftEntity. Replace NFT_ID with the NFT id you want to get the information from (e.g. the NFT id from the NFT previously used in "How to list for sale an NFT on a marketplace"):
Step 2: Sending the request to the Indexer
Once the query is ready, you can request our indexer by providing both the indexer endpoint and the query. To check if the NFT is listed for sale, the marketplaceId field should not be null, isListed should be true and a timestampList should be filled.
Replace NFT_ID in the following code snippet with the NFT ID previously used in "How to list for sale an NFT on a marketplace":
The getNftData
function is an asynchronous function that sends a GraphQL request using the request
function from the "graphql-request" library. The response from the server is an object with a property nftEntity that has the data of the listed NFT.
Support
If you face any trouble, feel free to reach out to our community engineers in our Discord.
Last updated