Querying the Subgraph
Last updated
Was this helpful?
Last updated
Was this helpful?
The full list of Subgraph Entities cached by DAOstack subgraph can be found . You can find all of the subgraph entities .
When you query for single Entity with all/some fields, you need to provide the Entity id.
Details of Genesis DAO 0x294f999356ed03347c7a23bcbcf8d33fa41dc830
Details of Proposal 0x0025c38d987acba1f1d446d3690384327ebe06d15f1fa4171a4dc3467f8bd416
Just change the entity name to plural to query for all the entities of that type
Examples
Details of all `daos` indexed by the DAOstack subgraph
Details of all `Reputation Holders` in DAOstack DAOs
To query for a subset of Entities you can add where: {}
parameter to filter for different properties. You can filter for single or multiple properties.
Examples
To get all proposals submitted on 2019 Halloween, we can filter for the time interval on `createdAt` property
Get all `daos` with more than 200 reputation holders
Genesis DAO proposals that contains word 'Reputation' in title
Examples
Get rewards detail for all DAO where 250 GEN or more were awarded in DAO bounty
NOTE:
The suffix _contains
in the above example is used for the comparison
Some suffixes are only supported for specific types. For example, Boolean only supports _not
, _in
, and _not_in
.
Complete list of suffix is _not
_gt
_lt
_gte
_lte
_in
_not_in
_contains
_not_contains
_starts_with
_ends_with
_not_starts_with
_not_ends_with
Examples
To query for a sorted list you can add orderBy
parameter to sort by a specific property. Also, you can specify the direction of sort asc
for ascending and desc
for descending.
Sort Reputation Holders by their reputation balance
Sort DAOs by number of boosted proposals it has
Sort complex subfield array
Examples
Get all proposals from all the daos ordered by the date of submission
You can also decrease the size of set queried by specifying the pagination limit
Examples
From the beginning
Get first 3 DAOs based on highest number of reputation holders
From the middle
Get all DAOs except the first 5
Get the next 3 DAOs after the top 3