mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-02-09 11:32:49 +00:00
* Fix minor linting errors * Fix CLI getters linting errors * Fix resolvers template in codegen * Fix dependencies
49 lines
1.3 KiB
Handlebars
49 lines
1.3 KiB
Handlebars
//
|
|
// Copyright 2022 Vulcanize, Inc.
|
|
//
|
|
|
|
import { CreateCheckpointCmd } 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 = '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);
|
|
|
|
{{#if (subgraphPath)}}
|
|
const { graphWatcher } = await getGraphDbAndWatcher(
|
|
createCheckpointCmd.config.server,
|
|
createCheckpointCmd.clients.ethClient,
|
|
createCheckpointCmd.ethProvider,
|
|
createCheckpointCmd.database.baseDatabase,
|
|
ENTITY_QUERY_TYPE_MAP,
|
|
ENTITY_TO_LATEST_ENTITY_MAP
|
|
);
|
|
|
|
{{/if}}
|
|
await createCheckpointCmd.initIndexer(Indexer{{#if (subgraphPath)}}, graphWatcher{{/if}});
|
|
|
|
await createCheckpointCmd.exec();
|
|
};
|