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.
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...
});Before running the indexer locally, make sure you have the following installed:
Add your Solana RPC URL to the .env file:
ENVIO_MAINNET_RPC_URL=https://your-solana-rpc-endpoint
Start the indexer:
pnpm devIf you make changes to config.yaml or schema.graphql, regenerate the type files:
pnpm codegenWhile the indexer is running, visit the Envio Console (https://envio.dev/console) to open the GraphQL Playground and query your indexed data.