NFTs
Here are some examples of common queries related to NFTs using the NFT Data API.
NFT Info
query fetchNftInfo($collectionId: uuid!, $tokenId: String!) {
sui {
nfts(
where: {
collection_id: { _eq: $collectionId }
token_id: { _eq: $tokenId }
}
) {
name
token_id
media_type
media_url
ranking
collection_id
version
owner
burned
chain_state
properties
staked
staked_owner
}
}
}
NFT Listings
query fetchNftListings($collectionId: uuid!, $tokenId: String!) {
sui {
nfts(
where: {
collection_id: { _eq: $collectionId }
token_id: { _eq: $tokenId }
}
) {
name
token_id
listings(where: { listed: { _eq: true } }, order_by: { price: asc }) {
id
listed
price
market_name
seller
block_time
}
}
}
}
NFT Transaction History
query fetchNftTransactionHistory(
$collectionId: uuid!
$tokenId: String!
$actionTypes: [action_type!]
$offset: Int
$limit: Int!
) {
sui {
actions(
where: {
collection_id: { _eq: $collectionId }
nft: { token_id: { _eq: $tokenId } }
type: { _in: $actionTypes }
}
order_by: [{ block_time: desc }, { tx_index: desc }]
offset: $offset
limit: $limit
) {
id
type
price
sender
receiver
tx_id
block_time
market_name
}
}
}
NFT Bids
query fetchNftBids($collectionId: uuid!, $tokenId: String!) {
sui {
nfts(
where: {
collection_id: { _eq: $collectionId }
token_id: { _eq: $tokenId }
}
) {
bids(
where: { status: { _eq: "active" } }
order_by: { price: desc }
) {
id
price
created_tx_id
bidder
receiver
remaining_count
status
market_contract {
name
}
}
}
}
}
NFT Attributes
query fetchNftAttributes($collectionId: uuid!, $tokenId: String!) {
sui {
nfts(
where: {
collection_id: { _eq: $collectionId }
token_id: { _eq: $tokenId }
}
) {
attributes {
type
value
rarity
}
}
}
}