Skip to content

enviodev/solana-stables-indexer

Repository files navigation

Solana Block Handler

Please refer to the documentation website for a thorough guide on all Envio indexer features

This example demonstrates how to index Solana blocks using a block handler. The handler fetches block data from a Solana RPC endpoint and stores block information.

For more information, see the block handlers documentation.

Block Handler

The onBlock handler is triggered for each block at the specified interval. This example uses an effect to fetch additional block data from the Solana RPC:

onBlock({ chain: 0, name: "BlockTracker" }, async ({ slot, context }) => {
  const block = await context.effect(getBlockEffect, { slot });
  // Process block data...
});

Prerequisites

Before running the indexer locally, make sure you have the following installed:

Configuration

Add your Solana RPC URL to the .env file:

ENVIO_MAINNET_RPC_URL=https://your-solana-rpc-endpoint

Running the Indexer

Start the indexer:

pnpm dev

If you make changes to config.yaml or schema.graphql, regenerate the type files:

pnpm codegen

GraphQL Playground

While the indexer is running, visit the Envio Console (https://envio.dev/console) to open the GraphQL Playground and query your indexed data.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors