mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-12-08 20:24:06 +00:00
* Subscribe to hooks queue in existing watchers * Change naming strategy for generated get and save functions * Push checkpointing job after post-block hook job completed * Using hooks status to ensure their chronological execution * Add default indices to IPLDBlock table * Add kind parameter to getState GQL API * Add checkpoint CLI * Add blockHash arg to checkpoint CLI and update codegen docs * Print out block hash for checkpoint CLI * Use log from debug for logging * Filter using contract at start in hierarchical query * Make kind argument to prepare IPLDBlock required
22 lines
670 B
TypeScript
22 lines
670 B
TypeScript
//
|
|
// Copyright 2021 Vulcanize, Inc.
|
|
//
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import Handlebars from 'handlebars';
|
|
import { Writable } from 'stream';
|
|
|
|
const TEMPLATE_FILE = './templates/watch-contract-template.handlebars';
|
|
|
|
/**
|
|
* Writes the watch-contract file generated from a template to a stream.
|
|
* @param outStream A writable output stream to write the watch-contract file to.
|
|
*/
|
|
export function exportWatchContract (outStream: Writable): void {
|
|
const templateString = fs.readFileSync(path.resolve(__dirname, TEMPLATE_FILE)).toString();
|
|
const template = Handlebars.compile(templateString);
|
|
const events = template({});
|
|
outStream.write(events);
|
|
}
|