Fix linter warnings and dependencies (#264)

* Fix minor linting errors

* Fix CLI getters linting errors

* Fix resolvers template in codegen

* Fix dependencies
This commit is contained in:
prathamesh0 2022-11-25 08:33:58 -06:00 committed by GitHub
parent 94c8ed9575
commit 2417e3feb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 229 additions and 247 deletions

View File

@ -4,7 +4,6 @@
import assert from 'assert';
import debug from 'debug';
import _ from 'lodash';
import { PubSub } from 'graphql-subscriptions';
import { EthClient } from '@cerc-io/ipld-eth-client';

View File

@ -30,31 +30,38 @@ export class BaseCmd {
_indexer?: IndexerInterface;
_eventWatcher?: EventWatcher;
get config (): Config | undefined {
get config (): Config {
assert(this._config);
return this._config;
}
get clients (): Clients | undefined {
get clients (): Clients {
assert(this._clients);
return this._clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
assert(this._ethProvider);
return this._ethProvider;
}
get jobQueue (): JobQueue | undefined {
get jobQueue (): JobQueue {
assert(this._jobQueue);
return this._jobQueue;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
assert(this._database);
return this._database;
}
get indexer (): IndexerInterface | undefined {
get indexer (): IndexerInterface {
assert(this._indexer);
return this._indexer;
}
get eventWatcher (): EventWatcher | undefined {
get eventWatcher (): EventWatcher {
assert(this._eventWatcher);
return this._eventWatcher;
}

View File

@ -36,19 +36,19 @@ export class CreateCheckpointCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -37,19 +37,19 @@ export class VerifyCheckpointCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -42,19 +42,19 @@ export class ExportStateCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -44,19 +44,19 @@ export class FillCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -44,19 +44,19 @@ export class ImportStateCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -35,19 +35,19 @@ export class IndexBlockCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -38,19 +38,19 @@ export class InspectCIDCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -36,27 +36,27 @@ export class JobRunnerCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}
get jobQueue (): JobQueue | undefined {
get jobQueue (): JobQueue {
return this._baseCmd.jobQueue;
}
get indexer (): IndexerInterface | undefined {
get indexer (): IndexerInterface {
return this._baseCmd.indexer;
}

View File

@ -35,19 +35,19 @@ export class ResetWatcherCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -41,19 +41,19 @@ export class ServerCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -37,19 +37,19 @@ export class WatchContractCmd {
this._baseCmd = new BaseCmd();
}
get config (): Config | undefined {
get config (): Config {
return this._baseCmd.config;
}
get clients (): Clients | undefined {
get clients (): Clients {
return this._baseCmd.clients;
}
get ethProvider (): JsonRpcProvider | undefined {
get ethProvider (): JsonRpcProvider {
return this._baseCmd.ethProvider;
}
get database (): DatabaseInterface | undefined {
get database (): DatabaseInterface {
return this._baseCmd.database;
}

View File

@ -23,6 +23,7 @@
"@graphql-tools/load-files": "^6.5.2",
"@poanet/solidity-flattener": "https://github.com/vulcanize/solidity-flattener.git",
"@solidity-parser/parser": "^0.13.2",
"ethers": "^5.4.4",
"gql-generator": "https://github.com/vulcanize/gql-generator.git",
"graphql": "^15.5.0",
"graphql-compose": "^9.0.3",
@ -36,7 +37,6 @@
"yargs": "^17.1.1"
},
"devDependencies": {
"@openzeppelin/contracts": "^4.3.2",
"@types/js-yaml": "^4.0.3",
"@types/node": "^16.9.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",

View File

@ -33,10 +33,10 @@ export const handler = async (argv: any): Promise<void> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
createCheckpointCmd.config!.server,
createCheckpointCmd.clients!.ethClient,
createCheckpointCmd.ethProvider!,
createCheckpointCmd.database!.baseDatabase,
createCheckpointCmd.config.server,
createCheckpointCmd.clients.ethClient,
createCheckpointCmd.ethProvider,
createCheckpointCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -26,10 +26,10 @@ export const handler = async (argv: any): Promise<void> => {
await verifyCheckpointCmd.init(argv, Database);
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
verifyCheckpointCmd.config!.server,
verifyCheckpointCmd.clients!.ethClient,
verifyCheckpointCmd.ethProvider!,
verifyCheckpointCmd.database!.baseDatabase,
verifyCheckpointCmd.config.server,
verifyCheckpointCmd.clients.ethClient,
verifyCheckpointCmd.ethProvider,
verifyCheckpointCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -37,10 +37,8 @@ export const SUBGRAPH_ENTITIES = new Set([
{{~/each}}]);
{{/if}}
export const ENTITIES = [
{{~#if (subgraphPath)}}...SUBGRAPH_ENTITIES, {{/if}}
{{~#each queries as | query |}}{{query.entityName}}
{{~#unless @last}}, {{/unless}}
{{~/each}}];
{{~#each queries as | query |}}{{query.entityName}}, {{/each}}
{{~#if (subgraphPath)}}...SUBGRAPH_ENTITIES{{/if}}];
{{#if (subgraphPath)}}
// Map: Entity to suitable query type.
export const ENTITY_QUERY_TYPE_MAP = new Map<new() => any, ENTITY_QUERY_TYPE>([]);

View File

@ -21,10 +21,10 @@ const main = async (): Promise<void> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
exportStateCmd.config!.server,
exportStateCmd.clients!.ethClient,
exportStateCmd.ethProvider!,
exportStateCmd.database!.baseDatabase,
exportStateCmd.config.server,
exportStateCmd.clients.ethClient,
exportStateCmd.ethProvider,
exportStateCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -22,10 +22,10 @@ export const main = async (): Promise<any> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
fillCmd.config!.server,
fillCmd.clients!.ethClient,
fillCmd.ethProvider!,
fillCmd.database!.baseDatabase,
fillCmd.config.server,
fillCmd.clients.ethClient,
fillCmd.ethProvider,
fillCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -22,10 +22,10 @@ export const main = async (): Promise<any> => {
{{#if (subgraphPath)}}
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
importStateCmd.config!.server,
importStateCmd.clients!.ethClient,
importStateCmd.ethProvider!,
importStateCmd.database!.baseDatabase,
importStateCmd.config.server,
importStateCmd.clients.ethClient,
importStateCmd.ethProvider,
importStateCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -21,10 +21,10 @@ const main = async (): Promise<void> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
indexBlockCmd.config!.server,
indexBlockCmd.clients!.ethClient,
indexBlockCmd.ethProvider!,
indexBlockCmd.database!.baseDatabase,
indexBlockCmd.config.server,
indexBlockCmd.clients.ethClient,
indexBlockCmd.ethProvider,
indexBlockCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -21,10 +21,10 @@ const main = async (): Promise<void> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
inspectCIDCmd.config!.server,
inspectCIDCmd.clients!.ethClient,
inspectCIDCmd.ethProvider!,
inspectCIDCmd.database!.baseDatabase,
inspectCIDCmd.config.server,
inspectCIDCmd.clients.ethClient,
inspectCIDCmd.ethProvider,
inspectCIDCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -21,10 +21,10 @@ export const main = async (): Promise<any> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
jobRunnerCmd.config!.server,
jobRunnerCmd.clients!.ethClient,
jobRunnerCmd.ethProvider!,
jobRunnerCmd.database!.baseDatabase,
jobRunnerCmd.config.server,
jobRunnerCmd.clients.ethClient,
jobRunnerCmd.ethProvider,
jobRunnerCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -41,7 +41,6 @@
"dependencies": {
"@apollo/client": "^3.3.19",
"@ethersproject/providers": "^5.4.4",
"@ipld/dag-cbor": "^6.0.12",
"@cerc-io/cli": "^0.2.15",
"@cerc-io/ipld-eth-client": "^0.2.15",
"@cerc-io/solidity-mapper": "^0.2.15",
@ -52,7 +51,6 @@
"apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1",
"ethers": "^5.4.4",
"express": "^4.18.2",
"graphql": "^15.5.0",
"json-bigint": "^1.0.0",
"reflect-metadata": "^0.1.13",
@ -62,7 +60,6 @@
},
"devDependencies": {
"@ethersproject/abi": "^5.3.0",
"@types/express": "^4.17.14",
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",

View File

@ -25,11 +25,11 @@ export const handler = async (argv: any): Promise<void> => {
await resetWatcherCmd.init(argv, Database);
{{#if (subgraphPath)}}
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
resetWatcherCmd.config!.server,
resetWatcherCmd.clients!.ethClient,
resetWatcherCmd.ethProvider!,
resetWatcherCmd.database!.baseDatabase,
const { graphWatcher } = await getGraphDbAndWatcher(
resetWatcherCmd.config.server,
resetWatcherCmd.clients.ethClient,
resetWatcherCmd.ethProvider,
resetWatcherCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -21,7 +21,6 @@ import {
} from '@cerc-io/util';
import { Indexer } from './indexer';
import { EventWatcher } from './events';
{{#if (subgraphPath)}}
{{#each subgraphQueries as | query |}}

View File

@ -24,10 +24,10 @@ export const main = async (): Promise<any> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
serverCmd.config!.server,
serverCmd.clients!.ethClient,
serverCmd.ethProvider!,
serverCmd.database!.baseDatabase,
serverCmd.config.server,
serverCmd.clients.ethClient,
serverCmd.ethProvider,
serverCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -21,10 +21,10 @@ const main = async (): Promise<void> => {
{{#if (subgraphPath)}}
const { graphWatcher } = await getGraphDbAndWatcher(
watchContractCmd.config!.server,
watchContractCmd.clients!.ethClient,
watchContractCmd.ethProvider!,
watchContractCmd.database!.baseDatabase,
watchContractCmd.config.server,
watchContractCmd.clients.ethClient,
watchContractCmd.ethProvider,
watchContractCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -44,21 +44,17 @@
"@cerc-io/solidity-mapper": "^0.2.16",
"@cerc-io/util": "^0.2.16",
"@ethersproject/providers": "^5.4.4",
"@ipld/dag-cbor": "^6.0.12",
"apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1",
"decimal.js": "^10.3.1",
"ethers": "^5.4.4",
"express": "^4.18.2",
"graphql": "^15.5.0",
"json-bigint": "^1.0.0",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.32",
"yargs": "^17.0.1"
},
"devDependencies": {
"@ethersproject/abi": "^5.3.0",
"@types/express": "^4.17.14",
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",

View File

@ -30,10 +30,10 @@ export const handler = async (argv: any): Promise<void> => {
await createCheckpointCmd.init(argv, Database);
const { graphWatcher } = await getGraphDbAndWatcher(
createCheckpointCmd.config!.server,
createCheckpointCmd.clients!.ethClient,
createCheckpointCmd.ethProvider!,
createCheckpointCmd.database!.baseDatabase,
createCheckpointCmd.config.server,
createCheckpointCmd.clients.ethClient,
createCheckpointCmd.ethProvider,
createCheckpointCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -26,10 +26,10 @@ export const handler = async (argv: any): Promise<void> => {
await verifyCheckpointCmd.init(argv, Database);
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
verifyCheckpointCmd.config!.server,
verifyCheckpointCmd.clients!.ethClient,
verifyCheckpointCmd.ethProvider!,
verifyCheckpointCmd.database!.baseDatabase,
verifyCheckpointCmd.config.server,
verifyCheckpointCmd.clients.ethClient,
verifyCheckpointCmd.ethProvider,
verifyCheckpointCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await exportStateCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
exportStateCmd.config!.server,
exportStateCmd.clients!.ethClient,
exportStateCmd.ethProvider!,
exportStateCmd.database!.baseDatabase,
exportStateCmd.config.server,
exportStateCmd.clients.ethClient,
exportStateCmd.ethProvider,
exportStateCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -19,10 +19,10 @@ export const main = async (): Promise<any> => {
await importStateCmd.init(Database);
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
importStateCmd.config!.server,
importStateCmd.clients!.ethClient,
importStateCmd.ethProvider!,
importStateCmd.database!.baseDatabase,
importStateCmd.config.server,
importStateCmd.clients.ethClient,
importStateCmd.ethProvider,
importStateCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await indexBlockCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
indexBlockCmd.config!.server,
indexBlockCmd.clients!.ethClient,
indexBlockCmd.ethProvider!,
indexBlockCmd.database!.baseDatabase,
indexBlockCmd.config.server,
indexBlockCmd.clients.ethClient,
indexBlockCmd.ethProvider,
indexBlockCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await inspectCIDCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
inspectCIDCmd.config!.server,
inspectCIDCmd.clients!.ethClient,
inspectCIDCmd.ethProvider!,
inspectCIDCmd.database!.baseDatabase,
inspectCIDCmd.config.server,
inspectCIDCmd.clients.ethClient,
inspectCIDCmd.ethProvider,
inspectCIDCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -22,11 +22,11 @@ export const handler = async (argv: any): Promise<void> => {
const resetWatcherCmd = new ResetWatcherCmd();
await resetWatcherCmd.init(argv, Database);
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
resetWatcherCmd.config!.server,
resetWatcherCmd.clients!.ethClient,
resetWatcherCmd.ethProvider!,
resetWatcherCmd.database!.baseDatabase,
const { graphWatcher } = await getGraphDbAndWatcher(
resetWatcherCmd.config.server,
resetWatcherCmd.clients.ethClient,
resetWatcherCmd.ethProvider,
resetWatcherCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await watchContractCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
watchContractCmd.config!.server,
watchContractCmd.clients!.ethClient,
watchContractCmd.ethProvider!,
watchContractCmd.database!.baseDatabase,
watchContractCmd.config.server,
watchContractCmd.clients.ethClient,
watchContractCmd.ethProvider,
watchContractCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -19,10 +19,10 @@ export const main = async (): Promise<any> => {
await fillCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
fillCmd.config!.server,
fillCmd.clients!.ethClient,
fillCmd.ethProvider!,
fillCmd.database!.baseDatabase,
fillCmd.config.server,
fillCmd.clients.ethClient,
fillCmd.ethProvider,
fillCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ export const main = async (): Promise<any> => {
await jobRunnerCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
jobRunnerCmd.config!.server,
jobRunnerCmd.clients!.ethClient,
jobRunnerCmd.ethProvider!,
jobRunnerCmd.database!.baseDatabase,
jobRunnerCmd.config.server,
jobRunnerCmd.clients.ethClient,
jobRunnerCmd.ethProvider,
jobRunnerCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -21,10 +21,10 @@ export const main = async (): Promise<any> => {
await serverCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
serverCmd.config!.server,
serverCmd.clients!.ethClient,
serverCmd.ethProvider!,
serverCmd.database!.baseDatabase,
serverCmd.config.server,
serverCmd.clients.ethClient,
serverCmd.ethProvider,
serverCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -45,30 +45,22 @@
"@cerc-io/solidity-mapper": "^0.2.16",
"@cerc-io/util": "^0.2.16",
"@ethersproject/providers": "^5.4.4",
"@types/express": "^4.17.14",
"@types/lodash": "^4.14.168",
"apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1",
"ethers": "^5.4.4",
"express": "^4.18.2",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"json-bigint": "^1.0.0",
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.32",
"yargs": "^17.0.1"
"typeorm": "^0.2.32"
},
"devDependencies": {
"@ethersproject/abi": "^5.3.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@types/express": "^4.17.14",
"@types/json-bigint": "^1.0.0",
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"chai": "^4.3.4",
"eslint": "^7.27.0",
"eslint-config-semistandard": "^15.0.1",
"eslint-config-standard": "^16.0.3",
@ -77,7 +69,6 @@
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"hardhat": "^2.3.0",
"mocha": "^8.4.0",
"nodemon": "^2.0.7"
}
}

View File

@ -2,6 +2,8 @@
// Copyright 2021 Vulcanize, Inc.
//
/* eslint-disable @typescript-eslint/no-unused-vars */
import assert from 'assert';
import debug from 'debug';
import { JsonFragment } from '@ethersproject/abi';

View File

@ -2,8 +2,6 @@
// Copyright 2021 Vulcanize, Inc.
//
import fs from 'fs';
import path from 'path';
import 'reflect-metadata';
import debug from 'debug';

View File

@ -51,12 +51,10 @@
"@cerc-io/solidity-mapper": "^0.2.16",
"@cerc-io/util": "^0.2.16",
"@ethersproject/providers": "^5.4.4",
"@ipld/dag-cbor": "^6.0.12",
"apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1",
"decimal.js": "^10.3.1",
"ethers": "^5.4.4",
"express": "^4.18.2",
"graphql": "^15.5.0",
"json-bigint": "^1.0.0",
"reflect-metadata": "^0.1.13",
@ -67,7 +65,6 @@
"@ethersproject/abi": "^5.3.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@types/express": "^4.17.14",
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",

View File

@ -4,12 +4,13 @@
"main": "dist/index.js",
"license": "AGPL-3.0",
"devDependencies": {
"@cerc-io/solidity-mapper": "^0.2.16",
"@ethersproject/providers": "^5.4.4",
"@graphprotocol/graph-ts": "^0.22.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@types/chai": "^4.2.18",
"@types/chai-spies": "^1.0.3",
"@types/js-yaml": "^4.0.4",
"@types/pluralize": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
@ -48,21 +49,23 @@
},
"dependencies": {
"@apollo/client": "^3.3.19",
"@cerc-io/cache": "^0.2.16",
"@cerc-io/ipld-eth-client": "^0.2.16",
"@cerc-io/util": "^0.2.16",
"@types/json-diff": "^0.5.2",
"@vulcanize/assemblyscript": "0.0.1",
"bn.js": "^4.11.9",
"debug": "^4.3.1",
"graphql": "^15.5.0",
"fs-extra": "^10.0.0",
"js-yaml": "^4.1.0",
"json-bigint": "^1.0.0",
"lodash": "^4.17.21",
"json-diff": "^0.5.4",
"omit-deep": "^0.3.0",
"pluralize": "^8.0.0",
"reflect-metadata": "^0.1.13",
"toml": "^3.0.0",
"typeorm": "^0.2.32",
"typeorm-naming-strategies": "^2.0.0",
"yargs": "^17.0.1"
}
}

View File

@ -443,6 +443,7 @@ export class GraphWatcher {
// Important to call _start for built subgraphs on instantiation!
// TODO: Check api version https://github.com/graphprotocol/graph-node/blob/6098daa8955bdfac597cec87080af5449807e874/runtime/wasm/src/module/mod.rs#L533
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this._dataSourceMap[dataSourceName].instance!.exports._start();
}

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Address, log, BigInt, BigDecimal, ByteArray, dataSource, ethereum, Bytes, crypto, json, JSONValueKind } from '@graphprotocol/graph-ts';
import {
@ -164,7 +166,7 @@ export function testGetStorageValue (): void {
// Bind the contract to the address.
const contractAddress = dataSource.address();
const contract = Example1.bind(contractAddress);
Example1.bind(contractAddress);
const res = ethereum.getStorageValue('_test', []);
log.debug('Storage call result: {}', [res!.toBigInt().toString()]);
}
@ -174,7 +176,7 @@ export function testMapStorageValue (): void {
// Bind the contract to the address.
const contractAddress = dataSource.address();
const contract = Example1.bind(contractAddress);
Example1.bind(contractAddress);
const addressValue = ethereum.Value.fromAddress(Address.zero());
const res = ethereum.getStorageValue('addressUintMap', [addressValue]);
log.debug('Storage call result: {}', [res!.toBigInt().toString()]);

View File

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import assert from 'assert';
import { DeepPartial, FindConditions, FindManyOptions } from 'typeorm';

View File

@ -44,22 +44,18 @@
"@cerc-io/solidity-mapper": "^0.2.16",
"@cerc-io/util": "^0.2.16",
"@ethersproject/providers": "^5.4.4",
"@ipld/dag-cbor": "^6.0.12",
"apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1",
"decimal.js": "^10.3.1",
"ethers": "^5.4.4",
"express": "^4.18.2",
"graphql": "^15.5.0",
"json-bigint": "^1.0.0",
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.2.32",
"yargs": "^17.0.1"
},
"devDependencies": {
"@ethersproject/abi": "^5.3.0",
"@types/express": "^4.17.14",
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",

View File

@ -30,10 +30,10 @@ export const handler = async (argv: any): Promise<void> => {
await createCheckpointCmd.init(argv, Database);
const { graphWatcher } = await getGraphDbAndWatcher(
createCheckpointCmd.config!.server,
createCheckpointCmd.clients!.ethClient,
createCheckpointCmd.ethProvider!,
createCheckpointCmd.database!.baseDatabase,
createCheckpointCmd.config.server,
createCheckpointCmd.clients.ethClient,
createCheckpointCmd.ethProvider,
createCheckpointCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -26,10 +26,10 @@ export const handler = async (argv: any): Promise<void> => {
await verifyCheckpointCmd.init(argv, Database);
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
verifyCheckpointCmd.config!.server,
verifyCheckpointCmd.clients!.ethClient,
verifyCheckpointCmd.ethProvider!,
verifyCheckpointCmd.database!.baseDatabase,
verifyCheckpointCmd.config.server,
verifyCheckpointCmd.clients.ethClient,
verifyCheckpointCmd.ethProvider,
verifyCheckpointCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await exportStateCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
exportStateCmd.config!.server,
exportStateCmd.clients!.ethClient,
exportStateCmd.ethProvider!,
exportStateCmd.database!.baseDatabase,
exportStateCmd.config.server,
exportStateCmd.clients.ethClient,
exportStateCmd.ethProvider,
exportStateCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -19,10 +19,10 @@ export const main = async (): Promise<any> => {
await importStateCmd.init(Database);
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
importStateCmd.config!.server,
importStateCmd.clients!.ethClient,
importStateCmd.ethProvider!,
importStateCmd.database!.baseDatabase,
importStateCmd.config.server,
importStateCmd.clients.ethClient,
importStateCmd.ethProvider,
importStateCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await indexBlockCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
indexBlockCmd.config!.server,
indexBlockCmd.clients!.ethClient,
indexBlockCmd.ethProvider!,
indexBlockCmd.database!.baseDatabase,
indexBlockCmd.config.server,
indexBlockCmd.clients.ethClient,
indexBlockCmd.ethProvider,
indexBlockCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await inspectCIDCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
inspectCIDCmd.config!.server,
inspectCIDCmd.clients!.ethClient,
inspectCIDCmd.ethProvider!,
inspectCIDCmd.database!.baseDatabase,
inspectCIDCmd.config.server,
inspectCIDCmd.clients.ethClient,
inspectCIDCmd.ethProvider,
inspectCIDCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -22,11 +22,11 @@ export const handler = async (argv: any): Promise<void> => {
const resetWatcherCmd = new ResetWatcherCmd();
await resetWatcherCmd.init(argv, Database);
const { graphWatcher, graphDb } = await getGraphDbAndWatcher(
resetWatcherCmd.config!.server,
resetWatcherCmd.clients!.ethClient,
resetWatcherCmd.ethProvider!,
resetWatcherCmd.database!.baseDatabase,
const { graphWatcher } = await getGraphDbAndWatcher(
resetWatcherCmd.config.server,
resetWatcherCmd.clients.ethClient,
resetWatcherCmd.ethProvider,
resetWatcherCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ const main = async (): Promise<void> => {
await watchContractCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
watchContractCmd.config!.server,
watchContractCmd.clients!.ethClient,
watchContractCmd.ethProvider!,
watchContractCmd.database!.baseDatabase,
watchContractCmd.config.server,
watchContractCmd.clients.ethClient,
watchContractCmd.ethProvider,
watchContractCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -19,10 +19,10 @@ export const main = async (): Promise<any> => {
await fillCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
fillCmd.config!.server,
fillCmd.clients!.ethClient,
fillCmd.ethProvider!,
fillCmd.database!.baseDatabase,
fillCmd.config.server,
fillCmd.clients.ethClient,
fillCmd.ethProvider,
fillCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -18,10 +18,10 @@ export const main = async (): Promise<any> => {
await jobRunnerCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
jobRunnerCmd.config!.server,
jobRunnerCmd.clients!.ethClient,
jobRunnerCmd.ethProvider!,
jobRunnerCmd.database!.baseDatabase,
jobRunnerCmd.config.server,
jobRunnerCmd.clients.ethClient,
jobRunnerCmd.ethProvider,
jobRunnerCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -21,10 +21,10 @@ export const main = async (): Promise<any> => {
await serverCmd.init(Database);
const { graphWatcher } = await getGraphDbAndWatcher(
serverCmd.config!.server,
serverCmd.clients!.ethClient,
serverCmd.ethProvider!,
serverCmd.database!.baseDatabase,
serverCmd.config.server,
serverCmd.clients.ethClient,
serverCmd.ethProvider,
serverCmd.database.baseDatabase,
ENTITY_QUERY_TYPE_MAP,
ENTITY_TO_LATEST_ENTITY_MAP
);

View File

@ -42,12 +42,10 @@
"@cerc-io/solidity-mapper": "^0.2.16",
"@cerc-io/util": "^0.2.16",
"@ethersproject/providers": "^5.4.4",
"@ipld/dag-cbor": "^6.0.12",
"apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1",
"decimal.js": "^10.3.1",
"ethers": "^5.4.4",
"express": "^4.18.2",
"graphql": "^15.5.0",
"json-bigint": "^1.0.0",
"reflect-metadata": "^0.1.13",
@ -56,7 +54,6 @@
},
"devDependencies": {
"@ethersproject/abi": "^5.3.0",
"@types/express": "^4.17.14",
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",

View File

@ -16,7 +16,6 @@
"debug": "^4.3.1",
"ethers": "^5.4.4",
"fs-extra": "^10.0.0",
"lodash": "^4.17.21",
"mocha": "^8.4.0",
"toml": "^3.0.0",
"yargs": "^17.0.1"

View File

@ -19,6 +19,7 @@
"express": "^4.18.2",
"express-queue": "^0.0.13",
"fs-extra": "^10.0.0",
"js-yaml": "^4.1.0",
"graphql": "^15.5.0",
"graphql-subscriptions": "^2.0.0",
"graphql-ws": "^5.11.2",
@ -32,6 +33,7 @@
"toml": "^3.0.0",
"typeorm": "^0.2.32",
"typeorm-naming-strategies": "^2.0.0",
"yargs": "^17.0.1",
"ws": "^8.11.0"
},
"devDependencies": {
@ -44,6 +46,7 @@
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"@types/js-yaml": "^4.0.4",
"decimal.js": "^10.3.1",
"eslint": "^7.27.0",
"eslint-config-semistandard": "^15.0.1",

View File

@ -61,7 +61,7 @@ const cacheBlockSizesAsync = async (provider: providers.JsonRpcProvider, blockNu
if (blockNumber % BLOCK_SIZE_MAP_CLEAR_HEIGHT_INTERVAL === 0) {
log(`cacheBlockSizesAsync-clear-map-below-${blockNumber}`);
const previousBlockHashes = Array.from(blockSizeMap.entries())
.filter(([_, value]) => value.blockNumber <= blockNumber)
.filter(([, value]) => value.blockNumber <= blockNumber)
.map(([blockHash]) => blockHash);
previousBlockHashes.forEach(blockHash => blockSizeMap.delete(blockHash));

View File

@ -13,7 +13,6 @@ import {
FindConditions,
FindManyOptions,
In,
Not,
QueryRunner,
Repository,
SelectQueryBuilder

View File

@ -76,7 +76,7 @@ export class GraphDatabase {
this._entityToLatestEntityMap = entityToLatestEntityMap;
}
get cachedEntities () {
get cachedEntities (): CachedEntities {
return this._cachedEntities;
}
@ -154,8 +154,9 @@ export class GraphDatabase {
}
}
assert(repo.queryRunner);
const endTimer = eventProcessingLoadEntityDBQueryDuration.startTimer();
const dbEntity = await this._baseDatabase.getPrevEntityVersion(repo.queryRunner!, repo, findOptions);
const dbEntity = await this._baseDatabase.getPrevEntityVersion(repo.queryRunner, repo, findOptions);
endTimer();
return dbEntity;
@ -1074,7 +1075,7 @@ export class GraphDatabase {
}
}
async getBlocksAtHeight (height: number, isPruned: boolean) {
async getBlocksAtHeight (height: number, isPruned: boolean): Promise<BlockProgressInterface[]> {
const repo: Repository<BlockProgressInterface> = this._conn.getRepository('block_progress');
return this._baseDatabase.getBlocksAtHeight(repo, height, isPruned);
@ -1105,7 +1106,7 @@ export class GraphDatabase {
}
}
pruneEntityCacheFrothyBlocks (canonicalBlockHash: string, canonicalBlockNumber: number) {
pruneEntityCacheFrothyBlocks (canonicalBlockHash: string, canonicalBlockNumber: number): void {
const canonicalBlock = this.cachedEntities.frothyBlocks.get(canonicalBlockHash);
if (canonicalBlock) {
@ -1153,7 +1154,7 @@ export class GraphDatabase {
.execute();
}
async pruneEntities (frothyEntityType: new () => any, queryRunner: QueryRunner, blocks: BlockProgressInterface[], entityTypes: Set<new () => any>) {
async pruneEntities (frothyEntityType: new () => any, queryRunner: QueryRunner, blocks: BlockProgressInterface[], entityTypes: Set<new () => any>): Promise<void> {
// Assumption: all blocks are at same height
assert(blocks.length);
const blockNumber = blocks[0].blockNumber;
@ -1249,7 +1250,7 @@ export class GraphDatabase {
);
}
_measureCachedPrunedEntities () {
_measureCachedPrunedEntities (): void {
const totalEntities = Array.from(this.cachedEntities.latestPrunedEntities.values())
.reduce((acc, idEntitiesMap) => acc + idEntitiesMap.size, 0);

View File

@ -26,7 +26,7 @@ export const prepareEntityState = (updatedEntity: any, entityName: string, relat
if (result) {
// Update entity data if relations exist.
const [_, relations] = result;
const [, relations] = result;
// Update relation fields for diff data to be similar to GQL query entities.
Object.entries(relations).forEach(([relation, { isArray, isDerived }]) => {
@ -55,7 +55,7 @@ export const prepareEntityState = (updatedEntity: any, entityName: string, relat
return diffData;
};
export const updateEntitiesFromState = async (database: GraphDatabase, indexer: IndexerInterface, state: StateInterface) => {
export const updateEntitiesFromState = async (database: GraphDatabase, indexer: IndexerInterface, state: StateInterface): Promise<void> => {
const data = indexer.getStateData(state);
// Get relations for subgraph entity
@ -70,7 +70,7 @@ export const updateEntitiesFromState = async (database: GraphDatabase, indexer:
log(`Updating entities from State for entity ${entityName}`);
console.time(`time:watcher#GraphWatcher-updateEntitiesFromState-update-entity-${entityName}`);
for (const [id, entityData] of Object.entries(entities as any)) {
for (const [, entityData] of Object.entries(entities as any)) {
const dbData = database.fromState(state.block, entityName, entityData, relations);
await database.saveEntity(entityName, dbData);
}

View File

@ -534,7 +534,7 @@ export const getSubgraphConfig = async (subgraphPath: string): Promise<any> => {
return config;
};
export const toEntityValue = async (instanceExports: any, entityInstance: any, data: any, field: ColumnMetadata, type: string) => {
export const toEntityValue = async (instanceExports: any, entityInstance: any, data: any, field: ColumnMetadata, type: string): Promise<any> => {
const { __newString, Value } = instanceExports;
const { isArray, propertyName, isNullable } = field;

View File

@ -2322,11 +2322,6 @@
dependencies:
"@octokit/openapi-types" "^7.2.3"
"@openzeppelin/contracts@^4.3.2":
version "4.3.2"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.3.2.tgz#ff80affd6d352dbe1bbc5b4e1833c41afd6283b6"
integrity sha512-AybF1cesONZStg5kWf6ao9OlqTZuPqddvprc0ky7lrUVOjXeKpmQ2Y9FK+6ygxasb+4aic4O5pneFBfwVsRRRg==
"@poanet/solidity-flattener@https://github.com/vulcanize/solidity-flattener.git":
version "3.0.6"
resolved "https://github.com/vulcanize/solidity-flattener.git#144ef6cda8823f4a5e48cb4f615be87a32e2dcbc"