encodeEvents method

RawBlockEvents encodeEvents(
  1. DecodedBlockEvents decodedBlockEvents
)

Implementation

RawBlockEvents encodeEvents(DecodedBlockEvents decodedBlockEvents) {
  final blockNumber = decodedBlockEvents.blockNumber;

  final VersionDescription? versionDescription =
      getVersionDescription(blockNumber);

  // Check if this is not empty, throw Exception if it is.
  if (versionDescription == null) {
    throw BlockNotFoundException(blockNumber);
  }

  final output = HexOutput();

  versionDescription.chainInfo.scaleCodec
      .encodeTo('EventCodec', decodedBlockEvents.events, output);

  return RawBlockEvents(blockNumber: blockNumber, events: output.toString());
}