This is a sample project similar to the one generated by hydra-cli scaffold. By default, it runs against a
public Kusama Indexer endpoint.
Experiment by modifying schema.graphql and the mapping files in the mappings folder.
Run
yarn codegento generate the model files as defined in schema.graphql
A separate tool Hydra Typegen can be used for generating Typescript classes for the event handlers (the mappings).
Run
yarn typegento run the typegen for events and extrinsics defined in typegen.yml (by default, it fetches the metadata from a substrate node run at localhost).
Inspect the DB settings in .env and prepare run the database migrations:
yarn db:prepare
yarn db:migrateNote, that any schema changes in schema.graphql would require a fresh database. You may drop the old one database and rerun the model generation and schema migrations using a single command
yarn rebuildNB! Don't use in production, as it will delete all the existing records.
Then run the processor:
yarn processor:startand the GraphQL server (opens a GraphQL playground at localhost by default):
yarn query-node:start:devRun
yarn indexer:start:devIt will build local images for hydra-indexer and hydra-indexer-gateway and run the docker-compose stack defined in docker-compose-indexer-dev.yml
To run the processor against the local indexer, make sure INDEXER_ENDPOINT_URL is set to the local indexer-gateway (http://localhost:4001/graphql by default).
If there is no public Hydra Indexer readily available, one should set-up a self-hosted indexer and indexer-api-gateway. The simplest way is set it up is to run pre-built docker images for indexer and indexer-api-gateway as defined in docker-compose.yml.