You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The easiest way to get all of the tokens for an account is to use the provided Hasura indexer, specifically the current_token_ownerships and current_token_ownerships_v2 queries. Here's an example of how you would get all the current token ownerships for a given account.
TS SDK
The TS SDK provides an implementation that queries Aptos' Hasura Indexer mentioned above for token ownerships. See this github link for more information.
Indexer Example
To make it easier to see the query inputs and response, I've created an Indexer example below.
This current_token_ownerships query specifies that I would like to include the amount, name, current_token_data and token_properties in the response. See this hasura link for more info on this example
indexerQuestions related to indexersnftQuestions related to NFTs and digital asset / token standards
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Solution
Indexer
The easiest way to get all of the tokens for an account is to use the provided Hasura indexer, specifically the
current_token_ownerships
andcurrent_token_ownerships_v2
queries. Here's an example of how you would get all the current token ownerships for a given account.TS SDK
The TS SDK provides an implementation that queries Aptos' Hasura Indexer mentioned above for token ownerships. See this github link for more information.
Indexer Example
To make it easier to see the query inputs and response, I've created an Indexer example below.
This
current_token_ownerships
query specifies that I would like to include theamount
,name
,current_token_data
andtoken_properties
in the response. See this hasura link for more info on this exampleHere is an example of the response
To learn more about the different token types available on Aptos, see the docs on Token V1 and the Aptos Digital Asset Standard
Beta Was this translation helpful? Give feedback.
All reactions