跳转至

Tokens Query

Retrieve ERC-20 token information including addresses, symbols, and decimals.

Try It Now

curl -s -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "{ tokens(first: 20) { id symbol name decimals } }"}' \
  https://api.goldsky.com/api/public/project_cmicv6kkbhyto01u3agb155hg/subgraphs/sera-pro/1.0.9/gn
import requests

SUBGRAPH_URL = "https://api.goldsky.com/api/public/project_cmicv6kkbhyto01u3agb155hg/subgraphs/sera-pro/1.0.9/gn"

response = requests.post(SUBGRAPH_URL, json={
    "query": """
        query {
            tokens(first: 50) {
                id
                symbol
                name
                decimals
            }
        }
    """
})
print(response.json())

Schema

type Token {
  id: ID!           # Token contract address
  symbol: String!   # Token symbol (e.g., "USDC")
  name: String!     # Token name (e.g., "USD Coin")
  decimals: BigInt! # Token decimals (usually 6 or 18)
}

Example Queries

Get All Tokens

query GetAllTokens {
  tokens(first: 100, orderBy: symbol) {
    id
    symbol
    name
    decimals
  }
}

Get Token by Address

query GetToken($id: ID!) {
  token(id: $id) {
    id
    symbol
    name
    decimals
  }
}

Variables:

{
  "id": "0x1920bf0643ae49b4fb334586dad6bed29ff30f88"
}

Find Token by Symbol

query FindTokenBySymbol($symbol: String!) {
  tokens(where: { symbol: $symbol }) {
    id
    symbol
    name
    decimals
  }
}

Get Tokens with Markets

query GetTokensWithMarkets {
  tokens(first: 50) {
    id
    symbol
    name
    decimals
    marketsAsQuote {
      id
      baseToken { symbol }
    }
    marketsAsBase {
      id
      quoteToken { symbol }
    }
  }
}

Response Example

{
  "data": {
    "tokens": [
      {
        "id": "0x1920bf0643ae49b4fb334586dad6bed29ff30f88",
        "symbol": "USDT",
        "name": "Tether USD",
        "decimals": "6"
      },
      {
        "id": "0xd3bdb2ce9cd98566efc2e2977448c40578371779",
        "symbol": "EURC",
        "name": "Euro Coin",
        "decimals": "6"
      },
      {
        "id": "0x1fe69b1171d8aa5e6d432f14a9e4129ed96e40c0",
        "symbol": "XSGD",
        "name": "StraitsX Singapore Dollar",
        "decimals": "6"
      }
    ]
  }
}

Building a Token List

async function getTokenList() {
  const query = `
    query GetTokens {
      tokens(first: 100, orderBy: symbol) {
        id
        symbol
        name
        decimals
      }
    }
  `;

  const data = await querySubgraph(query);

  return data.tokens.map(token => ({
    address: token.id,
    symbol: token.symbol,
    name: token.name,
    decimals: Number(token.decimals),
    logoURI: getTokenLogoURI(token.symbol)  // Your logo mapping
  }));
}

Token Categories

Tokens on Sera testnet are organized by currency:

Currency Tokens
USD USDT
EUR EURC, EURT, TNEUR, VEUR
GBP GBPA, TGBP, VGBP
SGD XSGD, TNSGD
JPY GYEN, JPYC
And more... See Supported Tokens

Tip

All testnet tokens have 6 decimals and users are airdropped 10M of each token when connecting.