Skip to main content
To access subgraph queries, please reach out to us at [email protected]. As we are in the early rollout phase, data availability is being opened gradually.

1. Where subgraphs fit in

Internally, SuperEarn is structured in three layers (same high‑level idea as the SEProject docs):
  • Contract Layer (Kaia Chain) – vaults, routers, cooldown vaults; where deposits / redeems actually happen via SuperEarnRouter (CooldownVault is not directly callable by users).
  • Subgraph Layer – indexes on‑chain events into raw, block‑level entities (accounts, vault snapshots, redeem requests, strategies, etc.).
  • Backend Layer (PDM) – processes subgraph data into app‑ready, aggregated views and exposes them via a single GraphQL API that your integration talks to.
For EarnUSDT integration you only interact with Backend Layer GraphQL:
  • You don’t need to construct Subgraph/The Graph queries.
  • You can use pdm_* queries on the backend endpoint.
For how these queries are used end‑to‑end, see Integrate Earn USDT.

2. Backend GraphQL endpoint (read layer)

SuperEarn exposes a Backend GraphQL API that already merges and processes the underlying subgraph data.
  • The schema contains PDM queries such as:
    • pdm_vaults
    • pdm_account
    • pdm_totalBalanceInUSDLineChart
    • pdm_totalEarningsInUSDLineChart
Example environment:
EnvironmentPurposeGraphQL endpointNotes
QAIntegration / QAhttps://api.superearn.io/graphqlToken + IP allowlist required.
Production endpoints will be provided separately (infra / ops will share the exact URL).

2.1 Basic request shape

All reads are HTTP POSTs with a JSON body:
curl -X POST https://api.superearn.io/graphql \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <AUTH_TOKEN>' \
  -d '{
    "query": "query GetVaults { pdm_vaults { contractAddress vaultName wantAddress isVisble inManagement } }"
  }'
You can call the same endpoint from:
  • your backend server (recommended for partners/CEXes),
  • or directly from a frontend if you manage the token securely.

3. Authentication & QA access control

3.1 Auth token (all environments)

Authentication requirement
  • Every external integration must use an Authorization token.
HTTP header format:
Authorization: Bearer <AUTH_TOKEN>

3.2 QA server ACL (IP allowlist)

The QA GraphQL endpoint is protected by an ACL (IP allowlist). To access QA:
  1. Obtain an Authorization token (see above).
  2. Register the IP(s) of the machines that will call QA.

4. Core backend GraphQL queries for EarnUSDT

This section summarizes the minimal set of PDM queries you typically need as an EarnUSDT integrator. For end‑to‑end examples, see Integrate Earn USDT.
Pattern:
  • Contract integrationaccountAddress = your wrapper contract address
  • Frontend‑only integrationaccountAddress = user wallet address

4.1 Discover vaults – pdm_vaults

Use this to find the EarnUSDT Super Vault and other vault metadata.
query GetVaults {
  pdm_vaults {
    contractAddress
    vaultName
    wantAddress
    isVisble
    inManagement
    vaultCreatedAt
  }
}
Typical usage:
  • Filter where vaultName or contractAddress matches the EarnUSDT Super Vault.
  • Use the result to:
    • show vault info in your UI,
    • store SUPER_VAULT for later deposit / redeem calls.

4.2 Get account positions & redeem requests – pdm_account

Get all SuperEarn positions and pending withdrawals for a given account:
query PdmAccount($account: String!) {
  pdm_account(
    accountAddress: $account
    forceRefresh: false
  ) {
    id
    createdAt
    lastActivityAt
    positions(forceRefresh: false) {
      vault {
        contractAddress
        vaultName
      }
      shares
      totalValueInUSD
      totalEarningsInUSD
      positionCreatedAt
      positionUpdatedAt
    }
    redeemRequests(forceRefresh: false) {
      # RedeemRequest fields (id, shares, assets, timestamps, etc.)
    }
    tokenBalances(forceRefresh: false) {
      # Optional: token balances if you need them
    }
    transactions(limit: 10, skip: 0) {
      # Optional: recent tx history
    }
  }
}
Key points:
  • Contract integrationaccount = your wrapper contract.
  • Frontend‑onlyaccount = user wallet.
  • Use client‑side filtering on positions.vault.contractAddress == SUPER_VAULT to show EarnUSDT‑only data.

4.3 Balance / earnings charts – pdm_totalBalanceInUSDLineChart

Use this to build “Portfolio over time” or “EarnUSDT balance over time” charts.
query AccountBalanceChart(
  $account: String!
  $start: DateTime!
  $end: DateTime!
  $vault: String
) {
  pdm_totalBalanceInUSDLineChart(
    accountAddress: $account
    startDateUTCInclusive: $start
    endDateUTCInclusive: $end
    vaultAddress: $vault  # SUPER_VAULT for EarnUSDT‑only, or null for all vaults
  ) {
    date
    value
  }
}
  • vaultAddress = SUPER_VAULT → chart for EarnUSDT only.
  • vaultAddress = null / omitted → chart for all vaults aggregated.

4.4 Earnings chart – pdm_totalEarningsInUSDLineChart

Use this to show “Total earnings over time” in USD.
query AccountEarningsChart(
  $account: String!
  $start: DateTime!
  $end: DateTime!
) {
  pdm_totalEarningsInUSDLineChart(
    accountAddress: $account
    startDateUTCInclusive: $start
    endDateUTCInclusive: $end
  ) {
    date
    value
  }
}
Notes:
  • Always aggregates all vault earnings for the account (no vaultAddress filter).
  • Combine this with the balance chart to give users a complete performance view.

5. Quick checklist for integrators

Before you start calling the Backend GraphQL API:
  1. Get your Authorization token
  2. (If using private endpoints)
    • Share your IP address(es) for allowlisting to access https://api.superearn.io/graphql.
  3. Implement reads using PDM queries
    • pdm_vaults → discover EarnUSDT vault
    • pdm_account → positions + redeem requests
    • pdm_totalBalanceInUSDLineChart / pdm_totalEarningsInUSDLineChart → charts
  4. For write flows (deposit / redeem)