mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-02-03 08:42:50 +00:00
2417e3feb1
* Fix minor linting errors * Fix CLI getters linting errors * Fix resolvers template in codegen * Fix dependencies
42 lines
1.1 KiB
Handlebars
42 lines
1.1 KiB
Handlebars
//
|
|
// Copyright 2021 Vulcanize, Inc.
|
|
//
|
|
|
|
import { ResetWatcherCmd } from '@cerc-io/cli';
|
|
{{#if (subgraphPath)}}
|
|
import { getGraphDbAndWatcher } from '@cerc-io/graph-node';
|
|
{{/if}}
|
|
|
|
import { Database{{#if (subgraphPath)}}, ENTITY_QUERY_TYPE_MAP, ENTITY_TO_LATEST_ENTITY_MAP{{/if}} } from '../../database';
|
|
import { Indexer } from '../../indexer';
|
|
|
|
export const command = 'watcher';
|
|
|
|
export const desc = 'Reset watcher to a block number';
|
|
|
|
export const builder = {
|
|
blockNumber: {
|
|
type: 'number'
|
|
}
|
|
};
|
|
|
|
export const handler = async (argv: any): Promise<void> => {
|
|
const resetWatcherCmd = new ResetWatcherCmd();
|
|
await resetWatcherCmd.init(argv, Database);
|
|
|
|
{{#if (subgraphPath)}}
|
|
const { graphWatcher } = await getGraphDbAndWatcher(
|
|
resetWatcherCmd.config.server,
|
|
resetWatcherCmd.clients.ethClient,
|
|
resetWatcherCmd.ethProvider,
|
|
resetWatcherCmd.database.baseDatabase,
|
|
ENTITY_QUERY_TYPE_MAP,
|
|
ENTITY_TO_LATEST_ENTITY_MAP
|
|
);
|
|
|
|
{{/if}}
|
|
await resetWatcherCmd.initIndexer(Indexer{{#if (subgraphPath)}}, graphWatcher{{/if}});
|
|
|
|
await resetWatcherCmd.exec();
|
|
};
|