ondratra 8e959e01f5 query node - channel creation fixes пре 3 година
..
bootstrap 835b9dc8fd remove hydra related code пре 4 година
generated ee2e77b3a2 query node - renames thumbnail -> thumbnailPhot, avatar -> avatarPhoto пре 3 година
mappings 8e959e01f5 query node - channel creation fixes пре 3 година
.gitignore 3ef0c05306 add missing export and files generated by warthog пре 4 година
README.md a2ef20dd78 Merge branch 'query_node_mappings' into query_node_generated_files пре 4 година
build.sh c7caa0ecf8 query node - processor types link rework пре 3 година
manifest.yml 030d4682e0 query node - manifest types path fix пре 3 година
package.json 226508d82c query node - hydra version 2.1.0-beta.7 introduction пре 3 година
run-tests.sh f8964d5c18 query-node scripts: remove typeorm cli link hack пре 4 година
schema.graphql 8e959e01f5 query node - channel creation fixes пре 3 година
tmp.sh 1e169b92b9 query node mappings - first prototype пре 4 година

README.md

Query node

This is a query-node project generated by hydra-cli. Experiment by modifying schema.graphql and the mappings in the mappings folder, defined in manifest.yml.

1. Bootstrap

Run

yarn && yarn bootstrap

and generate the model files as defined in schema.graphql, create the database and run all the necessary migrations in one shot.

NB! Don't use in production, as it will delete all the existing records.

2. Generate Types for events and extrinsics

A separate tool Hydra Typegen can be used for generating Typescript classes for the event handlers (the mappings).
Run

yarn typegen

to run the typegen for events and extrinsics defined in manifest.yml (it fetches the metadata from an RPC endpoint and blockhash defined there).

3. Build Mappings

Mappings is a separated TypeScript module created in the mappings folder. The handlers exported by the module should match the ones defined in manifest.yml in the mappings section. Once the necessary files are generated, build it with

yarn mappings:build

4. Run the processor and the GraphQL server

Then run the processor:

yarn processor:start

Afterwards start the GraphQL server in a separate terminal (opens a GraphQL playground at localhost by default):

yarn query-node:start:dev

5. Locally hosted indexer

The Hydra Indexer endpoint used by Hydra processor is defined as environment variable INDEXER_ENDPOINT_URL sourced from .env. There are publicly available Hydra indexers for Polkadot and Subsocial. For other chains, a self-hosted indexer should be used.

The simplest way to run an indexer locally is to run docker-compose-indexer.yml with docker-compose. The following environment variables must be provided:

  • Database connection settings: DB_NAME, DB_HOST, DB_PORT, DB_USER, DB_PASS
  • Chain RPC endpoint: WS_PROVIDER_ENDPOINT_URI
  • If non-standard types are being used by the Substrate runtime, map type definitions in the json format as an external volume

Follow the links for more information about the indexer service and indexer-api-gateway.

Tmp command order

TODO: remove after integration tests are finished and query node runs without any issues

# build everything
yarn
yarn build

running the processor:

cp types/augment/all/defs.json query-node/mappings/lib/generated/types/typedefs.json
docker-compose up -d db
yarn workspace query-node-root db:create
yarn workspace query-node-root db:migrate