Skip to content

pradyuman-verma/ens-indexing

Repository files navigation

BlockFlow Studio

This is your BlockFlow Studio project.

Configuration (studio.yaml)

BlockFlow Studio uses a YAML configuration file to manage your project settings. The configuration file should be named studio.yaml and located in the root folder of your project. Here are the configuration options:

  • name: The name of your BlockFlow project.

  • description: A description of your BlockFlow project.

  • startBlock: The starting block number from which the instance

  • network: The blockchain network you are working with (e.g., Ethereum, Polygon).

  • userId: You blockflow account userId. (For auth)

  • Resources: An array of configs. Each config is specific to trigger type.

    • name: The name of the contract. (should be camelcase without any spaces)

    • contract: The contract address to sync. (should be in string format)

    • events: The event signature. (generated by studio create command)

    • abi: The path to the ABI file for the contract. (should end with .json)

    • handler: The path to the code Handler file.

How to Use BlockFlow Studio

Project Initialization

To initialize a project in an empty directory, use the blockflow init command. This will open a command prompt where you can configure your project interactively.

blockflow init

Before using other commands mentioned below, update the studio.yaml file with your authenticationId from app.blockflow.network under userId and startBlock for your project.

Instance

Generate Events List

To generate an events list in studio.yaml, which will be used to configure the handler, use the blockflow instance-generate command. This will automatically fetch the added contracts ABIs and update the events/functions list.

blockflow instance-generate

Generate Events Handler

To generate an events handler in studio.yaml, use the blockflow instance-codegen command. The handler will be generated at the config.?handler path with the folder name as config.?name.

blockflow instance-codegen

Test the Code

It is required that you have a mongo db local running at uri "mongodb://localhost:27017" before running tests

To test the code and generate a local mongo database, use the blockflow instance-test command. This will produce a database named blockflow_studio with collection name BLOCKFLOW_TEST_DB

blockflow instance-test

Deploy the Project

Once the project is created and tested, you can deploy it using the blockflow instance-deploy command. This will deploy the handler to the blockflow server for syncing.

blockflow instance-deploy

List of all user instances

To get a list of all user instances, use the blockflow instances-list command. You can specify the network with the -network option.

blockflow instances-list -network <network>

API

Generate API

To generate an API, use the blockflow api-generate command. This command will update the studio.yaml file with api fields

blockflow api-generate

Generate API Code

To generate API code, use the blockflow api-codegen command. it will generate the handler at path specified under studio.yaml under api.handler

blockflow api-codegen

Deploy API

To deploy the API, use the blockflow api-deploy command.

blockflow api-deploy

Get API Info

To get information about a specific API, use the blockflow api-info command. You need to specify the API ID with the -apiId option.

blockflow api-info -apiId <apiId>

CLI Parameters

The CLI commands accept various parameters to customize their behavior. Here are some of them:

  • blockflow instance-test accepts -path to specify the DB output path, -retry to specify the total retries to check for logs, and -startBlock to specify the start block number for testing.
  • blockflow instance-deploy does not accept any additional parameters.
  • blockflow instances-list accepts -network to specify the network.
  • blockflow api-info accepts -apiId to specify the API ID.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published