Skip to main content

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

Best Practices​

  1. Always filter by curve_id to get the correct vault
  2. Limit nested positions to avoid over-fetching
  3. Use variables for dynamic values
  4. Cache market data as it updates frequently