Predefined Interfaces
The handler code within the subgraph project utilizes predefined interfaces and type utilities, which are imported from the @blockflow-labs/utils
library. This library is pre-installed when you set up your project using the Blockflow CLI, ensuring consistent and maintainable type definitions across your codebase.
IEventContext
IFunctionContext
ILog
ITransaction
IBlock
Purpose
These predefined interfaces and type utilities serve several purposes:
Type Safety: They provide a standardized and strongly-typed structure for working with blockchain data, ensuring type safety and catching potential errors during development.
Code Reusability: By using shared interfaces and types, developers can write reusable code that adheres to consistent data structures, promoting code maintainability and collaboration within teams.
Integration with Subgraph Schema: The interfaces and types are designed to align with the subgraph's schema, facilitating seamless mapping and transformation of blockchain data into the desired database entities.
Documentation and Clarity: Well-defined interfaces and types act as self-documenting code, improving code readability and making it easier for developers to understand and work with the blockchain data structures.