Query Examples
Last updated
Last updated
The Graph uses the GraphQL language to query the subgraphs. This doc will teach you how to query the Secured Finance Subgraphs by writing the GraphQL queries. You can copy and paste these queries into the .
Ensure that all address values (used for id) are in lowercase format.
Be aware of the units for each asset while querying. These fields will be returned in the decimals of the asset itself(e.g., 10^18 for Ether, 10^6 for USDC).
Each results page defaults to returning 100 entries. If needed, you can increase this limit to a maximum of 1000 entries per page by passing the first
parameter.
To query for groups of entities in the middle of a collection, use the skip
parameter in conjunction with the first
parameter to skip a specified number of entities starting at the beginning of the collection.
For large datasets, consider optimising queries by fetching only the necessary fields and using pagination effectively.
Use the orderBy
parameter to sort by a specific attribute and the orderDirection
for ascending (asc
) or descending(desc
) direction.
Use the where
parameter to filter for specific properties.
When a user places an order on our protocol, it is stored in the Order entity. You can check the order entity .
You can also add nested filtering in the queries. The below query will fetch the users and their orders list where orderId is 1.
When a user deposits or withdraws assets, it is stored in the Transfer entity. You can check the Transfer entity .
When a user is liquidated, it is stored in the Liquidation entity. You can check the Liquidation entity .
When a user takes an order or its order is taken, it is stored in the Transaction entity. You can check the Transaction entity .
All users' information for their orders, transactions, transfers, liquidations etc. are stored in the User entity. You can check the User entity .