Skip to content

blockflowlabs/boiler-plate

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)

  • execution: Whether the execution of instances should be 'parallel' or 'sequencial'.

  • 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 userId, projectId 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.

writes to studio.yaml file, should be used with care, we prefer to use it once you init the project

blockflow generate

Generate Handlers

To generate an events handler in studio.yaml, use the blockflow instance-codegen command. The handler will be generated at the Resources?.Trigger?.Handler path.

Once you've everything ready for instances or apis use this command

blockflow 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_STUDIO

blockflow instance-test

you can even provide a start block --startBlock <startBlock>, or range of blocks to test --range 10

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

API

Deploy API

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

blockflow api-deploy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published