Graph开发和部署学习教程 (四)

书接上回,现在可以终于部署了。。。

部署
可以把 subgraph 部署到本地,也可以使用托管服务,这里演示使用 graph 官网提供的托管服务——子图工作室

在这里插入图片描述
连接钱包并签名后,就可以创建子图项目了。

在这里插入图片描述

右边可以看到相关的操作命令:

在这里插入图片描述

使用 AUTH & DEPLOY 栏的示例命令进行部署,因为已经编译过,下面跳过编译命令:

xxx@Inspiron:~/tmp/FriendtechGraph$ graph auth --studio fffff2e2e969c873d1daf88c27c2b238
Deploy key set for https://api.studio.thegraph.com/deploy/

xxx@Inspiron:~/tmp/FriendtechGraph$ graph deploy --studio friendtechgraph
Which version label to use? (e.g. "v0.0.1"): v0.0.1
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
  Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
  Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
  Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
  Skip migration: Bump manifest specVersion from 0.0.2 to 0.0.4
✔ Apply migrations
✔ Load subgraph from subgraph.yaml
  Compile data source: FriendtechSharesV1 => build/FriendtechSharesV1/FriendtechSharesV1.wasm
✔ Compile subgraph
  Copy schema file build/schema.graphql
  Write subgraph file build/FriendtechSharesV1/abis/FriendtechSharesV1.json
  Write subgraph manifest build/subgraph.yaml
✔ Write compiled subgraph to build/
  Add file to IPFS build/schema.graphql
                .. QmU2ns3ySUcCQ7ZRcY4qUDnaToSwx1nxGuagFHBJWg9UFZ
  Add file to IPFS build/FriendtechSharesV1/abis/FriendtechSharesV1.json
                .. QmfA1DYEazwF9cx6rJy1hTj5ToVTz1GySGeaETJ25S7hJR
  Add file to IPFS build/FriendtechSharesV1/FriendtechSharesV1.wasm
                .. QmU3PEhQaZ2PqZiEfreGvSSSXAMhgVpbygbJbL8uTy9FLy
✔ Upload subgraph to IPFS

Build completed: QmW1eEAf6aeS11kjGgZFfA9Y1E1t3gNFmHYuvX1sZvbcbk

Deployed to https://thegraph.com/studio/subgraph/friendtechgraph

Subgraph endpoints:
Queries (HTTP):     https://api.studio.thegraph.com/query/61273/friendtechgraph/v0.0.1

可以在子图工作室看到已经完成了部署,且数据已经完成了同步。

在这里插入图片描述

查询数据
可以使用提供的 QUERY URL 在 GraphiQL 中查询数据:
在这里插入图片描述

部署完后可以进行测试,如果想在将子图发布到网络之前对其进行测试,也可以在 Subgraph Playground 中执行此操作或查看日志。

猜你喜欢

转载自blog.csdn.net/Tesla_Zhou/article/details/135196341