Skip to content

How can I get all objects owned by an address? #10

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

You must be logged in to vote

There's is an object table current_objects in lab hosted indexer, you can play with it on hasura.

Sample query

query MyQuery {
  current_objects(
    where: {owner_address: {_eq: "0x7aade3ee4d7fa7c56e1cb04cdf3387602ad887196a4d1b9cf78bde293b8e8e7a"}}
  ) {
    state_key_hash
    owner_address
    object_address
    last_transaction_version
    last_guid_creation_num
    allow_ungated_transfer
    is_deleted
  }
}

We don't have an API in ts sdk to query objects table, but you can use call the queryIndexer API and pass the graphql manually.

const objects = await aptos.queryIndexer({
  query: {
    query: `
      query MyQuery($ownerAddress: String) {
        current_objects(
          where:…

Replies: 3 comments

Comment options

0xaptosj
Feb 27, 2024
Maintainer Author

You must be logged in to vote
0 replies
Comment options

0xaptosj
Feb 27, 2024
Maintainer Author

You must be logged in to vote
0 replies
Comment options

0xaptosj
Mar 7, 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
object Questions related to Objects indexer Questions related to indexers
1 participant