Skip to content

enviodev/scaffold-eth-2-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Scaffold-ETH 2 + Envio Indexer Extension

This extension adds automatic Envio indexer generation to your Scaffold-ETH 2 project, allowing you to index all your deployed smart contracts and query their data through a GraphQL API.

✨ What It Does

  • πŸ” Generates boilerplate Envio indexer from your deployed Scaffold-ETH contracts
  • πŸ“Š Status dashboard with links to Envio metrics and database
  • πŸ”„ One-click regeneration to update the indexer when you deploy new contracts
  • 🎯 Automatic event detection from your contract ABIs
  • πŸ“ˆ GraphQL API for querying your indexed blockchain data

πŸ”§ Available Commands

cd packages/envio

pnpm update   # Generate indexer from deployed contracts
pnpm codegen  # Generate TypeScript types
pnpm dev      # Start indexer in development mode
pnpm start    # Start indexer in production mode
pnpm test     # Run indexer tests

πŸš€ Quick Start

Prerequisites

  • Node.js v20 (required)
  • pnpm (for Envio indexer)
  • Docker (for running the indexer)
  • Yarn (for Scaffold-ETH)

Setup

  1. Deploy your contracts: yarn deploy
  2. Generate the indexer: cd packages/envio && pnpm install && pnpm update && pnpm codegen
  3. Start the indexer: pnpm dev
  4. Access the dashboard at http://localhost:3000/envio

πŸ”„ Regenerating the Indexer

Via Frontend: Go to http://localhost:3000/envio and click "Regenerate Boilerplate Indexer"

Via Command Line: cd packages/envio && pnpm update && pnpm codegen

πŸ“ Generated Files

The extension generates these files in packages/envio/:

  • config.yaml - Indexer configuration with your contracts and events
  • schema.graphql - GraphQL schema based on your contract events
  • src/EventHandlers.ts - TypeScript event handlers

πŸ› Troubleshooting

Indexer not starting: Check Docker is running, then cd packages/envio && pnpm dev

Contract not indexed: cd packages/envio && pnpm update && pnpm codegen && pnpm dev

Dashboard not loading: Ensure indexer (pnpm dev) and frontend (yarn start) are running

πŸš€ Production Deployment

  1. Deploy contracts: yarn deploy
  2. Update indexer: cd packages/envio && pnpm update
  3. Start indexer: pnpm start

πŸ“Š What Gets Indexed

  • All contract events from your deployed contracts
  • Event parameters with proper type mapping
  • Block and transaction data for each event
  • Timestamps and block numbers for historical queries

Happy Indexing! πŸš€

For more information about Envio, visit the official documentation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published