😎CLI Commands

Learn about flair-cli useful tips and features.

Installation

pnpm install --global flair-cli

If you clone the starter-boilerplate you don't need to install flair-cli globally.

Commands

💫 flair auth

Saves your API Key in .flair/api-key file to use when executing other commands:

flair auth

How to get an API Key?

When you run this command for the first time you can generate a new API Key which will be sent to your email.

Need help?

Reach out to our engineers 🙂

💫 flair deploy

Deploys your custom processors and other indexing components to your cluster. Ready to receive new events, or execute backfill requests.

To see full list of arguments run flair deploy --help

Examples:

✨ Deploy your indexing cluster in current directory (where manifest.yml exists):

flair deploy

✨ Get list of recent deployments:

flair deploy list

✨ Watch status of a certain deployment by job id:

flair deploy status XXXX-XXXXX-XXXX

Need help?

Reach out to our engineers 🙂

💫 flair backfill

The backfilling procedure executes your custom processor script for events happened in the past. You can do this for the purpose of testing your scripts (e.g. only running against 100 blocks), or for the purpose of creating a fresh database for all your previous events.

To see full list of arguments run flair backfill --help

Examples:

✨ Backfill first 1000 blocks after the contract deployment:

flair backfill --chain 137 --address '0x000...000' --max-blocks 10000

✨ Backfill recent 10 hours worth of blocks:

flair backfill --chain 137 --min-timestamp '10 hours ago' -d backward

✨ Backfill a specific block range:

flair backfill --chain 137 --address '0x000...000' --block-range '1000:9999'

✨ Backfill multiple addresses from a contracts.csv file, it will start from the deployment block until latest block:

flair backfill --chain 137 --address-file contracts.csv

^ this file must be a CSV with "chainId","address" headers.

✨ Backfill in opposite direction from last block to first:

flair backfill -d backward --chain ...

✨ Backfill for only a specific processor:

flair backfill -p notify-discord --chain ...

✨ Backfill a for a specific job, only if not yet done, based on an idempotency key:

flair backfill -k my-test-attempt-1 --chain ...

Need help?

Reach out to our engineers 🙂

💫 flair logs

Your custom processors can print logs using console.trace, console.debug, console.log or console.error, these logs will automatically be stored with additional useful context such as current chain, current event and transaction hash, which helps you debug issues or confirm if everything works as expected.

This command allows you to watch for your logs based on various tags. To see full list of arguments run flair logs --help

  • You can add as many --tag flags as you need to narrow down.

Examples:

✨ Watch logs generated anywhere on your indexing cluster:

flair logs --watch

✨ Watch logs for a specific processor (based on the "id" from manifest.yml):

flair logs --watch --tag ProcessorId=health-factor-calculator

✨ Logs for a specific transaction hash

flair logs --tag TransactionHash=0x...

✨ Logs for a specific backfill job:

flair logs --tag JobId=XXXX-XXXX-XXXX

✨ Only error logs of a specific processor:

flair logs --tag Level=error --tag ProcessorId=health-factor-calculator

Need help?

Reach out to our engineers 🙂

🤝 Need help or have feedbacks?

We'd love to improve the CLI experience everyday, talk to our engineers.

Last updated