The implementation Snapshot Subgraph with Squid SDK. Dependencies: Node.js, Docker.
# 0. Install @subsquid/cli a.k.a. the sqd command globally
npm i -g @subsquid/cli
# 1. Clone repository
git clone https://github.com/0xNomind/snapshot-squid.git
# 2. Go to folder
cd snapshot-squid
# 3. Rename .env.example to .env
# 4. Install dependencies
npm ci
# 5. Start a Postgres database container and detach
sqd up
# 6. Migrate database
sqd migration:generate
# 7. Build and start the processor
sqd process
# 8. The command above will block the terminal
# being busy with fetching the chain data,
# transforming and storing it in the target database.
#
# To start the graphql server open the separate terminal
# and run
sqd serve
A GraphiQL playground will be available at localhost:4350/graphql.
query MyQuery {
delegations(limit: 5) {
id
delegator
space
delegate
}
blockEntities(limit: 5) {
id
number
timestamp
}
}
{
delegations(first: 5) {
id
delegator
space
delegate
}
blocks(first: 5) {
id
number
timestamp
}
}