@subql/node-ethereum 4.0.0 → 4.0.1-1

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.
@@ -64,7 +64,7 @@ FetchModule = __decorate([
64
64
  },
65
65
  {
66
66
  provide: 'IBlockDispatcher',
67
- useFactory: (nodeConfig, eventEmitter, projectService, projectUpgradeService, apiService, indexerManager, smartBatchService, cacheService, storeService, storeCacheService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState) => nodeConfig.workers !== undefined
67
+ useFactory: (nodeConfig, eventEmitter, projectService, projectUpgradeService, apiService, indexerManager, smartBatchService, cacheService, storeService, storeCacheService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState) => nodeConfig.workers
68
68
  ? new blockDispatcher_1.WorkerBlockDispatcherService(nodeConfig, eventEmitter, projectService, projectUpgradeService, smartBatchService, cacheService, storeService, storeCacheService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState)
69
69
  : new blockDispatcher_1.BlockDispatcherService(apiService, nodeConfig, indexerManager, eventEmitter, projectService, projectUpgradeService, smartBatchService, storeService, storeCacheService, poiSyncService, project, dynamicDsService),
70
70
  inject: [
@@ -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,8EAA0E;AAC1E,iEAA4D;AAC5D,6DAAwD;AACxD,mDAA+C;AAC/C,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AAsIhE,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,WAAW;IApIvB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,gCAAoB;YACpB,wBAAY;YACZ,6BAAiB;YACjB,y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rB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,CACpB;oBACH,CAAC,CAAC,IAAI,wCAAsB,CACxB,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,CACjB;gBACP,MAAM,EAAE;oBACN,sBAAU;oBACV,6BAAa;oBACb,iBAAiB;oBACjB,wBAAwB;oBACxB,sBAAU;oBACV,gCAAc;oBACd,6BAAiB;oBACjB,gCAAoB;oBACpB,wBAAY;oBACZ,6BAAiB;oBACjB,0BAAc;oBACd,kBAAkB;oBAClB,qCAAgB;oBAChB,oDAAwB;oBACxB,sCAA0B;iBAC3B;aACF;YACD,4BAAY;YACZ,iCAAqB;YACrB,oCAAwB;YACxB,+BAAmB;YACnB,4CAAoB;YACpB,gCAAc;YACd,yCAAkB;YAClB,qCAAgB;YAChB,sBAAU;YACV,0BAAc;YACd;gBACE,QAAQ,EAAE,gCAAc;gBACxB,OAAO,EAAE,iBAAiB;aAC3B;YACD,oDAAwB;SACzB;QACD,OAAO,EAAE,CAAC,wBAAY,EAAE,6BAAiB,CAAC;KAC3C,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW","sourcesContent":["// Copyright 2020-2024 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 StoreService,\n PoiService,\n ApiService,\n NodeConfig,\n ConnectionPoolService,\n ConnectionPoolStateManager,\n SmartBatchService,\n StoreCacheService,\n IProjectUpgradeService,\n PoiSyncService,\n InMemoryCacheService,\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 { EthDictionaryService } from './dictionary/ethDictionary.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 InMemoryCacheService,\n StoreService,\n StoreCacheService,\n EthereumApiService,\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 projectUpgradeService: IProjectUpgradeService,\n apiService: EthereumApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n cacheService: InMemoryCacheService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiSyncService: PoiSyncService,\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 projectUpgradeService,\n smartBatchService,\n cacheService,\n storeService,\n storeCacheService,\n poiSyncService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n connectionPoolState,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiSyncService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n 'IProjectUpgradeService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n InMemoryCacheService,\n StoreService,\n StoreCacheService,\n PoiSyncService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ConnectionPoolStateManager,\n ],\n },\n FetchService,\n ConnectionPoolService,\n IndexingBenchmarkService,\n PoiBenchmarkService,\n EthDictionaryService,\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n PoiSyncService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, StoreCacheService],\n})\nexport class FetchModule {}\n"]}
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,8EAA0E;AAC1E,iEAA4D;AAC5D,6DAAwD;AACxD,mDAA+C;AAC/C,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AAsIhE,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,WAAW;IApIvB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;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,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,CACpB;oBACH,CAAC,CAAC,IAAI,wCAAsB,CACxB,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,CACjB;gBACP,MAAM,EAAE;oBACN,sBAAU;oBACV,6BAAa;oBACb,iBAAiB;oBACjB,wBAAwB;oBACxB,sBAAU;oBACV,gCAAc;oBACd,6BAAiB;oBACjB,gCAAoB;oBACpB,wBAAY;oBACZ,6BAAiB;oBACjB,0BAAc;oBACd,kBAAkB;oBAClB,qCAAgB;oBAChB,oDAAwB;oBACxB,sCAA0B;iBAC3B;aACF;YACD,4BAAY;YACZ,iCAAqB;YACrB,oCAAwB;YACxB,+BAAmB;YACnB,4CAAoB;YACpB,gCAAc;YACd,yCAAkB;YAClB,qCAAgB;YAChB,sBAAU;YACV,0BAAc;YACd;gBACE,QAAQ,EAAE,gCAAc;gBACxB,OAAO,EAAE,iBAAiB;aAC3B;YACD,oDAAwB;SACzB;QACD,OAAO,EAAE,CAAC,wBAAY,EAAE,6BAAiB,CAAC;KAC3C,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW","sourcesContent":["// Copyright 2020-2024 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 StoreService,\n PoiService,\n ApiService,\n NodeConfig,\n ConnectionPoolService,\n ConnectionPoolStateManager,\n SmartBatchService,\n StoreCacheService,\n IProjectUpgradeService,\n PoiSyncService,\n InMemoryCacheService,\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 { EthDictionaryService } from './dictionary/ethDictionary.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 InMemoryCacheService,\n StoreService,\n StoreCacheService,\n EthereumApiService,\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 projectUpgradeService: IProjectUpgradeService,\n apiService: EthereumApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n cacheService: InMemoryCacheService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiSyncService: PoiSyncService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>,\n ) =>\n nodeConfig.workers\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n cacheService,\n storeService,\n storeCacheService,\n poiSyncService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n connectionPoolState,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiSyncService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n 'IProjectUpgradeService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n InMemoryCacheService,\n StoreService,\n StoreCacheService,\n PoiSyncService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ConnectionPoolStateManager,\n ],\n },\n FetchService,\n ConnectionPoolService,\n IndexingBenchmarkService,\n PoiBenchmarkService,\n EthDictionaryService,\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n PoiSyncService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, StoreCacheService],\n})\nexport class FetchModule {}\n"]}
@@ -1,19 +1,19 @@
1
1
  import { isBlockHandlerProcessor, isCallHandlerProcessor, isEventHandlerProcessor, isCustomDs, isRuntimeDs, SubqlEthereumCustomDataSource, EthereumHandlerKind, EthereumRuntimeHandlerInputMap, SubqlEthereumDataSource } from '@subql/common-ethereum';
2
- import { NodeConfig, IndexerSandbox, ProcessBlockResponse, BaseIndexerManager, IBlock } from '@subql/node-core';
2
+ import { ApiService, NodeConfig, IndexerSandbox, ProcessBlockResponse, BaseIndexerManager, IBlock } from '@subql/node-core';
3
3
  import { EthereumTransaction, EthereumLog, EthereumBlock, SubqlRuntimeDatasource, EthereumBlockFilter, EthereumLogFilter, EthereumTransactionFilter, LightEthereumLog } from '@subql/types-ethereum';
4
4
  import { EthereumProjectDs } from '../configure/SubqueryProject';
5
- import { EthereumApi, EthereumApiService } from '../ethereum';
5
+ import { EthereumApi } from '../ethereum';
6
6
  import SafeEthProvider from '../ethereum/safe-api';
7
7
  import { asSecondLayerHandlerProcessor_1_0_0, DsProcessorService } from './ds-processor.service';
8
8
  import { DynamicDsService } from './dynamic-ds.service';
9
9
  import { SandboxService } from './sandbox.service';
10
10
  import { BlockContent } from './types';
11
11
  import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
12
- export declare class IndexerManager extends BaseIndexerManager<SafeEthProvider, EthereumApi, BlockContent, EthereumApiService, SubqlEthereumDataSource, SubqlEthereumCustomDataSource, typeof FilterTypeMap, typeof ProcessorTypeMap, EthereumRuntimeHandlerInputMap> {
12
+ export declare class IndexerManager extends BaseIndexerManager<SafeEthProvider, EthereumApi, BlockContent, ApiService, SubqlEthereumDataSource, SubqlEthereumCustomDataSource, typeof FilterTypeMap, typeof ProcessorTypeMap, EthereumRuntimeHandlerInputMap> {
13
13
  protected isRuntimeDs: typeof isRuntimeDs;
14
14
  protected isCustomDs: typeof isCustomDs;
15
15
  protected updateCustomProcessor: typeof asSecondLayerHandlerProcessor_1_0_0;
16
- constructor(apiService: EthereumApiService, nodeConfig: NodeConfig, sandboxService: SandboxService, dsProcessorService: DsProcessorService, dynamicDsService: DynamicDsService, unfinalizedBlocksService: UnfinalizedBlocksService);
16
+ constructor(apiService: ApiService, nodeConfig: NodeConfig, sandboxService: SandboxService, dsProcessorService: DsProcessorService, dynamicDsService: DynamicDsService, unfinalizedBlocksService: UnfinalizedBlocksService);
17
17
  indexBlock(block: IBlock<BlockContent>, dataSources: SubqlEthereumDataSource[]): Promise<ProcessBlockResponse>;
18
18
  getBlockHeight(block: BlockContent): number;
19
19
  getBlockHash(block: BlockContent): string;
@@ -15,7 +15,6 @@ exports.IndexerManager = void 0;
15
15
  const common_1 = require("@nestjs/common");
16
16
  const common_ethereum_1 = require("@subql/common-ethereum");
17
17
  const node_core_1 = require("@subql/node-core");
18
- const ethereum_1 = require("../ethereum");
19
18
  const block_ethereum_1 = require("../ethereum/block.ethereum");
20
19
  const ds_processor_service_1 = require("./ds-processor.service");
21
20
  const dynamic_ds_service_1 = require("./dynamic-ds.service");
@@ -86,7 +85,7 @@ __decorate([
86
85
  ], IndexerManager.prototype, "indexBlock", null);
87
86
  IndexerManager = __decorate([
88
87
  (0, common_1.Injectable)(),
89
- __metadata("design:paramtypes", [ethereum_1.EthereumApiService,
88
+ __metadata("design:paramtypes", [node_core_1.ApiService,
90
89
  node_core_1.NodeConfig,
91
90
  sandbox_service_1.SandboxService,
92
91
  ds_processor_service_1.DsProcessorService,
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.manager.js","sourceRoot":"","sources":["../../src/indexer/indexer.manager.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAC5C,4DAUgC;AAChC,gDAQ0B;AAY1B,0CAA8D;AAC9D,+DAKoC;AAEpC,iEAGgC;AAChC,6DAAwD;AACxD,uDAAmD;AAEnD,2EAAuE;AAGhE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,8BAUnC;IAKC,YACE,UAA8B,EAC9B,UAAsB,EACtB,cAA8B,EAC9B,kBAAsC,EACtC,gBAAkC,EAClC,wBAAkD;QAElD,KAAK,CACH,UAAU,EACV,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,gBAAgB,CACjB,CAAC;QArBM,gBAAW,GAAG,6BAAW,CAAC;QAC1B,eAAU,GAAG,4BAAU,CAAC;QACxB,0BAAqB,GAAG,0DAAmC,CAAC;IAoBtE,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU,CACd,KAA2B,EAC3B,WAAsC;QAEtC,OAAO,KAAK,CAAC,kBAAkB,CAAC,KAAK,E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,CAAC,EAAE,CAC3B,IAAmB,EACnB,MAA2B,EAC3B,EAA2B,EAC3B,EAAE,WAAC,OAAA,IAAA,sCAAqB,EAAC,IAAI,EAAE,MAAM,EAAE,MAAA,EAAE,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAA,EAAA;IAC7D,CAAC,qCAAmB,CAAC,KAAK,CAAC,EAAE,CAC3B,IAAoC,EACpC,MAAyB,EACzB,EAA2B,EAC3B,EAAE,WAAC,OAAA,IAAA,oCAAmB,EAAC,IAAI,EAAE,MAAM,EAAE,MAAA,EAAE,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAA,EAAA;IAC3D,CAAC,qCAAmB,CAAC,IAAI,CAAC,EAAE,CAC1B,IAAyB,EACzB,MAAiC,EACjC,EAA2B,EAC3B,EAAE,WAAC,OAAA,IAAA,4CAA2B,EAAC,IAAI,EAAE,MAAM,EAAE,MAAA,EAAE,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAA,EAAA;CACpE,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,CAAC,qCAAmB,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI;IAChE,CAAC,qCAAmB,CAAC,KAAK,CAAC,EACzB,CAAC,GAAgB,EAAE,EAAE,CACrB,CAAC,IAAoC,EAAE,EAA0B,EAAE,EAAE,CACnE,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;IAC1B,CAAC,qCAAmB,CAAC,IAAI,CAAC,EACxB,CAAC,GAAgB,EAAE,EAAE,CACrB,CAAC,IAAyB,EAAE,EAA0B,EAAE,EAAE,CACxD,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;CACnC,CAAC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport {\n isBlockHandlerProcessor,\n isCallHandlerProcessor,\n isEventHandlerProcessor,\n isCustomDs,\n isRuntimeDs,\n SubqlEthereumCustomDataSource,\n EthereumHandlerKind,\n EthereumRuntimeHandlerInputMap,\n SubqlEthereumDataSource,\n} from '@subql/common-ethereum';\nimport {\n NodeConfig,\n getLogger,\n profiler,\n IndexerSandbox,\n ProcessBlockResponse,\n BaseIndexerManager,\n IBlock,\n} from '@subql/node-core';\nimport {\n EthereumTransaction,\n EthereumLog,\n EthereumBlock,\n SubqlRuntimeDatasource,\n EthereumBlockFilter,\n EthereumLogFilter,\n EthereumTransactionFilter,\n LightEthereumLog,\n} from '@subql/types-ethereum';\nimport { EthereumProjectDs } from '../configure/SubqueryProject';\nimport { EthereumApi, EthereumApiService } from '../ethereum';\nimport {\n filterBlocksProcessor,\n filterLogsProcessor,\n filterTransactionsProcessor,\n isFullBlock,\n} from '../ethereum/block.ethereum';\nimport SafeEthProvider from '../ethereum/safe-api';\nimport {\n asSecondLayerHandlerProcessor_1_0_0,\n DsProcessorService,\n} from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { SandboxService } from './sandbox.service';\nimport { BlockContent } from './types';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Injectable()\nexport class IndexerManager extends BaseIndexerManager<\n SafeEthProvider,\n EthereumApi,\n BlockContent,\n EthereumApiService,\n SubqlEthereumDataSource,\n SubqlEthereumCustomDataSource,\n typeof FilterTypeMap,\n typeof ProcessorTypeMap,\n EthereumRuntimeHandlerInputMap\n> {\n protected isRuntimeDs = isRuntimeDs;\n protected isCustomDs = isCustomDs;\n protected updateCustomProcessor = asSecondLayerHandlerProcessor_1_0_0;\n\n constructor(\n apiService: EthereumApiService,\n nodeConfig: NodeConfig,\n sandboxService: SandboxService,\n dsProcessorService: DsProcessorService,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocksService: UnfinalizedBlocksService,\n ) {\n super(\n apiService,\n nodeConfig,\n sandboxService,\n dsProcessorService,\n dynamicDsService,\n unfinalizedBlocksService,\n FilterTypeMap,\n ProcessorTypeMap,\n );\n }\n\n @profiler()\n async indexBlock(\n block: IBlock<BlockContent>,\n dataSources: SubqlEthereumDataSource[],\n ): Promise<ProcessBlockResponse> {\n return super.internalIndexBlock(block, dataSources, () =>\n this.getApi(block.block),\n );\n }\n\n getBlockHeight(block: BlockContent): number {\n return block.number;\n }\n\n getBlockHash(block: BlockContent): string {\n return block.hash;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n private async getApi(block: BlockContent): Promise<SafeEthProvider> {\n return this.apiService.safeApi(this.getBlockHeight(block));\n }\n\n protected async indexBlockData(\n block: BlockContent,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n if (isFullBlock(block)) {\n await this.indexBlockContent(block, dataSources, getVM);\n\n for (const tx of block.transactions) {\n await this.indexTransaction(tx, dataSources, getVM);\n\n for (const log of tx.logs ?? []) {\n await this.indexEvent(log, dataSources, getVM);\n }\n }\n } else {\n for (const log of block.logs ?? []) {\n await this.indexEvent(log, dataSources, getVM);\n }\n }\n }\n\n private async indexBlockContent(\n block: EthereumBlock,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(EthereumHandlerKind.Block, block, ds, getVM);\n }\n }\n\n private async indexTransaction(\n tx: EthereumTransaction,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(EthereumHandlerKind.Call, tx, ds, getVM);\n }\n }\n\n private async indexEvent(\n log: EthereumLog | LightEthereumLog,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(EthereumHandlerKind.Event, log, ds, getVM);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n protected async prepareFilteredData(\n kind: EthereumHandlerKind,\n data: any,\n ds: SubqlRuntimeDatasource,\n ): Promise<any> {\n return DataAbiParser[kind](this.apiService.api)(data, ds);\n }\n}\n\ntype ProcessorTypeMap = {\n [EthereumHandlerKind.Block]: typeof isBlockHandlerProcessor;\n [EthereumHandlerKind.Event]: typeof isEventHandlerProcessor;\n [EthereumHandlerKind.Call]: typeof isCallHandlerProcessor;\n};\n\nconst ProcessorTypeMap = {\n [EthereumHandlerKind.Block]: isBlockHandlerProcessor,\n [EthereumHandlerKind.Event]: isEventHandlerProcessor,\n [EthereumHandlerKind.Call]: isCallHandlerProcessor,\n};\n\nconst FilterTypeMap = {\n [EthereumHandlerKind.Block]: (\n data: EthereumBlock,\n filter: EthereumBlockFilter,\n ds: SubqlEthereumDataSource,\n ) => filterBlocksProcessor(data, filter, ds.options?.address),\n [EthereumHandlerKind.Event]: (\n data: EthereumLog | LightEthereumLog,\n filter: EthereumLogFilter,\n ds: SubqlEthereumDataSource,\n ) => filterLogsProcessor(data, filter, ds.options?.address),\n [EthereumHandlerKind.Call]: (\n data: EthereumTransaction,\n filter: EthereumTransactionFilter,\n ds: SubqlEthereumDataSource,\n ) => filterTransactionsProcessor(data, filter, ds.options?.address),\n};\n\nconst DataAbiParser = {\n [EthereumHandlerKind.Block]: () => (data: EthereumBlock) => data,\n [EthereumHandlerKind.Event]:\n (api: EthereumApi) =>\n (data: EthereumLog | LightEthereumLog, ds: SubqlRuntimeDatasource) =>\n api.parseLog(data, ds),\n [EthereumHandlerKind.Call]:\n (api: EthereumApi) =>\n (data: EthereumTransaction, ds: SubqlRuntimeDatasource) =>\n api.parseTransaction(data, ds),\n};\n"]}
1
+ {"version":3,"file":"indexer.manager.js","sourceRoot":"","sources":["../../src/indexer/indexer.manager.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAC5C,4DAUgC;AAChC,gDAQ0B;AAa1B,+DAKo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G,EAAE,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI;IAChE,CAAC,qCAAmB,CAAC,KAAK,CAAC,EACzB,CAAC,GAAgB,EAAE,EAAE,CACrB,CAAC,IAAoC,EAAE,EAA0B,EAAE,EAAE,CACnE,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;IAC1B,CAAC,qCAAmB,CAAC,IAAI,CAAC,EACxB,CAAC,GAAgB,EAAE,EAAE,CACrB,CAAC,IAAyB,EAAE,EAA0B,EAAE,EAAE,CACxD,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;CACnC,CAAC","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport {\n isBlockHandlerProcessor,\n isCallHandlerProcessor,\n isEventHandlerProcessor,\n isCustomDs,\n isRuntimeDs,\n SubqlEthereumCustomDataSource,\n EthereumHandlerKind,\n EthereumRuntimeHandlerInputMap,\n SubqlEthereumDataSource,\n} from '@subql/common-ethereum';\nimport {\n ApiService,\n NodeConfig,\n profiler,\n IndexerSandbox,\n ProcessBlockResponse,\n BaseIndexerManager,\n IBlock,\n} from '@subql/node-core';\nimport {\n EthereumTransaction,\n EthereumLog,\n EthereumBlock,\n SubqlRuntimeDatasource,\n EthereumBlockFilter,\n EthereumLogFilter,\n EthereumTransactionFilter,\n LightEthereumLog,\n} from '@subql/types-ethereum';\nimport { EthereumProjectDs } from '../configure/SubqueryProject';\nimport { EthereumApi } from '../ethereum';\nimport {\n filterBlocksProcessor,\n filterLogsProcessor,\n filterTransactionsProcessor,\n isFullBlock,\n} from '../ethereum/block.ethereum';\nimport SafeEthProvider from '../ethereum/safe-api';\nimport {\n asSecondLayerHandlerProcessor_1_0_0,\n DsProcessorService,\n} from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { SandboxService } from './sandbox.service';\nimport { BlockContent } from './types';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Injectable()\nexport class IndexerManager extends BaseIndexerManager<\n SafeEthProvider,\n EthereumApi,\n BlockContent,\n ApiService,\n SubqlEthereumDataSource,\n SubqlEthereumCustomDataSource,\n typeof FilterTypeMap,\n typeof ProcessorTypeMap,\n EthereumRuntimeHandlerInputMap\n> {\n protected isRuntimeDs = isRuntimeDs;\n protected isCustomDs = isCustomDs;\n protected updateCustomProcessor = asSecondLayerHandlerProcessor_1_0_0;\n\n constructor(\n apiService: ApiService,\n nodeConfig: NodeConfig,\n sandboxService: SandboxService,\n dsProcessorService: DsProcessorService,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocksService: UnfinalizedBlocksService,\n ) {\n super(\n apiService,\n nodeConfig,\n sandboxService,\n dsProcessorService,\n dynamicDsService,\n unfinalizedBlocksService,\n FilterTypeMap,\n ProcessorTypeMap,\n );\n }\n\n @profiler()\n async indexBlock(\n block: IBlock<BlockContent>,\n dataSources: SubqlEthereumDataSource[],\n ): Promise<ProcessBlockResponse> {\n return super.internalIndexBlock(block, dataSources, () =>\n this.getApi(block.block),\n );\n }\n\n getBlockHeight(block: BlockContent): number {\n return block.number;\n }\n\n getBlockHash(block: BlockContent): string {\n return block.hash;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n private async getApi(block: BlockContent): Promise<SafeEthProvider> {\n return this.apiService.safeApi(this.getBlockHeight(block));\n }\n\n protected async indexBlockData(\n block: BlockContent,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n if (isFullBlock(block)) {\n await this.indexBlockContent(block, dataSources, getVM);\n\n for (const tx of block.transactions) {\n await this.indexTransaction(tx, dataSources, getVM);\n\n for (const log of tx.logs ?? []) {\n await this.indexEvent(log, dataSources, getVM);\n }\n }\n } else {\n for (const log of block.logs ?? []) {\n await this.indexEvent(log, dataSources, getVM);\n }\n }\n }\n\n private async indexBlockContent(\n block: EthereumBlock,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(EthereumHandlerKind.Block, block, ds, getVM);\n }\n }\n\n private async indexTransaction(\n tx: EthereumTransaction,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(EthereumHandlerKind.Call, tx, ds, getVM);\n }\n }\n\n private async indexEvent(\n log: EthereumLog | LightEthereumLog,\n dataSources: EthereumProjectDs[],\n getVM: (d: EthereumProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(EthereumHandlerKind.Event, log, ds, getVM);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n protected async prepareFilteredData(\n kind: EthereumHandlerKind,\n data: any,\n ds: SubqlRuntimeDatasource,\n ): Promise<any> {\n return DataAbiParser[kind](this.apiService.api)(data, ds);\n }\n}\n\ntype ProcessorTypeMap = {\n [EthereumHandlerKind.Block]: typeof isBlockHandlerProcessor;\n [EthereumHandlerKind.Event]: typeof isEventHandlerProcessor;\n [EthereumHandlerKind.Call]: typeof isCallHandlerProcessor;\n};\n\nconst ProcessorTypeMap = {\n [EthereumHandlerKind.Block]: isBlockHandlerProcessor,\n [EthereumHandlerKind.Event]: isEventHandlerProcessor,\n [EthereumHandlerKind.Call]: isCallHandlerProcessor,\n};\n\nconst FilterTypeMap = {\n [EthereumHandlerKind.Block]: (\n data: EthereumBlock,\n filter: EthereumBlockFilter,\n ds: SubqlEthereumDataSource,\n ) => filterBlocksProcessor(data, filter, ds.options?.address),\n [EthereumHandlerKind.Event]: (\n data: EthereumLog | LightEthereumLog,\n filter: EthereumLogFilter,\n ds: SubqlEthereumDataSource,\n ) => filterLogsProcessor(data, filter, ds.options?.address),\n [EthereumHandlerKind.Call]: (\n data: EthereumTransaction,\n filter: EthereumTransactionFilter,\n ds: SubqlEthereumDataSource,\n ) => filterTransactionsProcessor(data, filter, ds.options?.address),\n};\n\nconst DataAbiParser = {\n [EthereumHandlerKind.Block]: () => (data: EthereumBlock) => data,\n [EthereumHandlerKind.Event]:\n (api: EthereumApi) =>\n (data: EthereumLog | LightEthereumLog, ds: SubqlRuntimeDatasource) =>\n api.parseLog(data, ds),\n [EthereumHandlerKind.Call]:\n (api: EthereumApi) =>\n (data: EthereumTransaction, ds: SubqlRuntimeDatasource) =>\n api.parseTransaction(data, ds),\n};\n"]}
@@ -1,6 +1,8 @@
1
1
  import { SubqlEthereumDataSource } from '@subql/common-ethereum';
2
2
  import { NodeConfig, IProjectService, ProcessBlockResponse, ApiService, BaseWorkerService, IProjectUpgradeService, IBlock } from '@subql/node-core';
3
3
  import { EthereumProjectDs } from '../../configure/SubqueryProject';
4
+ import { EthereumApi } from '../../ethereum';
5
+ import SafeEthProvider from '../../ethereum/safe-api';
4
6
  import { IndexerManager } from '../indexer.manager';
5
7
  import { BlockContent } from '../types';
6
8
  export type FetchBlockResponse = {
@@ -15,7 +17,7 @@ export type WorkerStatusResponse = {
15
17
  export declare class WorkerService extends BaseWorkerService<BlockContent, FetchBlockResponse, SubqlEthereumDataSource, {}> {
16
18
  private apiService;
17
19
  private indexerManager;
18
- constructor(apiService: ApiService<any, any, IBlock<any>[]>, indexerManager: IndexerManager, projectService: IProjectService<EthereumProjectDs>, projectUpgradeService: IProjectUpgradeService, nodeConfig: NodeConfig);
20
+ constructor(apiService: ApiService<EthereumApi, SafeEthProvider, IBlock<BlockContent>[]>, indexerManager: IndexerManager, projectService: IProjectService<EthereumProjectDs>, projectUpgradeService: IProjectUpgradeService, nodeConfig: NodeConfig);
19
21
  protected fetchChainBlock(heights: number, extra: {}): Promise<IBlock<BlockContent>>;
20
22
  protected toBlockResponse(block: BlockContent): {
21
23
  parentHash: string;
@@ -26,7 +26,7 @@ let WorkerService = class WorkerService extends node_core_1.BaseWorkerService {
26
26
  }
27
27
  async fetchChainBlock(heights, extra) {
28
28
  const [block] = await this.apiService.fetchBlocks([heights]);
29
- return block.block;
29
+ return block;
30
30
  }
31
31
  toBlockResponse(block) {
32
32
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"worker.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AAEpD,gDAQ0B;AAE1B,wDAAoD;AAa7C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,6BAKlC;IACC,YACU,UAA+C,EAC/C,cAA8B,EAEtC,cAAkD,EAElD,qBAA6C,EAC7C,UAAsB;QAEtB,KAAK,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QARjD,eAAU,GAAV,UAAU,CAAqC;QAC/C,mBAAc,GAAd,cAAc,CAAgB;IAQxC,CAAC;IAES,KAAK,CAAC,eAAe,CAC7B,OAAe,EACf,KAAS;QAET,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IAES,eAAe,CAAC,KAAmB;QAC3C,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,UAAU;SAC7B,CAAC;IACJ,CAAC;IAES,KAAK,CAAC,mBAAmB,CACjC,KAA2B,EAC3B,WAAsC;QAEtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;CACF,CAAA;AAtCY,aAAa;IADzB,IAAA,mBAAU,GAAE;IAUR,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;IAEzB,WAAA,IAAA,eAAM,EAAC,wBAAwB,CAAC,CAAA;qCAJb,sBAAU;QACN,gCAAc,kBAK1B,sBAAU;GAbb,aAAa,CAsCzB;AAtCY,sCAAa","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport { SubqlEthereumDataSource } from '@subql/common-ethereum';\nimport {\n NodeConfig,\n IProjectService,\n ProcessBlockResponse,\n ApiService,\n BaseWorkerService,\n IProjectUpgradeService,\n IBlock,\n} from '@subql/node-core';\nimport { EthereumProjectDs } from '../../configure/SubqueryProject';\nimport { IndexerManager } from '../indexer.manager';\nimport { BlockContent } from '../types';\n\nexport type FetchBlockResponse = { parentHash: string } | undefined;\n\nexport type WorkerStatusResponse = {\n threadId: number;\n isIndexing: boolean;\n fetchedBlocks: number;\n toFetchBlocks: number;\n};\n\n@Injectable()\nexport class WorkerService extends BaseWorkerService<\n BlockContent,\n FetchBlockResponse,\n SubqlEthereumDataSource,\n {}\n> {\n constructor(\n private apiService: ApiService<any, any, IBlock<any>[]>,\n private indexerManager: IndexerManager,\n @Inject('IProjectService')\n projectService: IProjectService<EthereumProjectDs>,\n @Inject('IProjectUpgradeService')\n projectUpgradeService: IProjectUpgradeService,\n nodeConfig: NodeConfig,\n ) {\n super(projectService, projectUpgradeService, nodeConfig);\n }\n\n protected async fetchChainBlock(\n heights: number,\n extra: {},\n ): Promise<IBlock<BlockContent>> {\n const [block] = await this.apiService.fetchBlocks([heights]);\n return block.block;\n }\n\n protected toBlockResponse(block: BlockContent): { parentHash: string } {\n return {\n parentHash: block.parentHash,\n };\n }\n\n protected async processFetchedBlock(\n block: IBlock<BlockContent>,\n dataSources: SubqlEthereumDataSource[],\n ): Promise<ProcessBlockResponse> {\n return this.indexerManager.indexBlock(block, dataSources);\n }\n}\n"]}
1
+ {"version":3,"file":"worker.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AAEpD,gDAQ0B;AAK1B,wDAAoD;AAa7C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,6BAKlC;IACC,YACU,UAIP,EACO,cAA8B,EAEtC,cAAkD,EAElD,qBAA6C,EAC7C,UAAsB;QAEtB,KAAK,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAZjD,eAAU,GAAV,UAAU,CAIjB;QACO,mBAAc,GAAd,cAAc,CAAgB;IAQxC,CAAC;IAES,KAAK,CAAC,eAAe,CAC7B,OAAe,EACf,KAAS;QAET,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;IAES,eAAe,CAAC,KAAmB;QAC3C,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,UAAU;SAC7B,CAAC;IACJ,CAAC;IAES,KAAK,CAAC,mBAAmB,CACjC,KAA2B,EAC3B,WAAsC;QAEtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;CACF,CAAA;AA1CY,aAAa;IADzB,IAAA,mBAAU,GAAE;IAcR,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;IAEzB,WAAA,IAAA,eAAM,EAAC,wBAAwB,CAAC,CAAA;qCARb,sBAAU;QAKN,gCAAc,kBAK1B,sBAAU;GAjBb,aAAa,CA0CzB;AA1CY,sCAAa","sourcesContent":["// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport { SubqlEthereumDataSource } from '@subql/common-ethereum';\nimport {\n NodeConfig,\n IProjectService,\n ProcessBlockResponse,\n ApiService,\n BaseWorkerService,\n IProjectUpgradeService,\n IBlock,\n} from '@subql/node-core';\nimport { EthereumBlock, LightEthereumBlock } from '@subql/types-ethereum';\nimport { EthereumProjectDs } from '../../configure/SubqueryProject';\nimport { EthereumApi } from '../../ethereum';\nimport SafeEthProvider from '../../ethereum/safe-api';\nimport { IndexerManager } from '../indexer.manager';\nimport { BlockContent } from '../types';\n\nexport type FetchBlockResponse = { parentHash: string } | undefined;\n\nexport type WorkerStatusResponse = {\n threadId: number;\n isIndexing: boolean;\n fetchedBlocks: number;\n toFetchBlocks: number;\n};\n\n@Injectable()\nexport class WorkerService extends BaseWorkerService<\n BlockContent,\n FetchBlockResponse,\n SubqlEthereumDataSource,\n {}\n> {\n constructor(\n private apiService: ApiService<\n EthereumApi,\n SafeEthProvider,\n IBlock<BlockContent>[]\n >,\n private indexerManager: IndexerManager,\n @Inject('IProjectService')\n projectService: IProjectService<EthereumProjectDs>,\n @Inject('IProjectUpgradeService')\n projectUpgradeService: IProjectUpgradeService,\n nodeConfig: NodeConfig,\n ) {\n super(projectService, projectUpgradeService, nodeConfig);\n }\n\n protected async fetchChainBlock(\n heights: number,\n extra: {},\n ): Promise<IBlock<BlockContent>> {\n const [block] = await this.apiService.fetchBlocks([heights]);\n return block;\n }\n\n protected toBlockResponse(block: BlockContent): { parentHash: string } {\n return {\n parentHash: block.parentHash,\n };\n }\n\n protected async processFetchedBlock(\n block: IBlock<BlockContent>,\n dataSources: SubqlEthereumDataSource[],\n ): Promise<ProcessBlockResponse> {\n return this.indexerManager.indexBlock(block, dataSources);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subql/node-ethereum",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-1",
4
4
  "description": "",
5
5
  "author": "Ian He",
6
6
  "license": "GPL-3.0",
@@ -65,5 +65,6 @@
65
65
  "files": [
66
66
  "/dist",
67
67
  "/bin"
68
- ]
68
+ ],
69
+ "stableVersion": "4.0.1-0"
69
70
  }