3.0.0 • Published 3 years ago

@dzlzv/hydra-processor v3.0.0

Weekly downloads
410
License
MIT
Repository
-
Last release
3 years ago

Hydra processor

Hydra processor is a client-side 'sink' tool used to fetch substrate events from a Hydra indexer. It sequentially applies the event handlers one by one in the order the events have been emitted.

Usage

Before the first run, the processor should set up auxiliary database tables required for its stable work:

hydra-processor migrate 

Then hydra-processor can be run against the manifest file (by default, it looks up manifest.yml in the current folder)

hydra-processor run -m <path/to/manifest> -e <path to a file with env variables>

Hydra processor requires a manifest file and certain environment variables to be set.

Environment varibables

VariableDefaultRequiredDescription
INDEXER_ENDPOINT_URL-YesHydra indexer endpoint to source the raw event and extrinsic data
MANIFEST_PATHmanifest.ymlNoPath to the manifest file
DB_NAME-YesDatabase name
DB_PORT-YesDatabase port
DB_HOST-YesDatabase host
DB_USER-YesDatabase user
DB_PASS-YesDatabase password
PROMETHEUS_PORT3000NoA prometheus metrics endpoint is started at this port
POLL_INTERVAL_MS1 sec (60000 msec)NoHow often the processor polls the indexer for new blocks

The required variables can either be set externally or loaded from a file using the -e flag, e.g.:

hydra-processor migrate -e .env

Manifest file

The manifest file describes which and how the events and extrinsics should be processed. Here is an example for Kusama blockchain:

version: '0.1'
description: Test manifest
repository: https://github.com/
## currently only these settings for the datasouce section are accepted
dataSource:
  kind: substrate 
  chain: kusama
  indexerVersion: '0.0.4'
# compiled model classes generated by hydra-cli codegen from the input schema 
entities:
  - mappings/lib/generated/**/*.model.js
mappings:
  hydraCommonVersion: '0.0.3'
  # process only blocks with height >= 1M 
  blockInterval: '[1000000,]'
  # js module that exports the handler functions 
  mappingsModule: mappings/lib/mappings
  # additinal libraries the processor loads
  # typically it is a module with event and extrinsic types generated by hydra-typegen 
  imports:
    - mappings/lib/mappings/generated/types
  eventHandlers:
  # event name
    - event: balances.Transfer 
  # function handler name with the argument types
      handler: balancesTransfer(DatabaseManager, Balances.TransferEvent)
  extrinsicHandlers:
    # infer defaults here
    #- extrinsic: Balances.Transfer 
    #- extrinsic: Sudo.batchCall 
    #  handler: handleSudoCall(DatabaseManager,SubstrateEvent)
  preBlockHooks:
  postBlockHooks:
3.0.1-alpha.2

3 years ago

3.0.1-alpha.1

3 years ago

3.1.0-alpha.0

3 years ago

3.0.0-beta.1

3 years ago

3.0.0-beta.0

3 years ago

3.0.0-beta.3

3 years ago

3.0.0-beta.4

3 years ago

3.0.0-beta.7

3 years ago

3.0.0-beta.6

3 years ago

3.0.0-hydra-v3.0

3 years ago

3.0.0

3 years ago

2.1.0-beta.8

3 years ago

2.1.0-beta.7

3 years ago

2.1.0-beta.6

3 years ago

2.1.0-beta.3

3 years ago

2.1.0-beta.4

3 years ago

2.0.1-beta.17

3 years ago

2.0.1-beta.16

3 years ago

2.0.1-beta.15

3 years ago

2.0.1-beta.11

3 years ago

2.0.1-beta.8

3 years ago

2.0.1-beta.9

3 years ago

2.0.1-beta.6

3 years ago

2.0.1-beta.7

3 years ago

2.0.1-beta.3

3 years ago

2.1.0-beta.1

3 years ago

2.1.0-beta.2

3 years ago

2.1.0-beta.0

3 years ago

2.0.0-beta

3 years ago

2.0.1-beta.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago