Skip to content

Latest commit

 

History

History
85 lines (72 loc) · 1.99 KB

README.md

File metadata and controls

85 lines (72 loc) · 1.99 KB

Subsquid Logo

Snapshot Squid

The implementation Snapshot Subgraph with Squid SDK. Dependencies: Node.js, Docker.

Quickstart

# 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 Examples

Squid Query

query MyQuery {
 delegations(limit: 5) {
    id
    delegator
    space
    delegate
  }
  blockEntities(limit: 5) {
    id
    number
    timestamp
  }
}

Output

Screenshot from 2023-10-02 00-41-39

Graph Query

{
  delegations(first: 5) {
    id
    delegator
    space
    delegate
  }
  blocks(first: 5) {
    id
    number
    timestamp
  }
}

Output

Screenshot from 2023-10-02 00-46-42