如何使用 Uniswap v3 GraphQL API 获取代币价格

val*_*105 3 api spring-boot graphql

我将通过 Spring boot 使用 Uniswap v3 GraphQL API 获取代币价格。

所以我尝试在 Postman 中使用 URL 进行测试:https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3 并查询:

{
  factories(first: 5) {
    id
    poolCount
    txCount
    totalVolumeUSD
  }
  bundles(first: 5) {
    id
    ethPriceUSD
  }
}
Run Code Online (Sandbox Code Playgroud)

但我无法像 thegraph.com 那样得到结果。

请帮助我了解如何使用 Uniswap v3 GraphQL API 获取代币价格。

Vas*_*Vas 5

邮差:

  • 确保方法是 POST 而不是 GET
  • 确保请求正文是原始 -> JSON
  • 确保查询格式正确{"query":"{ factories(first: 5) { id poolCount txCount totalVolumeUSD } bundles(first: 5) { id ethPriceUSD }}"}

邮递员形象

开火吧!