返回顶部
b

bitquery-graphql-skillBitquery图查询

Use Bitquery GraphQL through UXC for onchain trades, transfers, token holder analysis, balances, and market structure queries across supported networks, with OAuth client_credentials authentication and query-first execution.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
312
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

bitquery-graphql-skill

Bitquery GraphQL 技能

使用此技能通过 uxc 运行 Bitquery GraphQL API 操作。

复用 uxc 技能进行发现、GraphQL 执行、OAuth 生命周期和通用错误处理。

前提条件

  • - uxc 已安装并位于 PATH 中。
  • 可访问 https://streaming.bitquery.io/graphql 网络。
  • 拥有 Bitquery 应用程序的 clientid 和 clientsecret。

认证

Bitquery 使用 Bearer 访问令牌。最稳定的代理路径是 OAuth client_credentials,而不是复制的临时令牌。

  1. 1. 创建 Bitquery 应用程序并记录:
- 应用程序 client_id - 应用程序 client_secret - 令牌作用域 api
  1. 2. 使用 OAuth 客户端凭据登录一次:
- uxc auth oauth login bitquery-graphql --endpoint https://streaming.bitquery.io/graphql --flow clientcredentials --client-id id> --client-secret --scope api --token-endpoint https://oauth2.bitquery.io/oauth2/token - 此流程通过一条命令完成。无需浏览器审批页面。
  1. 3. 绑定 GraphQL 端点:
- uxc auth binding add --id bitquery-graphql --host streaming.bitquery.io --path-prefix /graphql --scheme https --credential bitquery-graphql --priority 100
  1. 4. 验证认证映射:
- uxc auth binding match https://streaming.bitquery.io/graphql - uxc auth oauth info bitquery-graphql

核心工作流程

  1. 1. 默认使用固定链接命令:
- command -v bitquery-graphql-cli - 如果缺失,创建它:uxc link bitquery-graphql-cli https://streaming.bitquery.io/graphql - bitquery-graphql-cli -h - 如果检测到命令冲突且无法安全复用,停止并请技能维护者选择另一个固定命令名称。
  1. 2. 发现可用的根操作:
- bitquery-graphql-cli -h - 已验证的根包括 query/EVM、query/Solana、query/Trading、query/Tron 以及对应的 subscription/* 根。
  1. 3. 检查特定操作:
- bitquery-graphql-cli query/EVM -h - bitquery-graphql-cli query/Trading -h
  1. 4. 使用位置 JSON 和显式 GraphQL 选择集执行:
- bitquery-graphql-cli query/EVM {network:base,dataset:combined,_select:DEXTrades(limit: {count: 1}) { Transaction { Hash } }}
  1. 5. 优先使用 query/* 操作。
- uxc subscribe 现在自动协商现代 graphql-transport-ws 和传统 graphql-ws 兼容性配置文件,用于 subscription/*。 - 当您提供与流友好实体形状匹配的显式 _select 时,实时 Bitquery 订阅验证现在可以成功。 - 优先选择 subscription/EVM 作为第一个验证目标,而不是 subscription/Trading。

能力映射

  • - EVM 链上查询:
- query/EVM - subscription/EVM
  • - Solana 链上查询:
- query/Solana - subscription/Solana
  • - 跨市场/交易查询:
- query/Trading - subscription/Trading
  • - Tron 链上查询:
- query/Tron - subscription/Tron

在这些根中,Bitquery 为以下任务公开实体:

  • - DEX 交易
  • 代币余额和持有者分析
  • 转账
  • 区块和交易
  • 内存池和实时活动
  • 市场或交易视图(取决于根)

始终使用 -h 检查当前模式,并使用所需的最窄 _select。

对于订阅,特别要注意:

  • - 始终提供 _select
  • 从高频根开始,例如 subscription/EVM
  • 在添加 limit 之前优先选择直接事件形状
  • 将空选择或查询导向的形状视为可能的应用程序级错误

推荐使用模式

  1. 1. 首先检查根参数:
- bitquery-graphql-cli query/EVM -h
  1. 2. 从一个网络的最小查询开始:
- bitquery-graphql-cli query/EVM {network:eth,dataset:combined,_select:DEXTrades(limit: {count: 1}) { Transaction { Hash } }}
  1. 3. 仅添加任务所需的字段:
- 买方/卖方 - 代币地址 - 符号 - 数量 - 时间戳
  1. 4. 使用 _select 内的 GraphQL 参数缩小范围:
- limit - orderBy - where
  1. 5. 谨慎处理大型或实时查询:
- 避免宽泛的选择 - 首次通过时优先选择一条链/一个代币/一个钱包
  1. 6. 对于实时订阅,从已知良好的高频形状开始:
- ./target/debug/uxc subscribe start https://streaming.bitquery.io/graphql subscription/EVM {network:bsc,mempool:true,_select:Transfers { Transaction { Hash From To } Transfer { Amount Type Currency { Name } } }} --auth bitquery-graphql --sink file:$HOME/.uxc/subscriptions/bitquery-mempool.ndjson

已验证的真实场景

以下经过认证的 Bitquery 流程已通过 uxc 成功验证:

  • - 使用 client_credentials 进行 OAuth 登录
  • 在 https://streaming.bitquery.io/graphql 上进行认证绑定
  • GraphQL 主机帮助
  • query/EVM -h
  • 在 base 上经过认证的 query/EVM 调用
  • 通过 WebSocket 针对实时 Bitquery 基础设施的守护进程支持的 subscription/EVM
  • 来自 BSC 内存池转账流的重复实时 data 事件

已验证的查询形状为:

json
{
network: base,
dataset: combined,
_select: DEXTrades(limit: {count: 1}) { Block { Time } Transaction { Hash } Trade { Buy { Amount Buyer Currency { Symbol SmartContract } } Sell { Amount Seller Currency { Symbol SmartContract } } } }
}

已验证的订阅形状为:

json
{
network: bsc,
mempool: true,
_select: Transfers { Transaction { Hash From To } Transfer { Amount Type Currency { Name } } }
}

防护措施

  • - 保持自动化使用 JSON 输出格式;不要依赖 --text。
  • 首先解析稳定字段:ok、kind、protocol、data、error。
  • 使用 bitquery-graphql-cli 作为默认命令路径。
  • bitquery-graphql-cli ... 等同于 uxc https://streaming.bitquery.io/graphql ...。
  • 优先使用位置 JSON 进行 GraphQL 调用,因为通常需要 select。
  • 首次通过时保持 select 较小,并在扩展范围前添加显式过滤器。
  • 对于稳定的代理工作流程,优先使用 query/。subscription/ 现在在运行时已验证,但仍取决于提供者特定的选择形状。
  • 对于订阅验证或自动化,从 subscription/EVM 和显式 _select 开始;不要假设空选择或 subscription/Trading 默认形状会产生事件。
  • 如果订阅成功打开但立即返回 GraphQL 错误,在假设传输失败之前,将其视为查询形状问题。
  • 如果认证失败:
- 确认 uxc auth binding match https://streaming.bitquery.io/graphql 解析为 bitquery-graphql - 使用 uxc auth oauth info bitquery-graphql 检查令牌状态 - 使用 uxc auth oauth refresh bitquery-graphql 手动刷新 - 如有必要,重新运行 uxc auth oauth login ... --flow client_credentials ...
  • - 不要将临时 IDE 令牌粘贴到长期技能文档中。优先使用基于应用程序的 client_credentials。

参考资料

  • - 调用模式:
- references/usage-patterns.md

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 bitquery-graphql-skill-1776190502 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 bitquery-graphql-skill-1776190502 技能

通过命令行安装

skillhub install bitquery-graphql-skill-1776190502

下载

⬇ 下载 bitquery-graphql-skill v1.0.1(免费)

文件大小: 6.33 KB | 发布时间: 2026-4-15 14:01

v1.0.1 最新 2026-4-15 14:01
Document validated GraphQL subscription flows.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部