Skip to content

How to get NFTs owned by an account #19

Answered by 0xaptosj
0xaptosj asked this question in Questions
Discussion options

You must be logged in to vote

You need to query indexer to get this kind of data, Aptos labs hosted a public indexer, ts-sdk has a bunch of built-in functions to query indexer on NFT data.

To get all NFTs by owner from a collection, you can run

  const result = await aptos.getAccountOwnedTokensFromCollectionAddress({
    accountAddress: ownerAddr,
    collectionAddress: COLLECTION_ID,
  });

If there's no built-in function in ts-sdk to do what you need, you can also write graphql by hand and query it with ts-sdk, you can find all available queries on hasura.

Replies: 1 comment

Comment options

0xaptosj
Mar 6, 2024
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by 0xaptosj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
indexer Questions related to indexers nft Questions related to NFTs and digital asset / token standards
1 participant