JSPM

envio

v0.0.0-main-20240717075719-4db839e6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5463
  • Score
    100M100P100Q108042F
  • License GPL-3.0

A latency and sync speed optimized, developer friendly blockchain data indexer.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (envio) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Envio CLI tool

    A fast, reliable, customizable indexing blockchain solution.

    Envio is a reliable real-time indexing solution designed to simplify the ingestion of events from EVM-compatible chains and transform this data into custom GraphQL APIs. These APIs play a pivotal role in enabling seamless user experiences in blockchain application front-ends. With Envio, the emphasis is on refining the developer's experience when using an indexer, ensuring the service is swift, secure, and trustworthy.

    Note: For a thorough understanding and to dive deeper into each feature, refer to the original documentation website.

    Table of Contents

    Note: Envio is built for javascript, typescirpt and rescript. However in this readme we will only use typescript for examples. Refer to the documentation website for full docs.

    Quickstart

    For a slightly larger tutorial please see the Greeter contract tutorial.

    Installation

    Prerequisites

    To install the envio tool globally, run:

    npm i -g envio

    To view the available CLI commands:

    envio --help

    Usage

    Important Commands Overview:

    • envio
    • envio init - Auto-generates configuration, GraphQL schema, and event handlers based on the Greeter template.
    • envio codegen - Generates code after setting configuration and schema files.
    • envio start - Start the indexer.
    • envio dev - Starts all the processes required for local development of the indexer.
    • envio stop - Delete the database and stop all processes

    For a detailed breakdown of commands, refer to the documentation.

    Event Handlers

    After establishing the configuration and schema files, execute:

    npx envio codegen

    Custom code to make it easy to retrieve and process events from our contract is generated. More specifically every event necessitates the registration of two core functions from our generated code:

    • Loader function
    • Handler function

    Loader Function

    Loader functions are responsible for loading specific entities (defined in schema.graphql) to be modified by the event. They are called in the following format:

    <ContractName>Contract_ < EventName > _loader;

    NOTE: the syntax is slightly different for javascript and rescript. See loader docs.

    Handler Function

    Handler functions modify the entities loaded by the loader function. They incorporate the essential logic for updating entities with the raw data produced by the event. They're called as:

    <ContractName>Contract_ < EventName > _handler;

    NOTE: the syntax is slightly different for javascript and rescript. See handler docs.

    For a comprehensive guide on Event Handlers, please refer to the provided documentation.

    Logging

    Logging is integral for tracking the progress and debugging issues in the indexer. Envio utilizes the pino logging library, which can be integrated with tools like kibana to extract metrics and insights.

    For user-level logging, context-based functions are provided:

    • <context>.log.debug
    • <context>.log.info
    • <context>.log.warn
    • <context>.log.error
    • <context>.log.errorWithExn

    Further details about developer logging, including log levels, can be found in the documentation.

    Contribution & Support

    🔧 This product under active development. Please always refer to the main documentation for the latest updates.

    For support and updates, follow Envio on Twitter or join the Discord community.

    If you have specific suggestions or requirements, kindly reach out and contribute to the development of Envio.

    Our common issues page may also have useful help for you