import requests


def query_graph(url: str, query: str) -> dict:
    """Helper methods for querying graphql api. [Source: https://thegraph.com/en/]

    Parameters
    ----------
    url: str
        Endpoint url
    query: str
        Graphql query

    Returns
    -------
    dict:
        Dictionary with response data
    """

    response = requests.post(url, json={"query": query})
    if response.status_code == 200:
        return response.json()["data"]
    return {}