图:子图查询中没有为 ID 参数提供值

问题描述

我正在关注 The Graph 文档 (https://thegraph.com/docs/quick-start#hosted-service) 并使用以下代码创建子图:

graph init <GITHUB_USERNAME>/<SUBGRAPH_NAME>

当我构建然后部署时,我在 Playground 中看到一个名为 exampleEntities()查询

{
  exampleEntities(first: 5) {
    id
    affiliate
    player
    points
    total
  }
}

如果我使用这个查询查询子图,一切都很好,但是如果我将实体类型的名称更改为其他任何名称 - 例如 affiliateData - 在我的 schema.graphql 文件(并更改 mapping.ts 中的导入名称)我收到此错误

"No value provided for required argument: `id`"

同样,我所做的只是改变实体类型的名称

type ExampleEntity @entity {
  id: ID!
  affiliate: Bytes! # address
  player: Bytes! # address
  points: BigInt!
  total: BigInt!
}

为此:

type affiliateData @entity {
  id: ID!
  affiliate: Bytes! # address
  player: Bytes! # address
  points: BigInt!
  total: BigInt!
}

我不确定如何在 ExampleEntity 实体类型中设置“id”,因为我在代码中找不到设置它的任何地方。我希望有人能提供一些见解。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)