https://github.com/windingtree/orgid-subgraph
This subgraph of The Graph allows querying information from the Winding Tree ecosystem using the GraphQL language.
https://github.com/windingtree/orgid-subgraph
ethereum graph-node graphql ingestion subgraph travel
Last synced: about 1 month ago
JSON representation
This subgraph of The Graph allows querying information from the Winding Tree ecosystem using the GraphQL language.
- Host: GitHub
- URL: https://github.com/windingtree/orgid-subgraph
- Owner: windingtree
- License: gpl-3.0
- Created: 2020-09-13T12:37:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-04T11:43:50.000Z (about 4 years ago)
- Last Synced: 2025-01-24T06:42:31.541Z (3 months ago)
- Topics: ethereum, graph-node, graphql, ingestion, subgraph, travel
- Language: TypeScript
- Homepage: https://thegraph.com/explorer/subgraph/windingtree/orgid-subgraph
- Size: 307 KB
- Stars: 0
- Watchers: 6
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ORGiD Subgraph
This subgraph tracks events occuring on Winding Tree's ORGiD contract.
The data can later be queried using a GraphQL API.
## Usage Example
Get 5 random ORGiDs, their owner and the country of the legal entity:
```shell
curl -X POST \
-d '{ "query": "query { organizations(first: 5) { id owner legalEntity { legalName } service {id} }}" }' \
https://api.thegraph.com/subgraphs/name/windingtree/orgid-subgraph
```## Installation
The below instructions are adapted from [The Graph quickstart](https://thegraph.com/docs/quick-start#local-development).
Clone the source code:
```shell
git clone [email protected]:windingtree/orgid-subgraph.git
```Install dependencies:
```shell
yarn install
```## Local Development
### Start a local Graph Node
In a dedicated terminal:
```shell
# Clone the Graph Node repository
cd /tmp
git clone https://github.com/graphprotocol/graph-node/# Change directory to Docker
cd graph-node/docker
```By default, the ethereum node will be assumed to be the docker host IP and the network mainnet, but you can update it in the `docker-compose.yml` file.
__For Linux__: the docket host IP must be updated using the `setup.sh` script:
```shell
# ! Linux Only ! run setup.sh to update the host IP in docker settings
./setup.sh
```For an externally hosted node type infura, the ethereum node URL must be updated in the `docker-compose.yml` file.
Then launch the node:
```shell
# Start the graph node
docker-compose up
```### Initialize the subgraph
Generate code:
```shell
yarn codegen:mainnet
```Build the subgraph:
```shell
yarn build
```Allocate the subgraph in the Graph Node with:
```shell
yarn create-local
```Deploy the subgraph locally:
```shell
yarn deploy-local
```This will trigger the indexing of the subgraph in the Graph node and can take some time. Check the Graph node logs to check when data ingestion is completed.
Once the ingestion is completed, you can query the Graph Node, for example to get all organizations:
```shell
curl -X POST \
-d '{ "query": "{organizations {id, owner, isActive}}" }' \
http://localhost:8000/subgraphs/name/windingtree/orgid-subgraph
```## Deploy to The Graph
Create an access token and store it locally. `` is from [The Graph Dashboard](https://thegraph.com/explorer/dashboard).
```shell
graph auth https://api.thegraph.com/deploy/
```Then deploy, for example in Mainnet:
```shell
yarn deploy:mainnet
```For Ropten:
```shell
yarn deploy:ropsten
```Status on the syncronization can be retrieved using:
```shell
curl -X POST \
-d '{ "query": "query { indexingStatusForPendingVersion(subgraphName: \"windingtree/orgid-subgraph\") { synced health fatalError { message handler} }}" }' \
https://api.thegraph.com/index-node/graphql
```