Skip to content

near-everything/subgraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Subgraph

NEAR collect's subgraph. It listens for actions on the order-book and common-good contracts, then constructs Token and Order entities to be easily queried. To understand more about how this works, read more about subgraphs and The Graph.

To view and query the subgraph, it can be found here:

To learn more about how the subgraph is defined and created, explore the following files:

  • subgraph.yaml - configuration
  • schema.graphql - defines entity schemas
  • src/handlers/common-good.ts - defines the handlers for the common-good contract methods
  • src/handlers/order-book.ts - defines the handlers for the order-book contract methods

Usage

After making any changes to the schema, run

yarn codegen

This will compile and generate the entities to be used in the handlers.

Then, to build the graph for deployment, run

yarn build

Deployment

Only developers with the access token can deploy subgraphs.

If you have the access token, first login:

yarn auth {{access-token}}

Then deploy:

yarn deploy

The subgraph will then resync from the start block designated in the subgraph.yml