The handlers take data from a particular source and transform it into entities that are defined within your schema. Handlers are written in TypeScript.
For each handler that is defined in studio.yaml under triggers, create an exported function of the same name in src/handlers folder.
blockflowcodegen
Use above command to generate boilerplate code in path specified in studio.yaml
Handlers boilerplate
Based on the trigger-type contract/function or contract/event code vary.
Function Handler Code
import{ IFunctionContext, IBind, ISecrets }from"@blockflow-labs/utils";/** * @dev Function::approve(address _spender, uint256 _value) * @paramcontext trigger object with contains {functionParams: {_spender ,_value }, transaction, block} * @parambind init function for database wrapper methods*/exportconstapproveHandler=async (context:IFunctionContext,bind:IBind,secrets:ISecrets,) =>{ // Implement your function handler logic for approve hereconst{functionParams,transaction,block}= context;const{_spender,_value}= functionParams;};