Skip to content

threefoldtech/tfchain_graphql

Repository files navigation

Tfchain graphql

Subsquid is used to index and provide a graphql interface on top of tfchain.

Concept

The substrate events are processed in a multi-step pipeline:

Tfchain => Squid Indexer => Indexer GraphQL gateway => Squid Processor => Database => Query Node GraphQL endpoint

Bird eye overview

Prerequisites

  • Node v16x
  • Docker
  • Docker-compose

Running

see docs

Project layout

  • indexer - docker-compose setup for the indexer
  • db - Processor db migration files
  • scripts - Scripts for generating initial state and development scripts
  • src - Source
    • mappings - Mapper functions for the indexer data
    • model - Generated models from the schema.graphql file
    • types - Type files that require manual edit if the schema changes / or chain types change
    • processor.ts - Processor entrypoint
  • typegen - Where the declaration files are generated from (used for development)
    • tfchainVersions.jsonl - Generated tfchain runtime versions and their data
    • typegen.json - Typegen config
    • typesBundle.json - Typegen bundle config
  • schema.graphql - The graphql schema file, changes to this file will results in changes to the models (src/models)