UNPKG

envio

Version:

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

290 lines (289 loc) • 8.18 kB
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Envio Config Schema", "description": "Schema for a YAML config for an envio indexer", "type": "object", "properties": { "description": { "description": "Description of the project", "type": [ "string", "null" ] }, "name": { "description": "Name of the project", "type": "string" }, "ecosystem": { "description": "Ecosystem of the project.", "$ref": "#/$defs/EcosystemTag" }, "schema": { "description": "Custom path to schema.graphql file", "type": [ "string", "null" ] }, "output": { "description": "Path where the generated directory will be placed. By default it's 'generated' relative to the current working directory. If set, it'll be a path relative to the config file location.", "type": [ "string", "null" ] }, "contracts": { "description": "Global contract definitions that must contain all definitions except addresses. You can share a single handler/abi/event definitions for contracts across multiple chains.", "type": [ "array", "null" ], "items": { "$ref": "#/$defs/GlobalContract_for_ContractConfig" } }, "networks": { "description": "Configuration of the blockchain networks that the project is deployed on.", "type": "array", "items": { "$ref": "#/$defs/Network" } }, "raw_events": { "description": "If true, the indexer will store the raw event data in the database. This is useful for debugging, but will increase the size of the database and the amount of time it takes to process events (default: false)", "type": [ "boolean", "null" ] }, "preload_handlers": { "description": "Makes handlers run twice to enable preload optimisations. Removes handlerWithLoader API, since it's not needed. (recommended, default: false)", "type": [ "boolean", "null" ] } }, "additionalProperties": false, "required": [ "name", "ecosystem", "networks" ], "$defs": { "EcosystemTag": { "type": "string", "enum": [ "fuel" ] }, "GlobalContract_for_ContractConfig": { "type": "object", "properties": { "name": { "description": "A unique project-wide name for this contract (no spaces)", "type": "string" }, "abi_file_path": { "description": "Relative path (from config) to a json abi.", "type": "string" }, "handler": { "description": "The relative path to a file where handlers are registered for the given contract", "type": "string" }, "events": { "description": "A list of events that should be indexed on this contract", "type": "array", "items": { "$ref": "#/$defs/EventConfig" } } }, "additionalProperties": false, "required": [ "name", "abi_file_path", "handler", "events" ] }, "EventConfig": { "type": "object", "properties": { "type": { "description": "Explicitly set the event type you want to index. It's derived from the event name and fallbacks to LogData.", "anyOf": [ { "$ref": "#/$defs/EventType" }, { "type": "null" } ] }, "name": { "description": "Name of the event in the HyperIndex generated code", "type": "string" }, "logId": { "description": "An identifier of a logged type from ABI. Used for indexing LogData receipts. The option can be omitted when the event name matches the logged struct/enum name.", "type": [ "string", "null" ] } }, "additionalProperties": false, "required": [ "name" ] }, "EventType": { "type": "string", "enum": [ "logData", "mint", "burn", "transfer", "call" ] }, "Network": { "type": "object", "properties": { "id": { "description": "Public chain/network id", "type": "integer", "format": "uint64", "minimum": 0 }, "start_block": { "description": "The block at which the indexer should start ingesting data", "type": "integer", "format": "uint64", "minimum": 0 }, "end_block": { "description": "The block at which the indexer should terminate.", "type": [ "integer", "null" ], "format": "uint64", "minimum": 0 }, "hyperfuel_config": { "description": "Optional HyperFuel Config for additional fine-tuning", "anyOf": [ { "$ref": "#/$defs/HyperfuelConfig" }, { "type": "null" } ] }, "contracts": { "description": "All the contracts that should be indexed on the given network", "type": "array", "items": { "$ref": "#/$defs/NetworkContract_for_ContractConfig" } } }, "additionalProperties": false, "required": [ "id", "start_block", "contracts" ] }, "HyperfuelConfig": { "type": "object", "properties": { "url": { "description": "URL of the HyperFuel endpoint (default: The most stable HyperFuel endpoint for the network)", "type": "string" } }, "additionalProperties": false, "required": [ "url" ] }, "NetworkContract_for_ContractConfig": { "type": "object", "properties": { "name": { "description": "A unique project-wide name for this contract if events and handler are defined OR a reference to the name of contract defined globally at the top level", "type": "string" }, "address": { "description": "A single address or a list of addresses to be indexed. This can be left as null in the case where this contracts addresses will be registered dynamically.", "$ref": "#/$defs/Addresses" }, "start_block": { "description": "The block at which the indexer should start ingesting data for this specific contract. If not specified, uses the network start_block. Can be greater than the network start_block for more specific indexing.", "type": [ "integer", "null" ], "format": "uint64", "minimum": 0 }, "abi_file_path": { "description": "Relative path (from config) to a json abi.", "type": "string" }, "handler": { "description": "The relative path to a file where handlers are registered for the given contract", "type": "string" }, "events": { "description": "A list of events that should be indexed on this contract", "type": "array", "items": { "$ref": "#/$defs/EventConfig" } } }, "additionalProperties": false, "required": [ "name" ] }, "Addresses": { "anyOf": [ { "anyOf": [ { "type": "string" }, { "type": "integer", "format": "uint", "minimum": 0 } ] }, { "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "integer", "format": "uint", "minimum": 0 } ] } } ] } } }