API

The following APIs are designed to allow monitoring and quick access to data.

Overview

Sailor provides read-only HTTPS endpoints for market snapshots (REST) and detailed on-chain data (GraphQL proxy) to power analytics, listings, dashboards, and indexers on Sei.

  • Endpoints return JSON

  • No authentication required

  • Standard HTTP status codes with JSON error payloads when applicable

Base URL

Quick start

  • Market snapshots: GET /cmc/c1 for a compact multi‑market snapshot (tickers and 24h volumes) in one call.

  • Subgraph analytics: POST /sailor/subgraph to query pools, tokens, swaps, liquidity, fees with first/skip pagination and orderBy/orderDirection sorting.

# Market snapshots (REST)
curl -s https://asia-southeast1-sailor-finance-2f870.cloudfunctions.net/sailor_otherapi/cmc/c1 | jq '.'

# Subgraph proxy (GraphQL)
curl -s -X POST https://asia-southeast1-sailor-finance-2f870.cloudfunctions.net/sailor_otherapi/sailor/subgraph \
  -H 'Content-Type: application/json' \
  -d '{"query":"{ swaps(first:10, orderBy: timestamp, orderDirection: desc) { id timestamp amount0 amount1 sqrtPriceX96 tick pool { id token0 { id symbol decimals } token1 { id symbol decimals } } } }"}'

Endpoint groups

This section lists stable, public endpoints by functional area with method, path, purpose, request parameters, and example responses for copy‑paste integration in dashboards and indexers. Treat unknown fields in aggregated feeds as additive and non‑breaking to preserve forward compatibility.​

Market Snapshot Endpoint
  • GET /cmc/c1

    • Purpose: Multi‑market snapshot used for tickers and 24h volumes across many pairs in one call.

    • Query params: None

    • Response: JSON object keyed by "<baseAddress>_<quoteAddress>" with fields base_id, base_name, base_symbol, quote_id, quote_name, quote_symbol, last_price, base_volume, quote_volume (all numeric values as decimal strings).

    • Example response schema:

      json{
        "<base>_<quote>": {
          "base_id": "0x...",
          "base_name": "USDC",
          "base_symbol": "USDC",
          "quote_id": "0x...",
          "quote_name": "Wrapped SEI",
          "quote_symbol": "WSEI",
          "last_price": "string-number",
          "base_volume": "string-number",
          "quote_volume": "string-number"
        }
      }
  • GET /cmc/c3

    • Purpose: Aggregated listings feed for partner price boards and listings that may add fields over time without breaking existing clients.

    • Query params: None

    • Response: Structured JSON rollups suitable for external listings; treat unknown fields as additive.

GraphQL Endpoint
  • POST /sailor/subgraph - Subgraph proxy

    • Purpose: Flexible GraphQL access to entities such as pools, tokens, swaps, fees, and volumes for analytics and indexing.

    • Headers: Content‑Type: application/json.

    • Body: { "query": "<GraphQL string>", "variables": { ...optional } }.

    • Pagination: first (limit), skip (offset).

    • Ordering: orderBy, orderDirection (asc|desc)

    • Example queries:

      # Latest swaps
      {
        swaps(first: 10, orderBy: timestamp, orderDirection: desc) {
          id
          timestamp
          amount0
          amount1
          sqrtPriceX96
          tick
          pool { id token0 { id symbol decimals } token1 { id symbol decimals } }
        }
      }
      
      # Pools by liquidity
      {
        pools(first: 20, orderBy: totalValueLockedUSD, orderDirection: desc) {
          id
          feeTier
          totalValueLockedUSD
          volumeUSD
          token0 { id symbol decimals }
          token1 { id symbol decimals }
        }
      }

Pagination and ordering

Use first and skip to page deterministically through large result sets, and combine with orderBy and orderDirection to fetch stable windows of pools or swaps for scrolling lists and indexers. Increment skip in fixed windows to iterate until exhaustion or service limits are reached for bulk enumeration tasks.

Contracts reference

  • Primary on‑chain reference (label c0): 0xa51136931fdd3875902618bf6b3abe38ab2d703b; use this as the canonical anchor for explorers, SDKs, and integrations on the current deployment. For a complete factory/router/pools map, contact the Sailor core team via Discord.

Language examples

JavaScript
  • GET c1 snapshot and POST subgraph query using fetch for dashboards and activity feeds.

js// c1: market snapshot
const res = await fetch('https://asia-southeast1-sailor-finance-2f870.cloudfunctions.net/sailor_otherapi/cmc/c1');
const data = await res.json();

// GraphQL: latest swaps
const gq = await fetch('https://asia-southeast1-sailor-finance-2f870.cloudfunctions.net/sailor_otherapi/sailor/subgraph', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    query: `{ swaps(first: 5, orderBy: timestamp, orderDirection: desc) {
      id timestamp amount0 amount1
      pool { id token0 { symbol } token1 { symbol } }
    } }`
  })
});
const gqData = await gq.json();

Python
  • GET c1 and POST subgraph query using requests for server‑side analytics or indexing pipelines.

pythonimport requests

# c1 snapshot
snap = requests.get('https://asia-southeast1-sailor-finance-2f870.cloudfunctions.net/sailor_otherapi/cmc/c1').json()

# subgraph
q = { "query": """
{ swaps(first: 3, orderBy: timestamp, orderDirection: desc) {
    id timestamp amount0 amount1
    pool { id token0 { symbol } token1 { symbol } }
  } }""" }
sg = requests.post(
  'https://asia-southeast1-sailor-finance-2f870.cloudfunctions.net/sailor_otherapi/sailor/subgraph',
  json=q, headers={'Content-Type':'application/json'}
).json()

Error handling

  • Standard HTTP status codes; non‑2xx responses include a JSON error message where applicable to assist debugging.

  • Responses are raw JSON without a custom envelope; handle HTTP status and parse the body accordingly.

Best practices

  • Parse decimal string values with arbitrary‑precision libraries and only convert to floats at render time if necessary to avoid rounding errors.

  • Prefer embedded name/symbol fields for UI display; keep pair keys for programmatic identity.

  • Cache snapshot responses and implement exponential backoff on HTTP 429 to stay within soft limits and maintain responsiveness.

Changelog

  • v1.0: Introduces c0, cmc/c1, cmc/c3, and sailor/subgraph; future extensions will be additive to remain non‑breaking for clients, particularly in aggregated feeds.

Support

  • For questions, bug reports, and partner integrations (e.g., listings, wallets, aggregators), contact the Sailor core team via Discord, and include endpoint paths, example requests, and error payloads to speed triage.

Last updated