Skip to content

v0.2.0

Choose a tag to compare

@DenisCarriere DenisCarriere released this 05 Oct 17:53
· 18 commits to main since this release

What's New?

  • add TypeBox Static Type Resolution

Substreams Sink Entity Changes

Buf Protobuf codegen & TypeBox for EntityChanges.

Quickstart

$ npm install @substreams/sink-entity-changes
import { typebox, entity_pb } from "@substreams/sink-entity-changes"

Protobuf

message EntityChanges {
  repeated EntityChange entity_changes = 5;
}

message EntityChange {
  string entity = 1;
  string id = 2;
  Operation operation = 4;
  repeated Field fields = 5;
}

Using Buf Protobuf codegen

import { EntityChanges } from "@substreams/sink-entity-changes/entity_pb"
...

const emitter = new BlockEmitter(transport, request, registry);

// Stream EntityChanges
emitter.on("output", (output: EntityChanges) => {
  for ( const entityChange of output.entityChanges) {
    console.log(entityChange);
  }
});

Using TypeBox Static Type Resolution

import { EntityChanges } from "@substreams/sink-entity-changes/typebox"
...

const emitter = new BlockEmitter(transport, request, registry);

emitter.on("anyMessage", (message: EntityChanges) => {
  for ( const entityChange of message.entityChanges) {
    console.log(entityChange);
  }
});