Prathamesh Musale
45e4fca670
Part of [Generate watchers for sushiswap subgraphs deployed in graph-node](https://www.notion.so/Generate-watchers-for-sushiswap-subgraphs-deployed-in-graph-node-b3f2e475373d4ab1887d9f8720bd5ae6) Co-authored-by: neeraj <neeraj.rtly@gmail.com> Reviewed-on: cerc-io/sushiswap-watcher-ts#3 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
//
|
|
// Copyright 2022 Vulcanize, Inc.
|
|
//
|
|
|
|
import { CreateCheckpointCmd } from '@cerc-io/cli';
|
|
import { getGraphDbAndWatcher } from '@cerc-io/graph-node';
|
|
|
|
import { Database, ENTITY_QUERY_TYPE_MAP, ENTITY_TO_LATEST_ENTITY_MAP } from '../../database';
|
|
import { Indexer } from '../../indexer';
|
|
|
|
export const command = 'create';
|
|
|
|
export const desc = 'Create checkpoint';
|
|
|
|
export const builder = {
|
|
address: {
|
|
type: 'string',
|
|
require: true,
|
|
demandOption: true,
|
|
describe: 'Contract address to create the checkpoint for.'
|
|
},
|
|
blockHash: {
|
|
type: 'string',
|
|
describe: 'Blockhash at which to create the checkpoint.'
|
|
}
|
|
};
|
|
|
|
export const handler = async (argv: any): Promise<void> => {
|
|
const createCheckpointCmd = new CreateCheckpointCmd();
|
|
await createCheckpointCmd.init(argv, Database);
|
|
|
|
const { graphWatcher } = await getGraphDbAndWatcher(
|
|
createCheckpointCmd.config.server,
|
|
createCheckpointCmd.clients.ethClient,
|
|
createCheckpointCmd.ethProvider,
|
|
createCheckpointCmd.database.baseDatabase,
|
|
ENTITY_QUERY_TYPE_MAP,
|
|
ENTITY_TO_LATEST_ENTITY_MAP
|
|
);
|
|
|
|
await createCheckpointCmd.initIndexer(Indexer, graphWatcher);
|
|
|
|
await createCheckpointCmd.exec();
|
|
};
|