From 4f85b29c25a5e862b811ff14e3484e53d613aa33 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Fri, 25 Nov 2022 11:24:26 +0530 Subject: [PATCH 1/2] Remove unnecessary package --- packages/erc20-watcher/package.json | 1 - packages/erc20-watcher/src/server.ts | 1 - packages/uni-info-watcher/package.json | 1 - packages/uni-watcher/package.json | 1 - packages/uni-watcher/src/server.ts | 1 - yarn.lock | 5 ----- 6 files changed, 10 deletions(-) diff --git a/packages/erc20-watcher/package.json b/packages/erc20-watcher/package.json index 1d41953e..7026d5ea 100644 --- a/packages/erc20-watcher/package.json +++ b/packages/erc20-watcher/package.json @@ -51,7 +51,6 @@ "debug": "^4.3.1", "ethers": "^5.2.0", "express": "^4.18.2", - "graphql-import-node": "^0.0.4", "graphql-request": "^3.4.0", "graphql-subscriptions": "^2.0.0", "json-bigint": "^1.0.0", diff --git a/packages/erc20-watcher/src/server.ts b/packages/erc20-watcher/src/server.ts index fb16d835..ce7a542c 100644 --- a/packages/erc20-watcher/src/server.ts +++ b/packages/erc20-watcher/src/server.ts @@ -3,7 +3,6 @@ // import debug from 'debug'; -import 'graphql-import-node'; import { ServerCmd } from '@cerc-io/cli'; diff --git a/packages/uni-info-watcher/package.json b/packages/uni-info-watcher/package.json index e99ddf44..6420cd65 100644 --- a/packages/uni-info-watcher/package.json +++ b/packages/uni-info-watcher/package.json @@ -20,7 +20,6 @@ "debug": "^4.3.1", "express": "^4.18.2", "graphql": "^15.5.0", - "graphql-import-node": "^0.0.4", "graphql-request": "^3.4.0", "graphql-subscriptions": "^2.0.0", "json-bigint": "^1.0.0", diff --git a/packages/uni-watcher/package.json b/packages/uni-watcher/package.json index 8e5fa37c..1043bfc0 100644 --- a/packages/uni-watcher/package.json +++ b/packages/uni-watcher/package.json @@ -48,7 +48,6 @@ "debug": "^4.3.1", "ethers": "^5.2.0", "express": "^4.18.2", - "graphql-import-node": "^0.0.4", "graphql-request": "^3.4.0", "graphql-subscriptions": "^2.0.0", "lodash": "^4.17.21", diff --git a/packages/uni-watcher/src/server.ts b/packages/uni-watcher/src/server.ts index 078a3f89..6d9ebdc8 100644 --- a/packages/uni-watcher/src/server.ts +++ b/packages/uni-watcher/src/server.ts @@ -3,7 +3,6 @@ // import debug from 'debug'; -import 'graphql-import-node'; import { ServerCmd } from '@cerc-io/cli'; diff --git a/yarn.lock b/yarn.lock index 1057a6fe..ba6a7911 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5494,11 +5494,6 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== -graphql-import-node@^0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/graphql-import-node/-/graphql-import-node-0.0.4.tgz#0522f058978c7e1b99d1e6be1b851ee17007b111" - integrity sha512-okpdABQIgIM0qdx9Mfgdu6fTsFEazZmHZdEU34cijkUj9D1db1SyPRGHPxbXmbacamhEF41ckxpCAgHiGliryQ== - graphql-request@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-3.4.0.tgz#3a400cd5511eb3c064b1873afb059196bbea9c2b" From 186b26ba8bbc3e047903a51b585d359295ec3daf Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Fri, 25 Nov 2022 14:05:46 +0530 Subject: [PATCH 2/2] Use event watcher from watcher-ts util --- packages/erc20-watcher/package.json | 1 - packages/erc20-watcher/src/events.ts | 69 ------------------- packages/erc20-watcher/src/fill.ts | 3 +- packages/erc20-watcher/src/resolvers.ts | 6 +- packages/erc20-watcher/src/server.ts | 3 +- packages/uni-info-watcher/package.json | 1 - .../src/cli/checkpoint-cmds/create.ts | 1 + .../uni-info-watcher/src/cli/export-state.ts | 1 + .../uni-info-watcher/src/cli/import-state.ts | 4 +- .../uni-info-watcher/src/cli/inspect-cid.ts | 1 + .../src/cli/reset-cmds/watcher.ts | 1 + .../src/cli/watch-contract.ts | 1 + packages/uni-info-watcher/src/events.ts | 57 --------------- packages/uni-info-watcher/src/fill.ts | 3 +- packages/uni-info-watcher/src/resolvers.ts | 6 +- packages/uni-info-watcher/src/server.ts | 3 +- packages/uni-watcher/package.json | 1 - packages/uni-watcher/src/events.ts | 67 ------------------ packages/uni-watcher/src/fill.ts | 3 +- packages/uni-watcher/src/resolvers.ts | 6 +- packages/uni-watcher/src/server.ts | 3 +- packages/util/package.json | 1 - 22 files changed, 19 insertions(+), 223 deletions(-) delete mode 100644 packages/erc20-watcher/src/events.ts delete mode 100644 packages/uni-watcher/src/events.ts diff --git a/packages/erc20-watcher/package.json b/packages/erc20-watcher/package.json index 7026d5ea..ee295909 100644 --- a/packages/erc20-watcher/package.json +++ b/packages/erc20-watcher/package.json @@ -52,7 +52,6 @@ "ethers": "^5.2.0", "express": "^4.18.2", "graphql-request": "^3.4.0", - "graphql-subscriptions": "^2.0.0", "json-bigint": "^1.0.0", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13", diff --git a/packages/erc20-watcher/src/events.ts b/packages/erc20-watcher/src/events.ts deleted file mode 100644 index 080bd11e..00000000 --- a/packages/erc20-watcher/src/events.ts +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright 2021 Vulcanize, Inc. -// - -import assert from 'assert'; -import { PubSub } from 'graphql-subscriptions'; - -import { - EventWatcher as BaseEventWatcher, - QUEUE_BLOCK_PROCESSING, - QUEUE_EVENT_PROCESSING, - JobQueue, - IndexerInterface -} from '@cerc-io/util'; -import { EthClient } from '@cerc-io/ipld-eth-client'; - -import { Indexer } from './indexer'; - -export class EventWatcher { - _ethClient: EthClient - _indexer: Indexer - _subscription: ZenObservable.Subscription | undefined - _baseEventWatcher: BaseEventWatcher - _pubsub: PubSub - _jobQueue: JobQueue - - constructor (ethClient: EthClient, indexer: IndexerInterface, pubsub: PubSub, jobQueue: JobQueue) { - assert(ethClient); - assert(indexer); - - this._ethClient = ethClient; - this._indexer = indexer as Indexer; - this._pubsub = pubsub; - this._jobQueue = jobQueue; - this._baseEventWatcher = new BaseEventWatcher(this._ethClient, this._indexer, this._pubsub, this._jobQueue); - } - - getEventIterator (): AsyncIterator { - return this._baseEventWatcher.getEventIterator(); - } - - getBlockProgressEventIterator (): AsyncIterator { - return this._baseEventWatcher.getBlockProgressEventIterator(); - } - - async start (): Promise { - assert(!this._subscription, 'subscription already started'); - - await this.initBlockProcessingOnCompleteHandler(); - await this.initEventProcessingOnCompleteHandler(); - this._baseEventWatcher.startBlockProcessing(); - } - - async stop (): Promise { - this._baseEventWatcher.stop(); - } - - async initBlockProcessingOnCompleteHandler (): Promise { - this._jobQueue.onComplete(QUEUE_BLOCK_PROCESSING, async (job) => { - await this._baseEventWatcher.blockProcessingCompleteHandler(job); - }); - } - - async initEventProcessingOnCompleteHandler (): Promise { - await this._jobQueue.onComplete(QUEUE_EVENT_PROCESSING, async (job) => { - await this._baseEventWatcher.eventProcessingCompleteHandler(job); - }); - } -} diff --git a/packages/erc20-watcher/src/fill.ts b/packages/erc20-watcher/src/fill.ts index 1d16d9c0..3db49afc 100644 --- a/packages/erc20-watcher/src/fill.ts +++ b/packages/erc20-watcher/src/fill.ts @@ -9,14 +9,13 @@ import { FillCmd } from '@cerc-io/cli'; import { Database } from './database'; import { Indexer } from './indexer'; -import { EventWatcher } from './events'; const log = debug('vulcanize:server'); export const main = async (): Promise => { const fillCmd = new FillCmd(); await fillCmd.init(Database); - await fillCmd.initIndexer(Indexer, EventWatcher); + await fillCmd.initIndexer(Indexer); await fillCmd.exec(); }; diff --git a/packages/erc20-watcher/src/resolvers.ts b/packages/erc20-watcher/src/resolvers.ts index b830d4fe..efb5bcc9 100644 --- a/packages/erc20-watcher/src/resolvers.ts +++ b/packages/erc20-watcher/src/resolvers.ts @@ -6,16 +6,14 @@ import assert from 'assert'; import BigInt from 'apollo-type-bigint'; import debug from 'debug'; -import { gqlTotalQueryCount, gqlQueryCount, ValueResult, IndexerInterface, EventWatcherInterface } from '@cerc-io/util'; +import { gqlTotalQueryCount, gqlQueryCount, ValueResult, IndexerInterface, EventWatcher } from '@cerc-io/util'; import { CONTRACT_KIND, Indexer } from './indexer'; -import { EventWatcher } from './events'; const log = debug('vulcanize:resolver'); -export const createResolvers = async (indexerArg: IndexerInterface, eventWatcherArg: EventWatcherInterface): Promise => { +export const createResolvers = async (indexerArg: IndexerInterface, eventWatcher: EventWatcher): Promise => { const indexer = indexerArg as Indexer; - const eventWatcher = eventWatcherArg as EventWatcher; return { BigInt: new BigInt('bigInt'), diff --git a/packages/erc20-watcher/src/server.ts b/packages/erc20-watcher/src/server.ts index ce7a542c..c4cc5d53 100644 --- a/packages/erc20-watcher/src/server.ts +++ b/packages/erc20-watcher/src/server.ts @@ -10,14 +10,13 @@ import typeDefs from './schema'; import { createResolvers } from './resolvers'; import { Indexer } from './indexer'; import { Database } from './database'; -import { EventWatcher } from './events'; const log = debug('vulcanize:server'); export const main = async (): Promise => { const serverCmd = new ServerCmd(); await serverCmd.init(Database); - await serverCmd.initIndexer(Indexer, EventWatcher); + await serverCmd.initIndexer(Indexer); return serverCmd.exec(createResolvers, typeDefs); }; diff --git a/packages/uni-info-watcher/package.json b/packages/uni-info-watcher/package.json index 6420cd65..6f66bc22 100644 --- a/packages/uni-info-watcher/package.json +++ b/packages/uni-info-watcher/package.json @@ -21,7 +21,6 @@ "express": "^4.18.2", "graphql": "^15.5.0", "graphql-request": "^3.4.0", - "graphql-subscriptions": "^2.0.0", "json-bigint": "^1.0.0", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13", diff --git a/packages/uni-info-watcher/src/cli/checkpoint-cmds/create.ts b/packages/uni-info-watcher/src/cli/checkpoint-cmds/create.ts index ed9d324a..d40af784 100644 --- a/packages/uni-info-watcher/src/cli/checkpoint-cmds/create.ts +++ b/packages/uni-info-watcher/src/cli/checkpoint-cmds/create.ts @@ -41,5 +41,6 @@ export const handler = async (argv: any): Promise => { await createCheckpointCmd.init(argv, Database, { uniClient, erc20Client }); await createCheckpointCmd.initIndexer(Indexer); + await createCheckpointCmd.exec(); }; diff --git a/packages/uni-info-watcher/src/cli/export-state.ts b/packages/uni-info-watcher/src/cli/export-state.ts index 33615801..ddb8fffa 100644 --- a/packages/uni-info-watcher/src/cli/export-state.ts +++ b/packages/uni-info-watcher/src/cli/export-state.ts @@ -29,6 +29,7 @@ const main = async (): Promise => { await exportStateCmd.init(Database, { uniClient, erc20Client }); await exportStateCmd.initIndexer(Indexer); + await exportStateCmd.exec(); }; diff --git a/packages/uni-info-watcher/src/cli/import-state.ts b/packages/uni-info-watcher/src/cli/import-state.ts index b471a840..ce404979 100644 --- a/packages/uni-info-watcher/src/cli/import-state.ts +++ b/packages/uni-info-watcher/src/cli/import-state.ts @@ -12,7 +12,6 @@ import { Config } from '@vulcanize/util'; import { Database } from '../database'; import { Indexer } from '../indexer'; -import { EventWatcher } from '../events'; import { State } from '../entity/State'; const log = debug('vulcanize:import-state'); @@ -30,7 +29,8 @@ export const main = async (): Promise => { const erc20Client = new ERC20Client(tokenWatcher); await importStateCmd.init(Database, { uniClient, erc20Client }); - await importStateCmd.initIndexer(Indexer, EventWatcher); + await importStateCmd.initIndexer(Indexer); + await importStateCmd.exec(State); }; diff --git a/packages/uni-info-watcher/src/cli/inspect-cid.ts b/packages/uni-info-watcher/src/cli/inspect-cid.ts index d7f21724..9009c6e9 100644 --- a/packages/uni-info-watcher/src/cli/inspect-cid.ts +++ b/packages/uni-info-watcher/src/cli/inspect-cid.ts @@ -29,6 +29,7 @@ const main = async (): Promise => { await inspectCIDCmd.init(Database, { uniClient, erc20Client }); await inspectCIDCmd.initIndexer(Indexer); + await inspectCIDCmd.exec(); }; diff --git a/packages/uni-info-watcher/src/cli/reset-cmds/watcher.ts b/packages/uni-info-watcher/src/cli/reset-cmds/watcher.ts index 40d0a9b2..ae110e23 100644 --- a/packages/uni-info-watcher/src/cli/reset-cmds/watcher.ts +++ b/packages/uni-info-watcher/src/cli/reset-cmds/watcher.ts @@ -34,5 +34,6 @@ export const handler = async (argv: any): Promise => { await resetWatcherCmd.init(argv, Database, { uniClient, erc20Client }); await resetWatcherCmd.initIndexer(Indexer); + await resetWatcherCmd.exec(); }; diff --git a/packages/uni-info-watcher/src/cli/watch-contract.ts b/packages/uni-info-watcher/src/cli/watch-contract.ts index 3b98bed1..68c6cf75 100644 --- a/packages/uni-info-watcher/src/cli/watch-contract.ts +++ b/packages/uni-info-watcher/src/cli/watch-contract.ts @@ -29,6 +29,7 @@ const main = async (): Promise => { await watchContractCmd.init(Database, { uniClient, erc20Client }); await watchContractCmd.initIndexer(Indexer); + await watchContractCmd.exec(); }; diff --git a/packages/uni-info-watcher/src/events.ts b/packages/uni-info-watcher/src/events.ts index 70d3fb64..79324a67 100644 --- a/packages/uni-info-watcher/src/events.ts +++ b/packages/uni-info-watcher/src/events.ts @@ -2,17 +2,6 @@ // Copyright 2021 Vulcanize, Inc. // -import assert from 'assert'; -import debug from 'debug'; -import { PubSub } from 'graphql-subscriptions'; - -import { EthClient } from '@cerc-io/ipld-eth-client'; -import { QUEUE_BLOCK_PROCESSING, QUEUE_EVENT_PROCESSING, EventWatcher as BaseEventWatcher, JobQueue, EventWatcherInterface, IndexerInterface } from '@cerc-io/util'; - -import { Indexer } from './indexer'; - -const log = debug('vulcanize:events'); - export interface PoolCreatedEvent { __typename: 'PoolCreatedEvent'; token0: string; @@ -131,49 +120,3 @@ export interface ResultEvent { data: string; } } - -export class EventWatcher implements EventWatcherInterface { - _ethClient: EthClient - _indexer: Indexer - _subscription?: ZenObservable.Subscription - _pubsub: PubSub - _jobQueue: JobQueue - _baseEventWatcher: BaseEventWatcher - - constructor (ethClient: EthClient, indexer: IndexerInterface, pubsub: PubSub, jobQueue: JobQueue) { - this._ethClient = ethClient; - this._indexer = indexer as Indexer; - this._pubsub = pubsub; - this._jobQueue = jobQueue; - this._baseEventWatcher = new BaseEventWatcher(this._ethClient, this._indexer, this._pubsub, this._jobQueue); - } - - getBlockProgressEventIterator (): AsyncIterator { - return this._baseEventWatcher.getBlockProgressEventIterator(); - } - - async start (): Promise { - assert(!this._subscription, 'subscription already started'); - log('Started watching upstream events...'); - - await this.initBlockProcessingOnCompleteHandler(); - await this.initEventProcessingOnCompleteHandler(); - this._baseEventWatcher.startBlockProcessing(); - } - - async stop (): Promise { - this._baseEventWatcher.stop(); - } - - async initBlockProcessingOnCompleteHandler (): Promise { - this._jobQueue.onComplete(QUEUE_BLOCK_PROCESSING, async (job) => { - await this._baseEventWatcher.blockProcessingCompleteHandler(job); - }); - } - - async initEventProcessingOnCompleteHandler (): Promise { - await this._jobQueue.onComplete(QUEUE_EVENT_PROCESSING, async (job) => { - await this._baseEventWatcher.eventProcessingCompleteHandler(job); - }); - } -} diff --git a/packages/uni-info-watcher/src/fill.ts b/packages/uni-info-watcher/src/fill.ts index 328decfb..02505632 100644 --- a/packages/uni-info-watcher/src/fill.ts +++ b/packages/uni-info-watcher/src/fill.ts @@ -12,7 +12,6 @@ import { Client as ERC20Client } from '@vulcanize/erc20-watcher'; import { Database, ENTITIES } from './database'; import { Indexer } from './indexer'; -import { EventWatcher } from './events'; import { FACTORY_ADDRESS } from './utils/constants'; const log = debug('vulcanize:fill'); @@ -30,7 +29,7 @@ export const main = async (): Promise => { const erc20Client = new ERC20Client(tokenWatcher); await fillCmd.init(Database, { uniClient, erc20Client }); - await fillCmd.initIndexer(Indexer, EventWatcher); + await fillCmd.initIndexer(Indexer); await fillCmd.exec(getContractEntitiesMap()); }; diff --git a/packages/uni-info-watcher/src/resolvers.ts b/packages/uni-info-watcher/src/resolvers.ts index 207cdda2..51ae01d6 100644 --- a/packages/uni-info-watcher/src/resolvers.ts +++ b/packages/uni-info-watcher/src/resolvers.ts @@ -17,7 +17,7 @@ import { gqlQueryCount, gqlTotalQueryCount, IndexerInterface, - EventWatcherInterface + EventWatcher } from '@cerc-io/util'; import { Indexer } from './indexer'; @@ -41,16 +41,14 @@ import { TickHourData } from './entity/TickHourData'; import { Flash } from './entity/Flash'; import { Collect } from './entity/Collect'; import { PoolHourData } from './entity/PoolHourData'; -import { EventWatcher } from './events'; import { FACTORY_ADDRESS, BUNDLE_ID } from './utils/constants'; const log = debug('vulcanize:resolver'); export { BlockHeight }; -export const createResolvers = async (indexerArg: IndexerInterface, eventWatcherArg: EventWatcherInterface): Promise => { +export const createResolvers = async (indexerArg: IndexerInterface, eventWatcher: EventWatcher): Promise => { const indexer = indexerArg as Indexer; - const eventWatcher = eventWatcherArg as EventWatcher; const gqlCacheConfig = indexer.serverConfig.gqlCache; diff --git a/packages/uni-info-watcher/src/server.ts b/packages/uni-info-watcher/src/server.ts index c3c00959..18304848 100644 --- a/packages/uni-info-watcher/src/server.ts +++ b/packages/uni-info-watcher/src/server.ts @@ -14,7 +14,6 @@ import typeDefs from './schema'; import { createResolvers } from './resolvers'; import { Indexer } from './indexer'; import { Database } from './database'; -import { EventWatcher } from './events'; const log = debug('vulcanize:server'); @@ -31,7 +30,7 @@ export const main = async (): Promise => { const erc20Client = new ERC20Client(tokenWatcher); await serverCmd.init(Database, { uniClient, erc20Client }); - await serverCmd.initIndexer(Indexer, EventWatcher); + await serverCmd.initIndexer(Indexer); return serverCmd.exec(createResolvers, typeDefs); }; diff --git a/packages/uni-watcher/package.json b/packages/uni-watcher/package.json index 1043bfc0..d1ab1505 100644 --- a/packages/uni-watcher/package.json +++ b/packages/uni-watcher/package.json @@ -49,7 +49,6 @@ "ethers": "^5.2.0", "express": "^4.18.2", "graphql-request": "^3.4.0", - "graphql-subscriptions": "^2.0.0", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13", "typeorm": "^0.2.32", diff --git a/packages/uni-watcher/src/events.ts b/packages/uni-watcher/src/events.ts deleted file mode 100644 index 3ee79213..00000000 --- a/packages/uni-watcher/src/events.ts +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright 2021 Vulcanize, Inc. -// - -import assert from 'assert'; -import { PubSub } from 'graphql-subscriptions'; - -import { EthClient } from '@cerc-io/ipld-eth-client'; -import { - EventWatcher as BaseEventWatcher, - QUEUE_BLOCK_PROCESSING, - QUEUE_EVENT_PROCESSING, - JobQueue, - EventWatcherInterface, - IndexerInterface -} from '@cerc-io/util'; - -import { Indexer } from './indexer'; - -export class EventWatcher implements EventWatcherInterface { - _ethClient: EthClient - _indexer: Indexer - _subscription?: ZenObservable.Subscription - _pubsub: PubSub - _jobQueue: JobQueue - _baseEventWatcher: BaseEventWatcher - - constructor (ethClient: EthClient, indexer: IndexerInterface, pubsub: PubSub, jobQueue: JobQueue) { - this._ethClient = ethClient; - this._indexer = indexer as Indexer; - this._pubsub = pubsub; - this._jobQueue = jobQueue; - this._baseEventWatcher = new BaseEventWatcher(this._ethClient, this._indexer, this._pubsub, this._jobQueue); - } - - getEventIterator (): AsyncIterator { - return this._baseEventWatcher.getEventIterator(); - } - - getBlockProgressEventIterator (): AsyncIterator { - return this._baseEventWatcher.getBlockProgressEventIterator(); - } - - async start (): Promise { - assert(!this._subscription, 'subscription already started'); - - await this.initBlockProcessingOnCompleteHandler(); - await this.initEventProcessingOnCompleteHandler(); - this._baseEventWatcher.startBlockProcessing(); - } - - async stop (): Promise { - this._baseEventWatcher.stop(); - } - - async initBlockProcessingOnCompleteHandler (): Promise { - this._jobQueue.onComplete(QUEUE_BLOCK_PROCESSING, async (job) => { - await this._baseEventWatcher.blockProcessingCompleteHandler(job); - }); - } - - async initEventProcessingOnCompleteHandler (): Promise { - await this._jobQueue.onComplete(QUEUE_EVENT_PROCESSING, async (job) => { - await this._baseEventWatcher.eventProcessingCompleteHandler(job); - }); - } -} diff --git a/packages/uni-watcher/src/fill.ts b/packages/uni-watcher/src/fill.ts index 54ae03ff..91742c46 100644 --- a/packages/uni-watcher/src/fill.ts +++ b/packages/uni-watcher/src/fill.ts @@ -9,14 +9,13 @@ import { FillCmd } from '@cerc-io/cli'; import { Database } from './database'; import { Indexer } from './indexer'; -import { EventWatcher } from './events'; const log = debug('vulcanize:server'); export const main = async (): Promise => { const fillCmd = new FillCmd(); await fillCmd.init(Database); - await fillCmd.initIndexer(Indexer, EventWatcher); + await fillCmd.initIndexer(Indexer); await fillCmd.exec(); }; diff --git a/packages/uni-watcher/src/resolvers.ts b/packages/uni-watcher/src/resolvers.ts index e55160c5..8cab5928 100644 --- a/packages/uni-watcher/src/resolvers.ts +++ b/packages/uni-watcher/src/resolvers.ts @@ -11,17 +11,15 @@ import { gqlQueryCount, ValueResult, IndexerInterface, - EventWatcherInterface + EventWatcher } from '@cerc-io/util'; import { Indexer } from './indexer'; -import { EventWatcher } from './events'; const log = debug('vulcanize:resolver'); -export const createResolvers = async (indexerArg: IndexerInterface, eventWatcherArg: EventWatcherInterface): Promise => { +export const createResolvers = async (indexerArg: IndexerInterface, eventWatcher: EventWatcher): Promise => { const indexer = indexerArg as Indexer; - const eventWatcher = eventWatcherArg as EventWatcher; return { BigInt: new BigInt('bigInt'), diff --git a/packages/uni-watcher/src/server.ts b/packages/uni-watcher/src/server.ts index 6d9ebdc8..f031d0e2 100644 --- a/packages/uni-watcher/src/server.ts +++ b/packages/uni-watcher/src/server.ts @@ -10,14 +10,13 @@ import typeDefs from './schema'; import { createResolvers } from './resolvers'; import { Indexer } from './indexer'; import { Database } from './database'; -import { EventWatcher } from './events'; const log = debug('vulcanize:server'); export const main = async (): Promise => { const serverCmd = new ServerCmd(); await serverCmd.init(Database); - await serverCmd.initIndexer(Indexer, EventWatcher); + await serverCmd.initIndexer(Indexer); return serverCmd.exec(createResolvers, typeDefs); }; diff --git a/packages/util/package.json b/packages/util/package.json index 5c04512d..d6586a85 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -11,7 +11,6 @@ "decimal.js": "^10.3.1", "ethers": "^5.2.0", "express": "^4.17.1", - "graphql-subscriptions": "^2.0.0", "node-fetch": "2", "pg-boss": "^6.1.0", "prom-client": "^14.0.1",