Configuration File

The subgraph.yaml file is the core of a SendBlocks subgraph. It defines the functions that will be triggered by the SendBlocks indexer. The following example demonstrates how to create a simple SendBlocks subgraph that indexes data from the Bored Ape Yacht Club contract on the Ethereum blockchain.

functions:
    - bayc-function:
          chain_id: CHAIN_ETH_MAINNET
          code: functions/sb-bayc.js
          should_send_std_streams: true
          triggers:
              - type: TRIGGER_TYPE_ADDRESS
                address: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"
                locations:
                    - log_emitter

In the example above, the bayc-function function is defined with the following properties:

  • chain_id: The chain ID of the blockchain network where the contract is deployed.
  • code: The path to the JavaScript/TypeScript file that contains the mapping logic.
  • triggers: The triggers that will activate the function. In this case, the function will be triggered by events emitted by the Bored Ape Yacht Club contract.

The function above will be triggered by all the events emitted by the contract so make sure to filter the events in the mapping logic if needed.