diff --git a/packages/erc20-watcher/src/indexer.ts b/packages/erc20-watcher/src/indexer.ts index 4f4de2f4..99527899 100644 --- a/packages/erc20-watcher/src/indexer.ts +++ b/packages/erc20-watcher/src/indexer.ts @@ -354,7 +354,12 @@ export class Indexer implements IndexerInterface { async processCLICheckpoint (contractAddress: string, blockHash?: string): Promise { // TODO Implement - return ''; + return undefined; + } + + async getStateByCID (cid: string): Promise { + // TODO Implement + return undefined; } parseEventNameAndArgs (kind: string, logObj: any): any { diff --git a/packages/uni-info-watcher/src/cli/inspect-cid.ts b/packages/uni-info-watcher/src/cli/inspect-cid.ts index 07fc894b..97ee586e 100644 --- a/packages/uni-info-watcher/src/cli/inspect-cid.ts +++ b/packages/uni-info-watcher/src/cli/inspect-cid.ts @@ -2,15 +2,12 @@ // Copyright 2022 Vulcanize, Inc. // -import assert from 'assert'; -import yargs from 'yargs'; import 'reflect-metadata'; import debug from 'debug'; -import util from 'util'; +import { InspectCIDCmd } from '@cerc-io/cli'; import { Client as ERC20Client } from '@vulcanize/erc20-watcher'; import { Client as UniClient } from '@vulcanize/uni-watcher'; -import { DEFAULT_CONFIG_PATH, JobQueue, getConfig, initClients } from '@cerc-io/util'; import { Config } from '@vulcanize/util'; import { Database } from '../database'; @@ -19,40 +16,9 @@ import { Indexer } from '../indexer'; const log = debug('vulcanize:inspect-cid'); const main = async (): Promise => { - const argv = await yargs.parserConfiguration({ - 'parse-numbers': false - }).options({ - configFile: { - alias: 'f', - type: 'string', - require: true, - demandOption: true, - describe: 'Configuration file path (toml)', - default: DEFAULT_CONFIG_PATH - }, - cid: { - alias: 'c', - type: 'string', - demandOption: true, - describe: 'CID to be inspected' - } - }).argv; - - const config: Config = await getConfig(argv.configFile); - const { ethClient, ethProvider } = await initClients(config); - - const db = new Database(config.database, config.server); - await db.init(); - - const jobQueueConfig = config.jobQueue; - assert(jobQueueConfig, 'Missing job queue config'); - - const { dbConnectionString, maxCompletionLagInSecs } = jobQueueConfig; - assert(dbConnectionString, 'Missing job queue db connection string'); - - const jobQueue = new JobQueue({ dbConnectionString, maxCompletionLag: maxCompletionLagInSecs }); - await jobQueue.start(); + const inspectCIDCmd = new InspectCIDCmd(); + const config: Config = await inspectCIDCmd.initConfig(); const { uniWatcher, tokenWatcher @@ -61,15 +27,8 @@ const main = async (): Promise => { const uniClient = new UniClient(uniWatcher); const erc20Client = new ERC20Client(tokenWatcher); - const indexer = new Indexer(config.server, db, { uniClient, erc20Client, ethClient }, ethProvider, jobQueue); - await indexer.init(); - - const state = await indexer.getStateByCID(argv.cid); - assert(state, 'State for the provided CID doesn\'t exist.'); - - const stateData = await indexer.getStateData(state); - - log(util.inspect(stateData, false, null)); + await inspectCIDCmd.init(Database, Indexer, { uniClient, erc20Client }); + await inspectCIDCmd.exec(); }; main().catch(err => { diff --git a/packages/uni-watcher/src/indexer.ts b/packages/uni-watcher/src/indexer.ts index d9edb91e..d671a7ef 100644 --- a/packages/uni-watcher/src/indexer.ts +++ b/packages/uni-watcher/src/indexer.ts @@ -135,7 +135,12 @@ export class Indexer implements IndexerInterface { async processCLICheckpoint (contractAddress: string, blockHash?: string): Promise { // TODO Implement - return ''; + return undefined; + } + + async getStateByCID (cid: string): Promise { + // TODO Implement + return undefined; } parseEventNameAndArgs (kind: string, logObj: any): any {