maht0rz / subsquid-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample Hydra Project

This is a sample project generated by hydra-cli scaffold. Experiment by modifying schema.graphql and the mappings in the mappings folder.

Prerequisites

  • Node v14x
  • Docker

Bootstrap

npm ci

# Start postgres instance
docker-compose up db # add optional -d flag to detach from terminal

# Apply pending migrations
npm run db:migrate

# Apply migrations related to processor's state keeping tables
npm run processor:migrate

# Now you can start processing chain data
npm run processor:start

# The above command will block
# Open separate terminal and launch graphql server to query the processed data
npm run query-node:start

If you want start from scratch

# Delete database migrations and other generated files
rm -r db generated types

# Write down your schema.graphql

# Analyze schema.graphql and generate model/server files
npm run codegen

# Analyze database state and create migration to match generated models
npm run db:create-migration

# Review typegen section of manifest.yml

# Generate type definitions for substrate events and extrinsics
npm run typegen

Configuration

Project's configuration is driven by environment variables, defined in .env, and manifest.yml. For more details see https://docs.subsquid.io.

Self-hosted indexer

It is recommeded to use already set up indexer if available, as new indexer typically requires some time to catch up with interesting events.

Have a look at ./indexer/docker-compose.yml for example of how you can set up a self-hosted version.

About


Languages

Language:TypeScript 97.9%Language:Shell 1.6%Language:Dockerfile 0.5%