0
from operator import concat
from gql import Client, gql
from gql.transport.aiohttp import AIOHTTPTransport
from graphql import get_introspection_query
import pandas as pd
from gql.transport.websockets import WebsocketsTransport

# Select your transport with a defined url endpoint
count =0 
transport = WebsocketsTransport(url='wss://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2')

# Create a GraphQL client using the defined transport
client = Client(
    transport=transport,
    fetch_schema_from_transport=True
)
# Provide a GraphQL query
lastID=""
query = gql(
      """
      subscription swaps{
  swaps(orderBy: timestamp, orderDirection: desc) {
    id
    timestamp
    amount0In
    amount1In
    amount0Out
    amount1Out
    pair {
      token0 {
        id
        symbol
      }
      token1 {
        id
        symbol
      }
    }
  }
}
  """
  )
for result in client.subscribe(query):
    print (result)

当我尝试运行此订阅代码时,我收到错误消息:- TypeError:自省结果无效或不完整。确保您正在传递自省响应的“数据”属性,并且没有同时返回“错误”:无。

我能做些什么来纠正这个问题?

4

0 回答 0