Skip to content

subsquid-labs/squid-with-tests

Repository files navigation

Squid with tests

This squid captures Transfer(address,address,uint256) events emitted by the contract at env.CONTRACT_ADDRESS (USDC token contract by default). It keeps up with network updates in real time. Balances of individual accounts are computed and kept up to date.

The handler function for batches of Transfers lives in a separate module and has a test. The test can run locally or as a GitHub Action.

Dependencies: Node.js v20 or newer, Docker.

Quickstart

git clone https://github.com/subsquid-labs/squid-with-tests
cd squid-with-tests
docker compose up -d
npm run build
npx squid-typeorm-migration apply
node -r dotenv/config lib/main.js

then in a separate terminal

npx squid-graphql-server

A GraphiQL playground will be available at localhost:4350/graphql.

Testing

Enter the project folder and make sure that the database is up:

docker compose up -d

then run

npm test

About

A squid showing one approach to testing the indexing code

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors