oceanprotocol/subgraphocean-subgraph是Ocean Protocol的子图实现,用于索引和查询Ocean Protocol在***上的相关数据。该子图已部署在Ocean Protocol合约所支持的所有网络中,提供GraphQL接口供开发者和用户查询数据NFT、订单、用户等实体信息。
该子图已部署在以下网络,可直接通过GraphQL接口访问:
graphql{ nfts(orderBy: createdTimestamp, orderDirection: desc, first: 1000) { id symbol name creator createdTimestamp } }
注意:子图最多可返回1000条数据
graphql{ users(first: 1000) { id totalOrders } }
graphql{ user(id: $user) { id totalOrders } }
注意:所有ETH地址(如上述示例中的
$user)需以小写字符串形式传入
graphql{ orders(orderBy: createdTimestamp, orderDirection: desc, first: 1000){ amount datatoken { id } consumer { id } payer { id } } }
注意:子图最多可返回1000条数据
bashgit clone [***] cd barge ./start_ocean.sh --with-thegraph
如果之前已克隆Barge,请通过git pull确保使用最新版本。
bashgit clone [***] cd ocean-subgraph npm i
bashexport ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json"
bashnode ./scripts/generatenetworkssubgraphs.js barge npm run codegen
bashnpm run create:local npm run deploy:local
npm run quickstart:barge快速启动,该命令会合并步骤4-5。本地graph-node将运行在:[***]
bashgit clone [***] cd ocean-subgraph npm i
bashnpm run quickstart:rinkeby
注意:
npm run test命令当前因此问题无法正常工作。
要在本地运行集成测试,先按照上述说明启动Barge,然后在ocean-subgraph文件夹中运行:
bashexport ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json" npm run test-integration
可从项目根目录使用以下命令进行代码检查和格式化:
bash# 使用eslint检查所有js文件 npm run lint # 使用prettier自动格式化所有js和css文件 npm run format
发布采用半自动化管理,从干净的main分支运行以下命令,根据语义化版本控制更新版本:
bashnpm run release
该命令将:
package.json和package-lock.json中的项目版本执行GitHub发布步骤需要导出GitHub个人访问令牌为
GITHUB_TOKEN,设置方法
部署ocean-subgraph到本地运行的graph-node(指向主网):
bashnpm run codegen # 部署 npm run create:local npm run deploy:local
要部署到Rinkeby或Ropsten测试网:
bash# Rinkeby npm run create:local-rinkeby npm run deploy:local-rinkeby # Ropsten npm run create:local-ropsten npm run deploy:local-ropsten
编辑事件处理程序代码后运行npm run deploy:local时需注意:
docker-compose down或Ctrl+C)/docker/data中的ipfs和postgres文件夹(rm -rf ./docker/data/*)docker-compose up重启graph-node、ipfs和postgresnpm run create:local创建ocean-subgraphnpm run deploy:local部署ocean-subgraph要部署到Ocean运行的远程节点之一,可进行端口转发,上述
:local命令将照常工作。
Copyright ((C)) 2023 Ocean Protocol Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at [***] Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务