Query Guide
Common Queries
Query Vault Data
query getVaultData($vaultId: ID!) {
vault(id: $vaultId) {
id
totalAssets
pricePerShare
strategies {
id
name
totalDebt
totalGain
isActive
}
harvests(orderBy: timestamp, orderDirection: desc, first: 10) {
timestamp
gain
loss
}
}
}Query User Account Data
Query Strategy Performance
Developer Resources
Real-time Updates
Subscribe to real-time updates using GraphQL subscriptions:
Error Handling
The subgraph API uses the standard GraphQL error format. Common error scenarios:
Entity Not Found: Returns null for the requested entity
Invalid Query: Returns a GraphQL validation error
Network Issues: Check the
_metafield for indexing status
Example error check:
Rate Limits and Best Practices
Implement pagination for large result sets using
firstandskipparametersUse specific field selection instead of requesting all fields
Cache frequently accessed data client-side
Monitor your query complexity and response times
Consider implementing retry logic for failed queries
SDK Integration
For TypeScript/JavaScript applications, you can generate typed clients using:
GraphQL Code Generator
Apollo Codegen
URQL Codegen
Example type generation command:
Last updated