Building Queries
Send your first graphQL query and get ready to be blown away
We will take the example of the spl-governance program and build graphQL queries to fetch data, instead of the usual getProgramAccounts() call.
Use our GraphQL demo project to easily get started and try out these queries in code.
#Get all proposalsV2 accounts
Note how we have included all the data fields that are available to us, you can cherry pick fields that are useful to you. For example if you only want names and addresses of the proposals. The the query becomes like
By default the API will return 1000 accounts data in response. You can control how many accounts you need by specifying limit. The query becomes like below.
Ideally there would be thousands of accounts in a program, so lets see how can we paginate and get more responses.
Last updated