@subql/node-ethereum 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/ethereum/api.service.ethereum.d.ts +3 -2
- package/dist/ethereum/api.service.ethereum.js +7 -2
- package/dist/ethereum/api.service.ethereum.js.map +1 -1
- package/dist/ethereum/api.service.ethereum.test.js +1 -0
- package/dist/ethereum/api.service.ethereum.test.js.map +1 -1
- package/dist/indexer/fetch.module.js +8 -3
- package/dist/indexer/fetch.module.js.map +1 -1
- package/dist/indexer/indexer.module.js +8 -3
- package/dist/indexer/indexer.module.js.map +1 -1
- package/dist/indexer/sandbox.service.js.map +1 -1
- package/dist/init.js +1 -0
- package/dist/init.js.map +1 -1
- package/dist/subcommands/testing.module.js +8 -3
- package/dist/subcommands/testing.module.js.map +1 -1
- package/dist/yargs.d.ts +6 -1
- package/dist/yargs.js +5 -0
- package/dist/yargs.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
2
|
-
import { ApiService, ConnectionPoolService, NetworkMetadataPayload } from '@subql/node-core';
|
|
2
|
+
import { ApiService, ConnectionPoolService, NetworkMetadataPayload, NodeConfig } from '@subql/node-core';
|
|
3
3
|
import { EthereumBlockWrapper } from '@subql/types-ethereum';
|
|
4
4
|
import { SubqueryProject } from '../configure/SubqueryProject';
|
|
5
5
|
import { EthereumApiConnection } from './api.connection';
|
|
@@ -8,7 +8,8 @@ import SafeEthProvider from './safe-api';
|
|
|
8
8
|
export declare class EthereumApiService extends ApiService<EthereumApi, SafeEthProvider, EthereumBlockWrapper> {
|
|
9
9
|
private project;
|
|
10
10
|
private eventEmitter;
|
|
11
|
-
|
|
11
|
+
private nodeConfig;
|
|
12
|
+
constructor(project: SubqueryProject, connectionPoolService: ConnectionPoolService<EthereumApiConnection>, eventEmitter: EventEmitter2, nodeConfig: NodeConfig);
|
|
12
13
|
networkMeta: NetworkMetadataPayload;
|
|
13
14
|
init(): Promise<EthereumApiService>;
|
|
14
15
|
private metadataMismatchError;
|
|
@@ -30,10 +30,11 @@ const api_connection_1 = require("./api.connection");
|
|
|
30
30
|
const logger = (0, node_core_1.getLogger)('api');
|
|
31
31
|
const MAX_RECONNECT_ATTEMPTS = 5;
|
|
32
32
|
let EthereumApiService = class EthereumApiService extends node_core_1.ApiService {
|
|
33
|
-
constructor(project, connectionPoolService, eventEmitter) {
|
|
33
|
+
constructor(project, connectionPoolService, eventEmitter, nodeConfig) {
|
|
34
34
|
super(connectionPoolService);
|
|
35
35
|
this.project = project;
|
|
36
36
|
this.eventEmitter = eventEmitter;
|
|
37
|
+
this.nodeConfig = nodeConfig;
|
|
37
38
|
}
|
|
38
39
|
async init() {
|
|
39
40
|
var _a, e_1, _b, _c;
|
|
@@ -49,6 +50,9 @@ let EthereumApiService = class EthereumApiService extends node_core_1.ApiService
|
|
|
49
50
|
const endpoints = Array.isArray(network.endpoint)
|
|
50
51
|
? network.endpoint
|
|
51
52
|
: [network.endpoint];
|
|
53
|
+
if (this.nodeConfig.primaryNetworkEndpoint) {
|
|
54
|
+
endpoints.push(this.nodeConfig.primaryNetworkEndpoint);
|
|
55
|
+
}
|
|
52
56
|
const endpointToApiIndex = {};
|
|
53
57
|
try {
|
|
54
58
|
for (var _d = true, _e = __asyncValues(endpoints.entries()), _f; _f = await _e.next(), _a = _f.done, !_a;) {
|
|
@@ -151,7 +155,8 @@ EthereumApiService = __decorate([
|
|
|
151
155
|
__param(0, (0, common_1.Inject)('ISubqueryProject')),
|
|
152
156
|
__metadata("design:paramtypes", [SubqueryProject_1.SubqueryProject,
|
|
153
157
|
node_core_1.ConnectionPoolService,
|
|
154
|
-
event_emitter_1.EventEmitter2
|
|
158
|
+
event_emitter_1.EventEmitter2,
|
|
159
|
+
node_core_1.NodeConfig])
|
|
155
160
|
], EthereumApiService);
|
|
156
161
|
exports.EthereumApiService = EthereumApiService;
|
|
157
162
|
//# sourceMappingURL=api.service.ethereum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.service.ethereum.js","sourceRoot":"","sources":["../../src/ethereum/api.service.ethereum.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;;;;;;;;AAEnC,2CAAoD;AACpD,yDAAsD;AAEtD,
|
|
1
|
+
{"version":3,"file":"api.service.ethereum.js","sourceRoot":"","sources":["../../src/ethereum/api.service.ethereum.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;;;;;;;;AAEnC,2CAAoD;AACpD,yDAAsD;AAEtD,gDAO0B;AAE1B,kEAA+D;AAC/D,qDAAyD;AAIzD,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC;AAEhC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAG1B,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,sBAIvC;IACC,YACsC,OAAwB,EAC5D,qBAAmE,EAC3D,YAA2B,EAC3B,UAAsB;QAE9B,KAAK,CAAC,qBAAqB,CAAC,CAAC;QALO,YAAO,GAAP,OAAO,CAAiB;QAEpD,iBAAY,GAAZ,YAAY,CAAe;QAC3B,eAAU,GAAV,UAAU,CAAY;IAGhC,CAAC;IAID,KAAK,CAAC,IAAI;;QACR,IAAI;YACF,IAAI,OAA6B,CAAC;YAClC,IAAI;gBACF,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;aAChC;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;YAED,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAA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,KAAK,CAAC;iCACb;gCAED,MAAM,CAAC,IAAI,CACT,qCAAqC,MAAM,WAAW,OAAO,MAAM,KAAK,CAAC,OAAO,EAAE,CACnF,CAAC;gCACF,aAAa,GAAG,KAAK,CAAC;gCACtB,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gCAC/C,OAAO,EAAE,CAAC;6BACX;yBACF;wBAED,MAAM,CAAC,KAAK,CACV,oBAAoB,UAAU,gCAAgC,MAAM,EAAE,CACvE,CAAC;wBACF,MAAM,aAAa,CAAC;oBACtB,CAAC,CAAC;iBACH;gBACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC7C,CAAC;SACF,CAAC;QAEF,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAC7B,GAAgB,EAChB,KAAe;QAEf,OAAO,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;CACF,CAAA;AAxJY,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAOR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAAkB,iCAAe;QACrC,iCAAqB;QACtB,6BAAa;QACf,sBAAU;GATrB,kBAAkB,CAwJ9B;AAxJY,gDAAkB","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport { ProjectNetworkV1_0_0 } from '@subql/common-ethereum';\nimport {\n ApiService,\n ConnectionPoolService,\n NetworkMetadataPayload,\n getLogger,\n NodeConfig,\n IndexerEvent,\n} from '@subql/node-core';\nimport { EthereumBlockWrapper } from '@subql/types-ethereum';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiConnection } from './api.connection';\nimport { EthereumApi } from './api.ethereum';\nimport SafeEthProvider from './safe-api';\n\nconst logger = getLogger('api');\n\nconst MAX_RECONNECT_ATTEMPTS = 5;\n\n@Injectable()\nexport class EthereumApiService extends ApiService<\n EthereumApi,\n SafeEthProvider,\n EthereumBlockWrapper\n> {\n constructor(\n @Inject('ISubqueryProject') private project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n private eventEmitter: EventEmitter2,\n private nodeConfig: NodeConfig,\n ) {\n super(connectionPoolService);\n }\n\n networkMeta: NetworkMetadataPayload;\n\n async init(): Promise<EthereumApiService> {\n try {\n let network: ProjectNetworkV1_0_0;\n try {\n network = this.project.network;\n } catch (e) {\n logger.error(Object.keys(e));\n process.exit(1);\n }\n\n const endpoints = Array.isArray(network.endpoint)\n ? network.endpoint\n : [network.endpoint];\n\n if (this.nodeConfig.primaryNetworkEndpoint) {\n endpoints.push(this.nodeConfig.primaryNetworkEndpoint);\n }\n\n const endpointToApiIndex: Record<string, EthereumApiConnection> = {};\n\n for await (const [i, endpoint] of endpoints.entries()) {\n const connection = await EthereumApiConnection.create(\n endpoint,\n this.fetchBlockBatches,\n this.eventEmitter,\n );\n\n const api = connection.unsafeApi;\n\n this.eventEmitter.emit(IndexerEvent.ApiConnected, {\n value: 1,\n apiIndex: i,\n endpoint: endpoint,\n });\n\n if (!this.networkMeta) {\n this.networkMeta = connection.networkMeta;\n }\n\n if (network.chainId !== api.getChainId().toString()) {\n throw this.metadataMismatchError(\n 'ChainId',\n network.chainId,\n api.getChainId().toString(),\n );\n }\n\n endpointToApiIndex[endpoint] = connection;\n }\n\n await this.connectionPoolService.addBatchToConnections(\n endpointToApiIndex,\n );\n\n return this;\n } catch (e) {\n logger.error(e, 'Failed to init api service');\n process.exit(1);\n }\n }\n\n private metadataMismatchError(\n metadata: string,\n expected: string,\n actual: string,\n ): Error {\n return Error(\n `Value of ${metadata} does not match across all endpoints. Please check that your endpoints are for the same network.\\n\n Expected: ${expected}\n Actual: ${actual}`,\n );\n }\n\n get api(): EthereumApi {\n return this.unsafeApi;\n }\n\n safeApi(height: number): SafeEthProvider {\n const maxRetries = 5;\n\n const retryErrorCodes = [\n 'UNKNOWN_ERROR',\n 'NOT_IMPLEMENTED',\n 'NETWORK_ERROR',\n 'SERVER_ERROR',\n 'TIMEOUT',\n 'BAD_DATA',\n 'CANCELLED',\n ];\n\n const handler: ProxyHandler<SafeEthProvider> = {\n get: (target, prop, receiver) => {\n const originalMethod = target[prop as keyof SafeEthProvider];\n if (typeof originalMethod === 'function') {\n return async (...args: any[]) => {\n let retries = 0;\n let currentApi = target;\n let throwingError: Error;\n\n while (retries < maxRetries) {\n try {\n return await originalMethod.apply(currentApi, args);\n } catch (error: any) {\n // other than retryErrorCodes, other errors does not have anything to do with network request, retrying would not change its outcome\n if (!retryErrorCodes.includes(error?.code)) {\n throw error;\n }\n\n logger.warn(\n `Request failed with api at height ${height} (retry ${retries}): ${error.message}`,\n );\n throwingError = error;\n currentApi = this.unsafeApi.getSafeApi(height);\n retries++;\n }\n }\n\n logger.error(\n `Maximum retries (${maxRetries}) exceeded for api at height ${height}`,\n );\n throw throwingError;\n };\n }\n return Reflect.get(target, prop, receiver);\n },\n };\n\n return new Proxy(this.unsafeApi.getSafeApi(height), handler);\n }\n\n private async fetchBlockBatches(\n api: EthereumApi,\n batch: number[],\n ): Promise<EthereumBlockWrapper[]> {\n return api.fetchBlocks(batch);\n }\n}\n"]}
|
|
@@ -28,6 +28,7 @@ const prepareApiService = async (endpoint = HTTP_ENDPOINT) => {
|
|
|
28
28
|
const module = await testing_1.Test.createTestingModule({
|
|
29
29
|
providers: [
|
|
30
30
|
node_core_1.ConnectionPoolService,
|
|
31
|
+
node_core_1.ConnectionPoolStateManager,
|
|
31
32
|
{
|
|
32
33
|
provide: node_core_1.NodeConfig,
|
|
33
34
|
useFactory: () => ({}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.service.ethereum.test.js","sourceRoot":"","sources":["../../src/ethereum/api.service.ethereum.test.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;AAGnC,yDAA2D;AAC3D,6CAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"api.service.ethereum.test.js","sourceRoot":"","sources":["../../src/ethereum/api.service.ethereum.test.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;AAGnC,yDAA2D;AAC3D,6CAAuC;AACvC,gDAK0B;AAC1B,qCAAwC;AACxC,mCAA+B;AAE/B,iEAA4D;AAE5D,sBAAsB;AACtB,MAAM,WAAW,GAAG,wCAAwC,CAAC;AAC7D,MAAM,aAAa,GAAG,sCAAsC,CAAC;AAE7D,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,OAAO;QACL,OAAO,EAAE;YACP,QAAQ;YACR,OAAO,EAAE,GAAG;SACb;QACD,WAAW,EAAE,EAAE;QACf,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAI,uBAAa,CAAC,EAAE,CAAC;QAC7B,SAAS,EAAE,EAAE;KACd,CAAC;AACJ,CAAC;AAED,MAAM,iBAAiB,GAAG,KAAK,EAC7B,WAAmB,aAAa,EACiB,EAAE;IACnD,MAAM,MAAM,GAAG,MAAM,cAAI,CAAC,mBAAmB,CAAC;QAC5C,SAAS,EAAE;YACT,iCAAqB;YACrB,sCAA0B;YAC1B;gBACE,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;aACvB;YACD;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,UAAU,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC;aAChD;YACD,yCAAkB;SACnB;QACD,OAAO,EAAE,CAAC,kCAAkB,CAAC,OAAO,EAAE,CAAC;KACxC,CAAC,CAAC,OAAO,EAAE,CAAC;IAEb,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QAE9D,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,QAAU,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACrB,OAAO,UAAU;aACd,OAAO,CAAC,QAAQ,CAAC;aACjB,OAAO,CAAC,2CAA2C,CAAC;aACpD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;QACpE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC/D,MAAM,UAAU;aACb,OAAO,CAAC,QAAQ,CAAC;aACjB,OAAO,CAAC,2CAA2C,CAAC;aACpD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAEzD,MAAM,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { INestApplication } from '@nestjs/common';\nimport { EventEmitterModule } from '@nestjs/event-emitter';\nimport { Test } from '@nestjs/testing';\nimport {\n ConnectionPoolService,\n ConnectionPoolStateManager,\n delay,\n NodeConfig,\n} from '@subql/node-core';\nimport { GraphQLSchema } from 'graphql';\nimport { range } from 'lodash';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiService } from './api.service.ethereum';\n\n// Add api key to work\nconst WS_ENDPOINT = 'wss://eth.api.onfinality.io/ws?apikey=';\nconst HTTP_ENDPOINT = 'https://eth.api.onfinality.io/public';\n\nfunction testSubqueryProject(endpoint: string): SubqueryProject {\n return {\n network: {\n endpoint,\n chainId: '1',\n },\n dataSources: [],\n id: 'test',\n root: './',\n schema: new GraphQLSchema({}),\n templates: [],\n };\n}\n\nconst prepareApiService = async (\n endpoint: string = HTTP_ENDPOINT,\n): Promise<[EthereumApiService, INestApplication]> => {\n const module = await Test.createTestingModule({\n providers: [\n ConnectionPoolService,\n ConnectionPoolStateManager,\n {\n provide: NodeConfig,\n useFactory: () => ({}),\n },\n {\n provide: 'ISubqueryProject',\n useFactory: () => testSubqueryProject(endpoint),\n },\n EthereumApiService,\n ],\n imports: [EventEmitterModule.forRoot()],\n }).compile();\n\n const app = module.createNestApplication();\n await app.init();\n const apiService = app.get(EthereumApiService);\n await apiService.init();\n return [apiService, app];\n};\n\njest.setTimeout(90000);\ndescribe('ApiService', () => {\n let apiService: EthereumApiService;\n let app: INestApplication;\n\n beforeEach(async () => {\n [apiService, app] = await prepareApiService();\n });\n\n afterEach(async () => {\n return app?.close();\n });\n\n it('can instantiate api', async () => {\n console.log(apiService.api.getChainId());\n await delay(0.5);\n });\n\n it('can fetch blocks', async () => {\n await apiService.api.fetchBlocks(range(12369621, 12369625));\n await delay(0.5);\n });\n\n it('can get the finalized height', async () => {\n const height = await apiService.api.getFinalizedBlockHeight();\n\n console.log('Finalized height', height);\n expect(height).toBeGreaterThan(16_000_000);\n });\n\n it('ensure api errorCode is exposed when throwing', async () => {\n expect.assertions(1);\n return apiService\n .safeApi(17520376)\n .getCode('0x75F0398549C9fDEa03BbDde388361827cb376D5')\n .catch((e) => expect(e.code).toBe('INVALID_ARGUMENT'));\n });\n it('should not retry on any errors not in the retry list', async () => {\n const callSpy = jest.spyOn(apiService.unsafeApi, 'getSafeApi');\n await apiService\n .safeApi(17520376)\n .getCode('0x75F0398549C9fDEa03BbDde388361827cb376D5')\n .catch((e) => expect(e.code).toBe('INVALID_ARGUMENT'));\n\n expect(callSpy).toHaveBeenCalledTimes(1);\n });\n});\n"]}
|
|
@@ -31,12 +31,17 @@ FetchModule = __decorate([
|
|
|
31
31
|
node_core_1.StoreCacheService,
|
|
32
32
|
{
|
|
33
33
|
provide: node_core_1.ApiService,
|
|
34
|
-
useFactory: async (project, connectionPoolService, eventEmitter) => {
|
|
35
|
-
const apiService = new api_service_ethereum_1.EthereumApiService(project, connectionPoolService, eventEmitter);
|
|
34
|
+
useFactory: async (project, connectionPoolService, eventEmitter, nodeConfig) => {
|
|
35
|
+
const apiService = new api_service_ethereum_1.EthereumApiService(project, connectionPoolService, eventEmitter, nodeConfig);
|
|
36
36
|
await apiService.init();
|
|
37
37
|
return apiService;
|
|
38
38
|
},
|
|
39
|
-
inject: [
|
|
39
|
+
inject: [
|
|
40
|
+
'ISubqueryProject',
|
|
41
|
+
node_core_1.ConnectionPoolService,
|
|
42
|
+
event_emitter_1.EventEmitter2,
|
|
43
|
+
node_core_1.NodeConfig,
|
|
44
|
+
],
|
|
40
45
|
},
|
|
41
46
|
indexer_manager_1.IndexerManager,
|
|
42
47
|
node_core_1.ConnectionPoolStateManager,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,gDAc0B;AAG1B,2EAAsE;AACtE,uDAG2B;AAC3B,6DAAyD;AACzD,iEAA4D;AAC5D,6DAAwD;AACxD,mDAA+C;AAC/C,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;
|
|
1
|
+
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[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,2BAAe;YACf,6BAAiB;YACjB;gBACE,QAAQ,EAAE,gCAAc;gBACxB,OAAO,EAAE,iBAAiB;aAC3B;YACD,oDAAwB;SACzB;QACD,OAAO,EAAE,CAAC,wBAAY,EAAE,sBAAU,EAAE,6BAAiB,EAAE,2BAAe,CAAC;KACxE,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n PoiBenchmarkService,\n IndexingBenchmarkService,\n MmrService,\n StoreService,\n PoiService,\n ApiService,\n NodeConfig,\n ConnectionPoolService,\n ConnectionPoolStateManager,\n SmartBatchService,\n StoreCacheService,\n PgMmrCacheService,\n MmrQueryService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { EthereumApiService } from '../ethereum/api.service.ethereum';\nimport {\n BlockDispatcherService,\n WorkerBlockDispatcherService,\n} from './blockDispatcher';\nimport { DictionaryService } from './dictionary.service';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { FetchService } from './fetch.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Module({\n providers: [\n StoreService,\n StoreCacheService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n nodeConfig,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n IndexerManager,\n ConnectionPoolStateManager,\n ConnectionPoolService,\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: 'IBlockDispatcher',\n useFactory: (\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n projectService: ProjectService,\n apiService: EthereumApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiService: PoiService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>,\n ) =>\n nodeConfig.workers !== undefined\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n connectionPoolState,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n StoreService,\n StoreCacheService,\n PoiService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ConnectionPoolStateManager,\n ],\n },\n FetchService,\n ConnectionPoolService,\n IndexingBenchmarkService,\n PoiBenchmarkService,\n {\n provide: DictionaryService,\n useFactory: async (project: SubqueryProject, nodeConfig: NodeConfig) => {\n const dictionaryService = await DictionaryService.create(\n project,\n nodeConfig,\n );\n return dictionaryService;\n },\n inject: ['ISubqueryProject', NodeConfig],\n },\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n MmrService,\n MmrQueryService,\n PgMmrCacheService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, MmrService, StoreCacheService, MmrQueryService],\n})\nexport class FetchModule {}\n"]}
|
|
@@ -42,12 +42,17 @@ IndexerModule = __decorate([
|
|
|
42
42
|
node_core_1.ConnectionPoolService,
|
|
43
43
|
{
|
|
44
44
|
provide: node_core_1.ApiService,
|
|
45
|
-
useFactory: async (project, connectionPoolService, eventEmitter) => {
|
|
46
|
-
const apiService = new ethereum_1.EthereumApiService(project, connectionPoolService, eventEmitter);
|
|
45
|
+
useFactory: async (project, connectionPoolService, eventEmitter, nodeConfig) => {
|
|
46
|
+
const apiService = new ethereum_1.EthereumApiService(project, connectionPoolService, eventEmitter, nodeConfig);
|
|
47
47
|
await apiService.init();
|
|
48
48
|
return apiService;
|
|
49
49
|
},
|
|
50
|
-
inject: [
|
|
50
|
+
inject: [
|
|
51
|
+
'ISubqueryProject',
|
|
52
|
+
node_core_1.ConnectionPoolService,
|
|
53
|
+
event_emitter_1.EventEmitter2,
|
|
54
|
+
node_core_1.NodeConfig,
|
|
55
|
+
],
|
|
51
56
|
},
|
|
52
57
|
sandbox_service_1.SandboxService,
|
|
53
58
|
ds_processor_service_1.DsProcessorService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.module.js","sourceRoot":"","sources":["../../src/indexer/indexer.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,mDAA8C;AAC9C,2CAAwC;AACxC,yDAAsD;AACtD,gDAa0B;AAE1B,0CAAiD;AAEjD,iEAA4D;AAC5D,6DAAwD;AACxD,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AACvE,4DAAwD;AACxD,gGAA2F;
|
|
1
|
+
{"version":3,"file":"indexer.module.js","sourceRoot":"","sources":["../../src/indexer/indexer.module.ts"],"names":[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AAC,IAAI,CAAC,CAAC;gBAC1D,CAAC;aACF;YACD,sBAAU;YACV,sBAAU;YACV,6BAAiB;YACjB,2BAAe;YACf;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,QAAQ,EAAE,gCAAc;aACzB;YACD,8BAAa;YACb;gBACE,OAAO,EAAE,oDAAwB;gBACjC,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,6BAAY,EAAE;wBAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;qBACjD;oBACD,OAAO,IAAI,iEAA8B,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;gBAClE,CAAC;aACF;SACF;QACD,OAAO,EAAE,CAAC,wBAAY,EAAE,sBAAU,EAAE,2BAAe,CAAC;KACrD,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { isMainThread } from 'worker_threads';\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n ApiService,\n StoreService,\n PoiService,\n MmrService,\n ConnectionPoolService,\n StoreCacheService,\n WorkerDynamicDsService,\n WorkerConnectionPoolStateManager,\n ConnectionPoolStateManager,\n NodeConfig,\n PgMmrCacheService,\n MmrQueryService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiService } from '../ethereum';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\nimport { WorkerService } from './worker/worker.service';\nimport { WorkerUnfinalizedBlocksService } from './worker/worker.unfinalizedBlocks.service';\n\n@Module({\n providers: [\n IndexerManager,\n StoreCacheService,\n StoreService,\n {\n provide: ConnectionPoolStateManager,\n useFactory: () => {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n return new WorkerConnectionPoolStateManager((global as any).host);\n },\n },\n ConnectionPoolService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n nodeConfig,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n SandboxService,\n DsProcessorService,\n {\n provide: DynamicDsService,\n useFactory: () => {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n return new WorkerDynamicDsService((global as any).host);\n },\n },\n PoiService,\n MmrService,\n PgMmrCacheService,\n MmrQueryService,\n {\n provide: 'IProjectService',\n useClass: ProjectService,\n },\n WorkerService,\n {\n provide: UnfinalizedBlocksService,\n useFactory: () => {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n return new WorkerUnfinalizedBlocksService((global as any).host);\n },\n },\n ],\n exports: [StoreService, MmrService, MmrQueryService],\n})\nexport class IndexerModule {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.service.js","sourceRoot":"","sources":["../../src/indexer/sandbox.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,mDAA8C;AAC9C,2CAAoD;AAEpD,gDAO0B;AAI1B,+GAA+G;AAExG,IAAM,cAAc,GAApB,MAAM,cAAc;IAGzB,YACmB,UAAsB,EACtB,YAA0B,EAC1B,UAAsB,EACM,OAAyB;QAHrD,eAAU,GAAV,UAAU,CAAY;QACtB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAY;QACM,YAAO,GAAP,OAAO,CAAkB;QANhE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ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { isMainThread } from 'worker_threads';\nimport { Inject, Injectable } from '@nestjs/common';\nimport { BaseDataSource } from '@subql/common';\nimport {\n NodeConfig,\n StoreService,\n IndexerSandbox,\n hostStoreToStore,\n ISubqueryProject,\n ApiService,\n} from '@subql/node-core';\nimport { Store } from '@subql/types-ethereum';\nimport SafeEthProvider from '../ethereum/safe-api';\n\n/* It would be nice to move this to node core but need to find a way to inject other things into the sandbox */\n@Injectable()\nexport class SandboxService {\n private processorCache: Record<string, IndexerSandbox> = {};\n\n constructor(\n private readonly apiService: ApiService,\n private readonly storeService: StoreService,\n private readonly nodeConfig: NodeConfig,\n @Inject('ISubqueryProject') private readonly project: ISubqueryProject,\n ) {}\n\n getDsProcessor(ds: BaseDataSource, api: SafeEthProvider): IndexerSandbox {\n const store: Store = isMainThread\n ? this.storeService.getStore()\n : hostStoreToStore((global as any).host); // Provided in worker.ts\n\n const entry = this.getDataSourceEntry(ds);\n let processor = this.processorCache[entry];\n if (!processor) {\n processor = new IndexerSandbox(\n {\n store,\n root: this.project.root,\n entry,\n chainId: this.project.network.chainId,\n },\n this.nodeConfig,\n );\n this.processorCache[entry] = processor;\n }\n processor.freeze(api, 'api');\n if (this.nodeConfig.unsafe) {\n processor.freeze(this.apiService.api.api, 'unsafeApi');\n }\n processor.freeze(this.project.network.chainId, 'chainId');\n return processor;\n }\n\n private getDataSourceEntry(ds: BaseDataSource): string {\n return ds.mapping.file;\n }\n}\n"]}
|
package/dist/init.js
CHANGED
|
@@ -13,6 +13,7 @@ const pjson = require('../package.json');
|
|
|
13
13
|
const { argv } = yargs_1.yargsOptions;
|
|
14
14
|
const DEFAULT_PORT = 3000;
|
|
15
15
|
const logger = (0, node_core_1.getLogger)('subql-node');
|
|
16
|
+
(0, common_1.notifyUpdates)(pjson, logger);
|
|
16
17
|
async function bootstrap() {
|
|
17
18
|
var _a;
|
|
18
19
|
logger.info(`Current ${pjson.name} version is ${pjson.version}`);
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;AAEnC,uCAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;AAEnC,uCAA2C;AAC3C,0CAAiE;AACjE,gDAAyD;AACzD,6CAAyC;AACzC,2DAAuD;AAEvD,mCAAuC;AACvC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEzC,MAAM,EAAE,IAAI,EAAE,GAAG,oBAAY,CAAC;AAE9B,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,YAAY,CAAC,CAAC;AAEvC,IAAA,sBAAa,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAEtB,KAAK,UAAU,SAAS;;IAC7B,MAAM,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,eAAe,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAEzB,MAAM,QAAQ,GAAG,CAAC,CAAM,EAAE,EAAE;QAC1B,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAI,CAAC,MAAM,IAAA,0BAAiB,EAAC,YAAY,CAAC,CAAC,CAAC;IAC5E,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,CAAC,KAAK,CACV,wDAAwD,IAAI,KAC1D,IAAI,GAAG,EACT,iEAAiE,CAClE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IAED,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,MAAM,CAAC,IAAI,CACT,mHAAmH,CACpH,CAAC;KACH;IAED,IAAI;QACF,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,EAAE;YAC9C,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,sBAAU,EAAE,CAAC,CAAC,CAAC,KAAK;SACzC,CAAC,CAAC;QACH,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAEjB,MAAM,cAAc,GAAmB,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAClE,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,CAAC,4BAAY,CAAC,CAAC;QAE3C,yGAAyG;QACzG,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC;QAC5B,MAAM,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAEpD,GAAG,CAAC,mBAAmB,EAAE,CAAC;QAE1B,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEvB,MAAM,CAAC,IAAI,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;KAC9C;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AA/CD,8BA+CC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { NestFactory } from '@nestjs/core';\nimport { findAvailablePort, notifyUpdates } from '@subql/common';\nimport { getLogger, NestLogger } from '@subql/node-core';\nimport { AppModule } from './app.module';\nimport { FetchService } from './indexer/fetch.service';\nimport { ProjectService } from './indexer/project.service';\nimport { yargsOptions } from './yargs';\nconst pjson = require('../package.json');\n\nconst { argv } = yargsOptions;\n\nconst DEFAULT_PORT = 3000;\nconst logger = getLogger('subql-node');\n\nnotifyUpdates(pjson, logger);\n\nexport async function bootstrap(): Promise<void> {\n logger.info(`Current ${pjson.name} version is ${pjson.version}`);\n const debug = argv.debug;\n\n const validate = (x: any) => {\n const p = parseInt(x);\n return isNaN(p) ? null : p;\n };\n\n const port = validate(argv.port) ?? (await findAvailablePort(DEFAULT_PORT));\n if (!port) {\n logger.error(\n `Unable to find available port (tried ports in range (${port}..${\n port + 10\n })). Try setting a free port manually by setting the --port flag`,\n );\n process.exit(1);\n }\n\n if (argv.unsafe) {\n logger.warn(\n 'UNSAFE MODE IS ENABLED. This is not recommended for most projects and will not be supported by our hosted service',\n );\n }\n\n try {\n const app = await NestFactory.create(AppModule, {\n logger: debug ? new NestLogger() : false,\n });\n await app.init();\n\n const projectService: ProjectService = app.get('IProjectService');\n const fetchService = app.get(FetchService);\n\n // Initialise async services, we do this here rather than in factories, so we can capture one off eventss\n await projectService.init();\n await fetchService.init(projectService.startHeight);\n\n app.enableShutdownHooks();\n\n await app.listen(port);\n\n logger.info(`Node started on port: ${port}`);\n } catch (e) {\n logger.error(e, 'Node failed to start');\n process.exit(1);\n }\n}\n"]}
|
|
@@ -46,12 +46,17 @@ TestingFeatureModule = __decorate([
|
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
provide: node_core_1.ApiService,
|
|
49
|
-
useFactory: async (project, connectionPoolService, eventEmitter) => {
|
|
50
|
-
const apiService = new ethereum_1.EthereumApiService(project, connectionPoolService, eventEmitter);
|
|
49
|
+
useFactory: async (project, connectionPoolService, eventEmitter, nodeConfig) => {
|
|
50
|
+
const apiService = new ethereum_1.EthereumApiService(project, connectionPoolService, eventEmitter, nodeConfig);
|
|
51
51
|
await apiService.init();
|
|
52
52
|
return apiService;
|
|
53
53
|
},
|
|
54
|
-
inject: [
|
|
54
|
+
inject: [
|
|
55
|
+
'ISubqueryProject',
|
|
56
|
+
node_core_1.ConnectionPoolService,
|
|
57
|
+
event_emitter_1.EventEmitter2,
|
|
58
|
+
node_core_1.NodeConfig,
|
|
59
|
+
],
|
|
55
60
|
},
|
|
56
61
|
schedule_1.SchedulerRegistry,
|
|
57
62
|
node_core_1.TestRunner,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.module.js","sourceRoot":"","sources":["../../src/subcommands/testing.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAA0E;AAC1E,+CAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"testing.module.js","sourceRoot":"","sources":["../../src/subcommands/testing.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAA0E;AAC1E,+CAAqE;AACrE,gDAQ0B;AAC1B,oEAAgE;AAEhE,0CAAiD;AAEjD,0EAAqE;AACrE,sEAAiE;AACjE,0DAAsD;AACtD,gEAA4D;AAC5D,gEAA4D;AAC5D,gEAA4D;AAC5D,oFAAgF;AAChF,qDAAiD;AACjD,uDAAmD;AA2D5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oBAAoB;IAzDhC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,wBAAY;YACZ,gCAAc;YACd,6BAAa;YACb,sBAAU;YACV,gCAAc;YACd,yCAAkB;YAClB,qCAAgB;YAChB,oDAAwB;YACxB,gCAAc;YACd,oDAAwB;YACxB,iCAAqB;YACrB;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,QAAQ,EAAE,gCAAc;aACzB;YACD;gBACE,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,KAAK,EACf,OAAwB,EACxB,qBAAmE,EACnE,YAA2B,EAC3B,UAAsB,EACtB,EAAE;oBACF,MAAM,UAAU,GAAG,IAAI,6BAAkB,CACvC,OAAO,EACP,qBAAqB,EACrB,YAAY,EACZ,UAAU,CACX,CAAC;oBACF,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;oBACxB,OAAO,UAAU,CAAC;gBACpB,CAAC;gBACD,MAAM,EAAE;oBACN,kBAAkB;oBAClB,iCAAqB;oBACrB,6BAAa;oBACb,sBAAU;iBACX;aACF;YACD,4BAAiB;YACjB,sBAAU;YACV;gBACE,OAAO,EAAE,MAAM;gBACf,QAAQ,EAAE,6BAAkB;aAC7B;YACD;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,QAAQ,EAAE,gCAAc;aACzB;SACF;QAED,OAAO,EAAE,CAAC,wBAAU,EAAE,0BAAW,CAAC;QAClC,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,CAAC,sBAAU,CAAC;KACtB,CAAC;GACW,oBAAoB,CAAG;AAAvB,oDAAoB;AAY1B,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,aAAa;IAVzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,kCAAkB,CAAC,OAAO,EAAE;YAC5B,yBAAc,CAAC,OAAO,EAAE;YACxB,oBAAoB;SACrB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2, EventEmitterModule } from '@nestjs/event-emitter';\nimport { ScheduleModule, SchedulerRegistry } from '@nestjs/schedule';\nimport {\n ApiService,\n ConnectionPoolService,\n DbModule,\n NodeConfig,\n PoiService,\n StoreService,\n TestRunner,\n} from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiService } from '../ethereum';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { DsProcessorService } from '../indexer/ds-processor.service';\nimport { DynamicDsService } from '../indexer/dynamic-ds.service';\nimport { FetchModule } from '../indexer/fetch.module';\nimport { IndexerManager } from '../indexer/indexer.manager';\nimport { ProjectService } from '../indexer/project.service';\nimport { SandboxService } from '../indexer/sandbox.service';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';\nimport { MetaModule } from '../meta/meta.module';\nimport { TestingService } from './testing.service';\n\n@Module({\n providers: [\n StoreService,\n TestingService,\n EventEmitter2,\n PoiService,\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n UnfinalizedBlocksService,\n ProjectService,\n UnfinalizedBlocksService,\n ConnectionPoolService,\n {\n provide: 'IProjectService',\n useClass: ProjectService,\n },\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n nodeConfig,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n SchedulerRegistry,\n TestRunner,\n {\n provide: 'IApi',\n useClass: EthereumApiService,\n },\n {\n provide: 'IIndexerManager',\n useClass: IndexerManager,\n },\n ],\n\n imports: [MetaModule, FetchModule],\n controllers: [],\n exports: [TestRunner],\n})\nexport class TestingFeatureModule {}\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n EventEmitterModule.forRoot(),\n ScheduleModule.forRoot(),\n TestingFeatureModule,\n ],\n controllers: [],\n})\nexport class TestingModule {}\n"]}
|
package/dist/yargs.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<imp
|
|
|
75
75
|
describe: string;
|
|
76
76
|
type: "string";
|
|
77
77
|
};
|
|
78
|
-
}>, "unsafe" | "mmr-store-type" | "mmr-path" | "db-schema" | "subquery" | "batch-size" | "block-confirmations" | "config" | "debug" | "dictionary-resolver" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "multi-chain" | "network-dictionary" | "network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "query-limit" | "scale-batch-size" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold" | "store-cache-upper-limit" | "store-get-cache-size" | "store-cache-async" | "store-flush-interval" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "workers" | "root" | "query-address-limit"> & import("yargs").InferredOptionTypes<{
|
|
78
|
+
}>, "unsafe" | "mmr-store-type" | "mmr-path" | "db-schema" | "subquery" | "batch-size" | "block-confirmations" | "config" | "debug" | "dictionary-resolver" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "multi-chain" | "network-dictionary" | "network-endpoint" | "primary-network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "query-limit" | "scale-batch-size" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold" | "store-cache-upper-limit" | "store-get-cache-size" | "store-cache-async" | "store-flush-interval" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "workers" | "root" | "query-address-limit"> & import("yargs").InferredOptionTypes<{
|
|
79
79
|
'batch-size': {
|
|
80
80
|
demandOption: false;
|
|
81
81
|
describe: string;
|
|
@@ -160,6 +160,11 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<imp
|
|
|
160
160
|
type: "string";
|
|
161
161
|
describe: string;
|
|
162
162
|
};
|
|
163
|
+
'primary-network-endpoint': {
|
|
164
|
+
demandOption: false;
|
|
165
|
+
type: "string";
|
|
166
|
+
describe: string;
|
|
167
|
+
};
|
|
163
168
|
'output-fmt': {
|
|
164
169
|
demandOption: false;
|
|
165
170
|
describe: string;
|
package/dist/yargs.js
CHANGED
|
@@ -235,6 +235,11 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
|
|
|
235
235
|
type: 'string',
|
|
236
236
|
describe: 'Blockchain network endpoint to connect',
|
|
237
237
|
},
|
|
238
|
+
'primary-network-endpoint': {
|
|
239
|
+
demandOption: false,
|
|
240
|
+
type: 'string',
|
|
241
|
+
describe: 'Primary blockchain endpoint, used as the first choice for connections.',
|
|
242
|
+
},
|
|
238
243
|
'output-fmt': {
|
|
239
244
|
demandOption: false,
|
|
240
245
|
describe: 'Print log as json or plain text',
|
package/dist/yargs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/yargs.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;AAEnC,oDAAqD;AACrD,2CAAwC;AACxC,wDAAgC;AAEnB,QAAA,YAAY,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACrD,GAAG,CAAC,YAAY,CAAC;KACjB,OAAO,CAAC;IACP,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,sCAAsC;IAChD,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QACF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAC9D,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,aAAa;IACtB,QAAQ,EACN,mIAAmI;IACrI,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB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,8DAA8D;QACxE,IAAI,EAAE,QAAQ;KACf;IACD,iBAAiB,EAAE;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,oDAAoD;QAC9D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,oBAAoB,EAAE;QACpB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;IACD,IAAI,EAAE;QACJ,QAAQ,EACN,wKAAwK;QAC1K,IAAI,EAAE,QAAQ;KACf;IACD,qBAAqB,EAAE;QACrB,QAAQ,EACN,yEAAyE;QAC3E,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG;KACb;CACF,CAAC;KACD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,8CAA8C","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'test',\n describe: 'Run tests for a SubQuery application',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { testingInit } = require('./subcommands/testing.init');\n return testingInit();\n },\n })\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .command({\n command: 'mmr-regen',\n describe:\n 'Re-generate mmr between Filebased/Postgres mmr and Proof of index',\n builder: (yargs) =>\n yargs.options({\n probe: {\n type: 'boolean',\n description:\n 'Fetch latest mmr height information from file based/postgres DB and Poi table',\n demandOption: false,\n default: false,\n },\n targetHeight: {\n type: 'number',\n description: 'Re-genrate mmr value from this block height',\n demandOption: false,\n },\n resetOnly: {\n type: 'boolean',\n description:\n 'Only reset the mmr value in both POI and file based/postgres DB to target height',\n demandOption: false,\n default: false,\n },\n unsafe: {\n type: 'boolean',\n description: 'Allow sync mmr from Poi table to file or a postgres DB',\n demandOption: false,\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe:\n 'When regenerate MMR store in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe:\n 'File based only : local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrRegenerateInit } = require('./subcommands/mmrRegenerate.init');\n return mmrRegenerateInit(\n argv.probe,\n argv.resetOnly,\n argv.unsafe,\n argv.targetHeight,\n );\n },\n })\n .command({\n command: 'mmr-migrate',\n describe: 'Migrate MMR data from storage file to postgres DB',\n builder: (yargs) =>\n yargs.options({\n direction: {\n type: 'string',\n description: 'set direction of migration (file -> DB or DB -> file)',\n demandOption: false,\n choices: ['dbToFile', 'fileToDb'],\n default: 'dbToFile',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrMigrateInit } = require('./subcommands/mmrMigrate.init');\n return mmrMigrateInit(argv.direction);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n 'block-confirmations': {\n demandOption: false,\n default: 20,\n describe:\n 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use SubQuery Network dictionary resolver',\n type: 'string',\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe: 'Store MMR in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enable TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush data to the database when number of records excess this threshold',\n type: 'number',\n },\n 'store-cache-upper-limit': {\n demandOption: false,\n describe:\n 'Defines the upper limit to the store cache size. When this limit is reached indexing will wait for the cache to be flushed before continuing.',\n type: 'number',\n },\n 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\n type: 'number',\n },\n 'store-cache-async': {\n demandOption: false,\n describe:\n 'If enabled the store cache will flush data asyncronously relative to indexing data',\n type: 'boolean',\n },\n 'store-flush-interval': {\n demandOption: false,\n describe:\n 'The interval, in seconds, at which data is flushed from the cache. ' +\n 'This ensures that data is persisted regularly when there is either not much data or the project is up to date.',\n type: 'number',\n default: 5,\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n root: {\n describe:\n 'This is a hidden flag only used from the main thread to workers. It provides a root directory for the project. This is a temp directory with IPFS and GitHub projects.',\n type: 'string',\n },\n 'query-address-limit': {\n describe:\n 'Set the limit for address on dictionary queries for dynamic datasources',\n type: 'number',\n default: 100,\n },\n })\n .hide('root'); // root is hidden because its for internal use\n"]}
|
|
1
|
+
{"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/yargs.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;AAEnC,oDAAqD;AACrD,2CAAwC;AACxC,wDAAgC;AAEnB,QAAA,YAAY,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACrD,GAAG,CAAC,YAAY,CAAC;KACjB,OAAO,CAAC;IACP,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,sCAAsC;IAChD,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QACF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAC9D,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,aAAa;IACtB,QAAQ,EACN,mIAAmI;IACrI,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,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QACZ,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,qDAAqD;QAC/D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,OAAO,EAAE;QACP,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,8DAA8D;QACxE,IAAI,EAAE,QAAQ;KACf;IACD,iBAAiB,EAAE;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,oDAAoD;QAC9D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,oBAAoB,EAAE;QACpB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;IACD,IAAI,EAAE;QACJ,QAAQ,EACN,wKAAwK;QAC1K,IAAI,EAAE,QAAQ;KACf;IACD,qBAAqB,EAAE;QACrB,QAAQ,EACN,yEAAyE;QAC3E,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG;KACb;CACF,CAAC;KACD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,8CAA8C","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'test',\n describe: 'Run tests for a SubQuery application',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { testingInit } = require('./subcommands/testing.init');\n return testingInit();\n },\n })\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .command({\n command: 'mmr-regen',\n describe:\n 'Re-generate mmr between Filebased/Postgres mmr and Proof of index',\n builder: (yargs) =>\n yargs.options({\n probe: {\n type: 'boolean',\n description:\n 'Fetch latest mmr height information from file based/postgres DB and Poi table',\n demandOption: false,\n default: false,\n },\n targetHeight: {\n type: 'number',\n description: 'Re-genrate mmr value from this block height',\n demandOption: false,\n },\n resetOnly: {\n type: 'boolean',\n description:\n 'Only reset the mmr value in both POI and file based/postgres DB to target height',\n demandOption: false,\n default: false,\n },\n unsafe: {\n type: 'boolean',\n description: 'Allow sync mmr from Poi table to file or a postgres DB',\n demandOption: false,\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe:\n 'When regenerate MMR store in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe:\n 'File based only : local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrRegenerateInit } = require('./subcommands/mmrRegenerate.init');\n return mmrRegenerateInit(\n argv.probe,\n argv.resetOnly,\n argv.unsafe,\n argv.targetHeight,\n );\n },\n })\n .command({\n command: 'mmr-migrate',\n describe: 'Migrate MMR data from storage file to postgres DB',\n builder: (yargs) =>\n yargs.options({\n direction: {\n type: 'string',\n description: 'set direction of migration (file -> DB or DB -> file)',\n demandOption: false,\n choices: ['dbToFile', 'fileToDb'],\n default: 'dbToFile',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrMigrateInit } = require('./subcommands/mmrMigrate.init');\n return mmrMigrateInit(argv.direction);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n 'block-confirmations': {\n demandOption: false,\n default: 20,\n describe:\n 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use SubQuery Network dictionary resolver',\n type: 'string',\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'primary-network-endpoint': {\n demandOption: false,\n type: 'string',\n describe:\n 'Primary blockchain endpoint, used as the first choice for connections.',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe: 'Store MMR in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enable TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush data to the database when number of records excess this threshold',\n type: 'number',\n },\n 'store-cache-upper-limit': {\n demandOption: false,\n describe:\n 'Defines the upper limit to the store cache size. When this limit is reached indexing will wait for the cache to be flushed before continuing.',\n type: 'number',\n },\n 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\n type: 'number',\n },\n 'store-cache-async': {\n demandOption: false,\n describe:\n 'If enabled the store cache will flush data asyncronously relative to indexing data',\n type: 'boolean',\n },\n 'store-flush-interval': {\n demandOption: false,\n describe:\n 'The interval, in seconds, at which data is flushed from the cache. ' +\n 'This ensures that data is persisted regularly when there is either not much data or the project is up to date.',\n type: 'number',\n default: 5,\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n root: {\n describe:\n 'This is a hidden flag only used from the main thread to workers. It provides a root directory for the project. This is a temp directory with IPFS and GitHub projects.',\n type: 'string',\n },\n 'query-address-limit': {\n describe:\n 'Set the limit for address on dictionary queries for dynamic datasources',\n type: 'number',\n default: 100,\n },\n })\n .hide('root'); // root is hidden because its for internal use\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subql/node-ethereum",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Ian He",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"@nestjs/event-emitter": "^2.0.0",
|
|
25
25
|
"@nestjs/platform-express": "^9.4.0",
|
|
26
26
|
"@nestjs/schedule": "^3.0.1",
|
|
27
|
-
"@subql/common": "^2.
|
|
28
|
-
"@subql/common-ethereum": "2.2.
|
|
29
|
-
"@subql/node-core": "^4.
|
|
27
|
+
"@subql/common": "^2.5.0",
|
|
28
|
+
"@subql/common-ethereum": "2.2.2",
|
|
29
|
+
"@subql/node-core": "^4.2.1",
|
|
30
30
|
"@subql/testing": "^2.0.0",
|
|
31
|
-
"@subql/types": "^2.1.
|
|
32
|
-
"@subql/types-ethereum": "2.2.
|
|
31
|
+
"@subql/types": "^2.1.4",
|
|
32
|
+
"@subql/types-ethereum": "2.2.4",
|
|
33
33
|
"@willsoto/nestjs-prometheus": "^4.4.0",
|
|
34
34
|
"cacheable-lookup": "6",
|
|
35
35
|
"cron-converter": "^1.0.2",
|