跳到主要内容

Subgraph

Super AI Chain 通过自托管 graph-node + IPFS 支持 The Graph 风格索引。Subgraph 会索引 DEX 池、跨链转账和 ENS 注册。

备注

多节点部署会开通 subgraph 栈。单机小测试网可能为省内存关闭。

查询 subgraph​

query RecentSwaps {
swaps(first: 5, orderBy: timestamp, orderDirection: desc) {
id
amount0
amount1
sender
timestamp
}
}
const res = await fetch('https://graph-testnet.superaichain.ai/subgraphs/name/dex', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: '{ swaps(first:5){ id sender } }' }),
});
console.log(await res.json());

规划中的 subgraph​

  • dex — V2/V3 池、兑换、流动性仓位。
  • bridge — lock/mint/burn/unlock 事件与转账状态。
  • ens — .sup 注册、解析记录、所有权转移。

下一步​