streamingfast / substreams

Powerful Blockchain streaming data engine, based on StreamingFast Firehose technology.
Apache License 2.0
160 stars 45 forks source link

Include `blockFilter` in Mermaid graphs #469

Open DenisCarriere opened 4 months ago

DenisCarriere commented 4 months ago

The Mermaid graphs do not visualize the connection of blockFilter::module when using BlockIndex

Example substreams.yaml

  - name: index_transactions
    kind: blockIndex
    inputs:
      - map: map_transactions
    output:
      type: proto:sf.substreams.index.v1.Keys

  - name: map_transactions
    kind: map
    doc: Extracts Inscription transactions from the block
    inputs:
      - source: sf.ethereum.type.v2.Block
    output:
      type: proto:inscriptions.types.v1.Transactions

  - name: map_operations
    kind: map
    doc: Extracts Inscription operation events from the block
    inputs:
      - map: map_transactions
    blockFilter:
      module: index_transactions
      query:
        string: inscriptions
        params: false
    output:
      type: proto:inscriptions.types.v1.Operations

❌ Current Mermiad

graph TD;
  map_transactions --> index_transactions;
  map_transactions[map: map_transactions];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_transactions;
  map_operations[map: map_operations];
  map_transactions --> map_operations;

✅ Expected Mermaid

by adding index_transactions -.-> |blockIndex| map_operations;

graph TD;
  map_transactions --> index_transactions;
  index_transactions -.-> |blockIndex| map_operations;
  map_transactions[map: map_transactions];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_transactions;
  map_operations[map: map_operations];
  map_transactions --> map_operations;