Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

This subgrap of The Graph allows querying information from the Winding Tree ecosystem using the GraphQL language.

License

Notifications You must be signed in to change notification settings

mtahon/orgid-subgraph

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

curl -X POST \
    -d '{ "query": "query { organizations(first: 5) { id owner legalEntity { country }}}" }' \
    https://api.thegraph.com/subgraphs/name/windingtree/orgid-subgraph

Installation

The below instructions are adapted from The Graph quickstart.

Clone the source code:

git clone git@github.com:windingtree/orgid-subgraph.git

Install dependencies:

yarn install

Local Development

Start a local Graph Node

In a dedicated terminal:

# 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:

# ! 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:

# Start the graph node
docker-compose up

Initialize the subgraph

Generate code:

yarn codegen

Build the subgraph:

yarn build

Allocate the subgraph in the Graph Node with:

yarn create-local

Deploy the subgraph locally:

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:

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. <ACCESS_TOKEN> is from The Graph Dashboard.

graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>

Then deploy:

yarn deploy

Status on the syncronization can be retrieved using:

curl -X POST \
    -d '{ "query": "query { indexingStatusForPendingVersion(subgraphName: \"windingtree/orgid-subgraph\") { synced health fatalError { message handler} }}" }' \
    https://api.thegraph.com/index-node/graphql

About

This subgrap of The Graph allows querying information from the Winding Tree ecosystem using the GraphQL language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%