mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 16:54:08 +00:00
Refactor watch-contract CLI to cli package (#245)
* Refactor watch-contract CLI to cli package * Use watch-contract from cli in eden and erc721 watchers * Use watch-contract from cli in all watchers * Pass an object containing clients to refactored CLI Co-authored-by: nabarun <nabarun@deepstacksoft.com>
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// Copyright 2021 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
export * from './src/config';
|
||||
export * from './src/database';
|
||||
export * from './src/job-queue';
|
||||
export * from './src/constants';
|
||||
export * from './src/misc';
|
||||
export * from './src/fill';
|
||||
export * from './src/events';
|
||||
export * from './src/types';
|
||||
export * from './src/indexer';
|
||||
export * from './src/job-runner';
|
||||
export * from './src/state-helper';
|
||||
export * from './src/graph-decimal';
|
||||
export * from './src/index-block';
|
||||
export * from './src/metrics';
|
||||
export * from './src/gql-metrics';
|
||||
export * from './src/common';
|
||||
export * from './src/server';
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Copyright 2022 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
export * from './config';
|
||||
export * from './database';
|
||||
export * from './job-queue';
|
||||
export * from './constants';
|
||||
export * from './misc';
|
||||
export * from './fill';
|
||||
export * from './events';
|
||||
export * from './types';
|
||||
export * from './indexer';
|
||||
export * from './job-runner';
|
||||
export * from './state-helper';
|
||||
export * from './graph-decimal';
|
||||
export * from './index-block';
|
||||
export * from './metrics';
|
||||
export * from './gql-metrics';
|
||||
export * from './common';
|
||||
export * from './server';
|
||||
@@ -3,7 +3,7 @@ import { ApolloServer } from 'apollo-server-express';
|
||||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
import { useServer } from 'graphql-ws/lib/use/ws';
|
||||
import { ApolloServerPluginDrainHttpServer } from 'apollo-server-core';
|
||||
import { ApolloServerPluginDrainHttpServer, ApolloServerPluginLandingPageLocalDefault } from 'apollo-server-core';
|
||||
import debug from 'debug';
|
||||
import responseCachePlugin from 'apollo-server-plugin-response-cache';
|
||||
import { InMemoryLRUCache } from '@apollo/utils.keyvaluecache';
|
||||
@@ -65,7 +65,8 @@ export const createAndStartServer = async (
|
||||
}
|
||||
},
|
||||
// GQL response cache plugin
|
||||
responseCachePlugin()
|
||||
responseCachePlugin(),
|
||||
ApolloServerPluginLandingPageLocalDefault({ embed: true })
|
||||
]
|
||||
});
|
||||
await server.start();
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
//
|
||||
|
||||
import { Connection, DeepPartial, EntityTarget, FindConditions, FindManyOptions, QueryRunner } from 'typeorm';
|
||||
|
||||
import { MappingKey, StorageLayout } from '@cerc-io/solidity-mapper';
|
||||
import { EthClient } from '@cerc-io/ipld-eth-client';
|
||||
|
||||
import { ServerConfig } from './config';
|
||||
import { Where, QueryOptions } from './database';
|
||||
import { Where, QueryOptions, Database } from './database';
|
||||
import { ValueResult, StateStatus } from './indexer';
|
||||
|
||||
export enum StateKind {
|
||||
@@ -81,6 +83,7 @@ export interface StateInterface {
|
||||
export interface IndexerInterface {
|
||||
readonly serverConfig: ServerConfig
|
||||
readonly storageLayoutMap: Map<string, StorageLayout>
|
||||
init (): Promise<void>
|
||||
getBlockProgress (blockHash: string): Promise<BlockProgressInterface | undefined>
|
||||
getBlockProgressEntities (where: FindConditions<BlockProgressInterface>, options: FindManyOptions<BlockProgressInterface>): Promise<BlockProgressInterface[]>
|
||||
getEvent (id: string): Promise<EventInterface | undefined>
|
||||
@@ -132,6 +135,8 @@ export interface EventWatcherInterface {
|
||||
|
||||
export interface DatabaseInterface {
|
||||
_conn: Connection;
|
||||
readonly baseDatabase: Database
|
||||
init (): Promise<void>;
|
||||
close (): Promise<void>;
|
||||
createTransactionRunner (): Promise<QueryRunner>;
|
||||
getBlocksAtHeight (height: number, isPruned: boolean): Promise<BlockProgressInterface[]>;
|
||||
@@ -170,3 +175,8 @@ export interface DatabaseInterface {
|
||||
export interface GraphDatabaseInterface {
|
||||
getEntity<Entity> (entity: (new () => Entity) | string, id: string, blockHash?: string): Promise<Entity | undefined>;
|
||||
}
|
||||
|
||||
export type Clients = {
|
||||
ethClient: EthClient;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
@@ -72,5 +72,6 @@
|
||||
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
|
||||
"resolveJsonModule": true /* Enabling the option allows importing JSON, and validating the types in that JSON file. */
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["test", "dist", "artifacts", "cache"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user