# Install @subsquid/cli - the `sqd` command globally
npm i -g @subsquid/cli
# Install dependencies
npm cisqd typegen
yarn codegen && yarn migration:generate
yarn setup && yarn process:lrt
sqd serveWith sqd serve a GraphiQL playground will be available at localhost:4350/graphql.
BLOCK_FROM=18421105 yarn process:lrt # Start processing at block 18421105
BLOCK_TO=18421105 yarn process:lrt # Process up to block 18421105Start development by defining the schema of the target database via schema.graphql.
Schema definition consists of regular graphql type declarations annotated with custom directives.
Full description of schema.graphql dialect is available here.
Mapping developers use TypeORM EntityManager
to interact with target database during data processing. All necessary entity classes are
generated by the squid framework from schema.graphql. This is done by running yarn codegen
command.
All database changes are applied through migration files located at db/migrations.
There is only ever one migration.
yarn migration:generateSee docs on database migrations for more details.
It is necessary to import the respective ABI definition to decode EVM logs. One way to generate a type-safe facade class
to decode EVM logs is by placing the relevant JSON ABIs to ./abi, then using squid-evm-typegen(1) via an sqd
script:
sqd typegenSee more details on the squid-evm-typegen doc page.
Squid tools assume a certain project layout:
- All compiled js files must reside in
liband all TypeScript sources insrc. The layout oflibmust reflectsrc. - All TypeORM classes must be exported by
src/model/index.ts(lib/modelmodule). - Database schema must be defined in
schema.graphql. - Database migrations must reside in
db/migrationsand must be plain js files. sqd(1)andsquid-*(1)executables consult.envfile for environment variables.
- Visit Squid deploy dashboard
- Auth with
sqd auth -k sqd_XXX(key is on squid deploy page) - Update
squid.yamlto set the correct version - Run
sqd deploy . - Make branch for new version (eg v9) and push to origin
- Switch back to main branch