Create query node for substrate based chains.
USAGE
$ cli [COMMAND]
COMMANDS
codegen Generate graphql server and block indexer ready to run
Start use CLI by navigate query-node/substrate-query-node/cli
directory then:
$ ./bin/run [COMMAND]
or
$ yarn link
$ cli [COMMAND]
CLI generates a grapqh server and a substrate block indexer.
model/resolver/service
from the schema you will define in the current working directory (cwd). Before starting code generation make sure you have a file named schema.json
inside the cwd and at least one type defination inside it. Later we will see an example how to add a new type defination to our schema.Block indexer consumes produced blocks from a substrate based chain. Before running code generation make sure you have .env
file inside the cwd, and mappings
directory with index.ts
. Which must have variables below with appropriate values:
WS_PROVIDER_ENDPOINT_URI=<provider> # e.g ws://localhost:9944
TYPE_REGISTER_PACKAGE_NAME=<packname> # name of the package to import TYPE_REGISTER_FUNCTION
TYPE_REGISTER_FUNCTION=<register_type> # name of the function that will called for type registration
Typical your cwd should look like this:
├── .env
├── mappings
│ ├── index.ts
└── schema.json
Run cli inside the directory where you put mappings
, .env
, schema.json
.
Cli create a folder named generated
and put everthing inside it.
$ cli codegen
Start graphql server:
$ cd generated/graphql-server
$ yarn start:dev
Start block indexer:
$ cd generated/indexer
$ yarn start
Looking for an existing example check out: joystream-query-node