Queries for Tokens

token

Returns a single token.

token(id, address, chain_id) {
  /* Token fields */
}

Arguments

address String

The address of the token to return. Must be used in conjunction with chain_id.

chain_id Int

The identifier of the chain of the token to return. Must be used in conjunction with address.

id Int

The ID of the Token to return.

Response

Token.* Token

Any requested field from the Token object.

Example

Request

query {
  token(id: 3) {
    id
    symbol
    address
    chain {
      id
      name
    }
  }
}
query {
  token(address: "0x3845badade8e6dff049820680d1f14bd3903a5d0", chain_id: 1) {
    id
    symbol
    address
    chain {
      id
      name
    }
  }
}

Response

{
  "data": {
    "token": {
      "id": 3,
      "symbol": "SAND",
      "address": "0x3845badade8e6dff049820680d1f14bd3903a5d0",
      "chain": {
        "id": 1,
        "name": "Ethereum"
      }
    }
  }
}

tokens

Returns all available tokens.

tokens(game_id, symbols) {
  /* Token fields */
}

Arguments

game_id Int

Game identifier for which to return compatible token objects.

symbols [String!]

A list of symbols for which to return token objects.

Response

Token.* [Token!]

A list of Token objects returning any requested fields from the Token object.

Example

Request

query {
  tokens(game_id: 2) {
    id
    name
  }
}
query {
  tokens(symbols: ["USDC", "MATIC", "WETH"]) {
    id
    name
  }
}

Response

{
  "data": {
    "tokens": [
      {
        "id": 4,
        "symbol": "USDC"
      },
      {
        "id": 11,
        "symbol": "MATIC"
      },
      {
        "id": 6,
        "symbol": "WETH"
      },
      {
        "id": 3,
        "symbol": "SAND"
      },
      {
        "id": 5,
        "symbol": "DAI"
      },
      {
        "id": 1,
        "symbol": "ETH"
      }
    ]
  }
}
{
  "data": {
    "tokens": [
      {
        "id": 13,
        "symbol": "WETH"
      },
      {
        "id": 6,
        "symbol": "WETH"
      },
      {
        "id": 4,
        "symbol": "USDC"
      },
      {
        "id": 11,
        "symbol": "MATIC"
      }
    ]
  }
}