Atom with Vault Details
Fetch atom data along with associated vault statistics, including total shares, current share price, market cap, and position count.
Query Structureβ
query GetAtomWithVault($atomId: String!, $curveId: numeric!) {
atom(term_id: $atomId) {
term_id
label
image
type
created_at
creator {
id
label
}
term {
vaults(where: { curve_id: { _eq: $curveId } }) {
curve_id
total_shares
total_assets
current_share_price
market_cap
position_count
}
}
}
}
Variablesβ
{
"atomId": "0x57d94c116a33bb460428eced262b7ae2ec6f865e7aceef6357cec3d034e8ea21",
"curveId": "1"
}
Interactive Examplesβ
Query
query GetAtomWithVault($atomId: String!, $curveId: numeric!) {
atom(term_id: $atomId) {
term_id
label
image
term {
vaults(where: { curve_id: { _eq: $curveId } }) {
total_shares
current_share_price
market_cap
position_count
}
}
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Use Casesβ
Display Market Dataβ
Show atom with market statistics:
const query = `
query GetAtomMarketData($atomId: String!, $curveId: numeric!) {
atom(term_id: $atomId) {
term_id
label
image
term {
vaults(where: { curve_id: { _eq: $curveId } }) {
total_shares
current_share_price
market_cap
position_count
}
}
}
}
`
Top Holders Viewβ
Fetch atom with top position holders:
const query = `
query GetAtomWithHolders($atomId: String!, $curveId: numeric!) {
atom(term_id: $atomId) {
term_id
label
term {
vaults(where: { curve_id: { _eq: $curveId } }) {
total_shares
positions(limit: 10, order_by: { shares: desc }) {
account {
id
label
image
}
shares
}
}
}
}
}
`
Vault Statisticsβ
Get comprehensive vault metrics:
const query = `
query GetVaultStats($atomId: String!, $curveId: numeric!) {
atom(term_id: $atomId) {
term_id
label
term {
vaults(where: { curve_id: { _eq: $curveId } }) {
total_shares
total_assets
current_share_price
market_cap
position_count
positions_aggregate {
aggregate {
count
sum { shares }
avg { shares }
}
}
}
}
}
}
`
Performance Considerationsβ
- Filter by curve_id: Always specify curve ID to get specific vault
- Limit positions: Use limit when fetching nested positions
- Use aggregates: Prefer aggregates over fetching all positions for counts
Related Patternsβ
- Single Atom - Basic atom query
- Vault Details - Detailed vault queries
- User Positions - Query user positions
Best Practicesβ
- Always filter by curve_id to get the correct vault
- Limit nested positions to avoid over-fetching
- Use variables for dynamic values
- Cache market data as it updates frequently