-
Is there a query that returns me all objects owned by an address? i.e. all objects whose I run into this requirement when building an NFT marketplace, each NFT listing is stored in an object whose owner is the seller. In order to get all listings from a seller, I need this query. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@gregnazario I think you have some context? I'm looking at your marketplace example, it looks like we must use custom processor to get all listings and offers ( |
Beta Was this translation helpful? Give feedback.
-
What I actually want is a query that returns all resources (type is listing struct) from all objects owned by an address. |
Beta Was this translation helpful? Give feedback.
-
There's is an object table 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 const objects = await aptos.queryIndexer({
query: {
query: `
query MyQuery($ownerAddress: String) {
current_objects(
where: {owner_address: {_eq: $ownerAddress}}
) {
state_key_hash
owner_address
object_address
last_transaction_version
last_guid_creation_num
allow_ungated_transfer
is_deleted
}
}
`,
variables: { ownerAddress:"0x12345" },
},
}); |
Beta Was this translation helpful? Give feedback.
There's is an object table
current_objects
in lab hosted indexer, you can play with it on hasura.Sample query
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.