Skip to Content
Symmio Frontier — the SDK surface for builders on HyperEVM
CoreSubgraph

Subgraph

Historical on-chain data — quote history, funding, balance history, transfers — lives in GraphQL subgraphs synced to the SYMMIO contracts. Each chain has two subgraphs, each indexing a different subset of contracts and events:

  • analytics — aggregated / derived data. Balance changes over time, quote-level events keyed by quote id, funding accruals, position snapshots. This is what a trading UI usually wants: pre-shaped rows ready to render.
  • events — raw on-chain event log. internalTransfers, deposit / withdraw / allocate events straight from the contract. Use when you need untouched provenance (audit trails, custom analytics, reconciliation against on-chain reads).

Both subgraphs carry a lot of data — they hold the entire history of every account, every quote, every transfer since the contracts deployed. GraphQL lets you filter, page, and select exactly the fields you need; the subgraphs happily answer any query the schema supports.

@symmio/trading-core ships the queries most consumers reach for as typed actions: quote history, quote events by type, quote funding, balance history, transfer history. Each is a thin typed wrapper — the caller supplies filters and paging, the SDK issues the GraphQL request and returns strongly-typed rows.

If you need a query the SDK doesn’t wrap yet, two paths:

  1. Open an issue or a PR — the pattern is consistent (see the existing files under packages/trading-core/src/*/get-<slice>/). A new action lands as one folder: the action fn, its query-options factory, tests. Happy to review.
  2. Query the subgraph directly — the URLs are exposed on the chain config (config.getChainConfig().subgraphs.analytics / .events). Point any GraphQL client at them.

Endpoints

Endpoints live in the chain-config registry (Config.getChainConfig(chainId).subgraphs). Override via createConfig({ chainOverrides }) when pointing at a custom deployment or a staging index.

const chain = config.getChainConfig(); chain.subgraphs.analytics; // https://.../subgraphs/hyperevm_mainnet_analytics/latest/gn chain.subgraphs.events; // https://.../subgraphs/hyperevm_mainnet_events/latest/gn

Import

import { getBalanceHistory, getTransferHistory, getQuoteHistory, getQuoteEventsByType, getQuoteFunding, } from "@symmio/trading-core";

Balance history

getBalanceHistory

Time-series of an account’s deposit / withdraw / allocate / deallocate events.

const history = await getBalanceHistory(config, { account, first: 50, skip: 0, });

Returns — array of { id, type, amount, timestamp, txHash, ... }. Sorted newest-first.

Transfer history

getTransferHistory

Every collateral in/out for an account, aggregated across deposits, withdraws, and cross-account moves.

const transfers = await getTransferHistory(config, { account, first: 50, skip: 0, });

Quote history

getQuoteHistory

Every state transition for one quote — send, lock, fill, close, cancel.

const events = await getQuoteHistory(config, { quoteId: 42n, first: 100, });

Returns — chronologically ordered events with type, blockNumber, timestamp, txHash, partyA, partyB, and event-specific fields.

getQuoteEventsByType

Filter by event type — useful for building per-quote timelines that pull out just fills or just cancels.

const fills = await getQuoteEventsByType(config, { quoteId: 42n, type: "FillOpenMarketOrder", first: 20, });

Quote funding

getQuoteFunding

Aggregate funding paid + received for one quote across its lifetime.

const funding = await getQuoteFunding(config, { quoteId: 42n }); // { paid: bigint, received: bigint, net: bigint }

All figures are 18-decimal-wei bigint. Net is received - paid (signed).

GraphQL error handling

The subgraph client normalizes:

  • Transport failures — surface as SymmApiError with the request URL and status.
  • GraphQL errors payload — surfaces as SymmError (kind: "api") with the concatenated messages.
  • Empty data — surfaces as SymmError (kind: "api") with "Subgraph query returned no data." so an action never silently returns undefined.

Query options

Every action has xyzQueryOptions / xyzQueryKey — same shape as the on-chain reads. See Query options.

  • SYMMIO Contract — live on-chain state; pair with subgraph for history.
  • Unified quotesgetQuoteHistory / getQuoteFunding decorate the reconciled row.
  • Errors — subgraph failures surface as SymmApiError.
Last updated on