@graphprotocol/indexer-cli

0.21.1 • Public • Published

Graph Protocol Indexer CLI

Installation

The indexer CLI in this repository is an extension for graph-cli. As such they are best installed together.

npm install -g @graphprotocol/graph-cli
npm install -g @graphprotocol/indexer-cli

Usage

Getting help:

$ graph indexer --help

Manage indexer configuration

  indexer                            Manage indexer configuration
  indexer status                     Check the status of an indexer
  indexer rules                      Configure indexing rules
  indexer rules clear (reset)        Clear one or more indexing rules
  indexer rules delete               Remove one or many indexing rules
  indexer rules get                  Get one or more indexing rules
  indexer rules maybe                Index a deployment based on rules
  indexer rules prepare (offchain)   Offchain index a deployment (and start indexing it if necessary)
  indexer rules set                  Set one or more indexing rules
  indexer rules start (always)       Always index a deployment (and start indexing it if necessary)
  indexer rules stop (never)         Never index a deployment (and stop indexing it if necessary)
  indexer disputes                   Configure allocation POI monitoring
  indexer disputes get               Cross-check POIs submitted in the network
  indexer cost                       Manage costing for subgraphs
  indexer cost set model             Update a cost model
  indexer cost set variables         Update cost model variables
  indexer cost delete                Remove one or many cost models
  indexer cost get                   Get cost models and/or variables for one or all subgraphs
  indexer connect                    Connect to indexer management API
  indexer allocations                Manage indexer allocations
  indexer allocations close          Close an allocation
  indexer allocations create         Create an allocation
  indexer allocations get            List one or more allocations
  indexer allocations reallocate     Reallocate to subgraph deployment
  indexer actions                    Manage indexer actions
  indexer actions approve            Approve an action item
  indexer actions cancel             Cancel an item in the queue
  indexer actions delete             Delete one or many actions in the queue
  indexer actions execute            Execute approved items in the action queue
  indexer actions get                List one or more actions
  indexer actions queue              Queue an action item
  indexer actions update             Update one or more actions

Connecting to an indexer management API:

$ graph indexer connect http://url.of.indexer-agent:8000/

Querying indexing rules:

$ graph indexer rules get all
╔════════════════════════════════════════════════════════════════════╤══════════════════════╤═════════════════════════╤═══════════╤═══════════╤══════════╤═════════════════════╤════════╤═══════════════╗
║ deployment                                                         │ allocation           │ maxAllocationPercentage │ minSignal │ maxSignal │ minStake │ minAverageQueryFees │ custom │ decisionBasis ║
╟────────────────────────────────────────────────────────────────────┼──────────────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ global                                                             │ 0.000000000000000001 │                         │           │           │          │                     │        │ rules         ║
╟────────────────────────────────────────────────────────────────────┼──────────────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 │                      │                         │           │           │          │                     │        │ always        ║
╚════════════════════════════════════════════════════════════════════╧══════════════════════╧═════════════════════════╧═══════════╧═══════════╧══════════╧═════════════════════╧════════╧═══════════════╝

Start subgraph deployments:

$ graph indexer rules start 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3
╔════════════════════════════════════════════════════════════════════╤════════════╤═════════════════════════╤═══════════╤═══════════╤══════════╤═════════════════════╤════════╤═══════════════╗
║ deployment                                                         │ allocation │ maxAllocationPercentage │ minSignal │ maxSignal │ minStake │ minAverageQueryFees │ custom │ decisionBasis ║
╟────────────────────────────────────────────────────────────────────┼────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 │            │                         │           │           │          │                     │        │ always        ║
╚════════════════════════════════════════════════════════════════════╧════════════╧═════════════════════════╧═══════════╧═══════════╧══════════╧═════════════════════╧════════╧═══════════════╝

Offchain index subgraph:

$ graph indexer rules offchain 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3
╔════════════════════════════════════════════════════════════════════╤════════════╤═════════════════════════╤═══════════╤═══════════╤══════════╤═════════════════════╤════════╤═══════════════╗
║ deployment                                                         │ allocation │ maxAllocationPercentage │ minSignal │ maxSignal │ minStake │ minAverageQueryFees │ custom │ decisionBasis ║
╟────────────────────────────────────────────────────────────────────┼────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 │            │                         │           │           │          │                     │        │ offchain      ║
╚════════════════════════════════════════════════════════════════════╧════════════╧═════════════════════════╧═══════════╧═══════════╧══════════╧═════════════════════╧════════╧═══════════════╝

Stopping subgraph deployments:

$ graph indexer rules stop 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3
╔════════════════════════════════════════════════════════════════════╤════════════╤═════════════════════════╤═══════════╤═══════════╤══════════╤═════════════════════╤════════╤═══════════════╗
║ deployment                                                         │ allocation │ maxAllocationPercentage │ minSignal │ maxSignal │ minStake │ minAverageQueryFees │ custom │ decisionBasis ║
╟────────────────────────────────────────────────────────────────────┼────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 │            │                         │           │           │          │                     │        │ never         ║
╚════════════════════════════════════════════════════════════════════╧════════════╧═════════════════════════╧═══════════╧═══════════╧══════════╧═════════════════════╧════════╧═══════════════╝

Tweak global indexing rules:

$ graph indexer rules set global minSignal 10000 minAverageQueryFees 50
╔════════════╤══════════════════════╤═════════════════════════╤═══════════╤═══════════╤══════════╤═════════════════════╤════════╤═══════════════╗
║ deployment │ allocation           │ maxAllocationPercentage │ minSignal │ maxSignal │ minStake │ minAverageQueryFees │ custom │ decisionBasis ║
╟────────────┼──────────────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ global     │ 0.000000000000000001 │                         │ 10000.0   │           │          │ 50.0                │        │ rules         ║
╚════════════╧══════════════════════╧═════════════════════════╧═══════════╧═══════════╧══════════╧═════════════════════╧════════╧═══════════════╝

Tweak deployment specific indexing rules:

$ graph indexer rules set 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 decisionBasis rules minStake 999
╔════════════════════════════════════════════════════════════════════╤════════════╤═════════════════════════╤═══════════╤═══════════╤══════════╤═════════════════════╤════════╤═══════════════╗
║ deployment                                                         │ allocation │ maxAllocationPercentage │ minSignal │ maxSignal │ minStake │ minAverageQueryFees │ custom │ decisionBasis ║
╟────────────────────────────────────────────────────────────────────┼────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 │            │                         │           │           │ 999.0    │                     │        │ rules         ║
╚════════════════════════════════════════════════════════════════════╧════════════╧═════════════════════════╧═══════════╧═══════════╧══════════╧═════════════════════╧════════╧═══════════════╝

Clear indexing rules:

$ graph indexer rules clear 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 minStake
╔════════════════════════════════════════════════════════════════════╤════════════╤═════════════════════════╤═══════════╤═══════════╤══════════╤═════════════════════╤════════╤═══════════════╗
║ deployment                                                         │ allocation │ maxAllocationPercentage │ minSignal │ maxSignal │ minStake │ minAverageQueryFees │ custom │ decisionBasis ║
╟────────────────────────────────────────────────────────────────────┼────────────┼─────────────────────────┼───────────┼───────────┼──────────┼─────────────────────┼────────┼───────────────╢
║ 0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3 │            │                         │           │           │          │                     │        │ rules         ║
╚════════════════════════════════════════════════════════════════════╧════════════╧═════════════════════════╧═══════════╧═══════════╧══════════╧═════════════════════╧════════╧═══════════════╝

Working with the repo

CLI tests

The CLI tests execute the command externally and use a directory of reference files as the expected outputs. In order to create new reference files it is recommended to use the following steps.

  • Install strip-ansi to strip ansi color codes from CLI command stdout and stderr output
    • npm install --global strip-ansi-cli
  • Produce reference output file by piping command output through stip-ansi before saving to file
    • Ex: ./bin/graph-indexer indexer rules get | strip-ansi | src/__tests__/references/indexer-rules-command-no-args.stdout

Copyright

Copyright © 2020 The Graph Foundation

Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i @graphprotocol/indexer-cli

Weekly Downloads

36

Version

0.21.1

License

MIT

Unpacked Size

222 kB

Total Files

45

Last publish

Collaborators

  • andras_en
  • migueldeelias
  • saihaj
  • pcarranzav_edgeandnode
  • edge-and-node
  • lnsd
  • neysofu
  • tmigone
  • dotansimha
  • nasmr
  • benface
  • jannispohlmann
  • fordn
  • lutter
  • zerim
  • martintel
  • abarmat
  • jcarpanelli
  • juanmardefago
  • dnfodjo
  • theodus
  • iain_mccown
  • cmwhited
  • adam-en
  • schmidsi