diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index d92d444d89..7d779ecc6a 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Missing API dependency when using reindex + ## [5.2.0] - 2024-11-28 ### Added - Support for historical indexing by timestamp as well as block height diff --git a/packages/node/src/subcommands/reindex.module.ts b/packages/node/src/subcommands/reindex.module.ts index 613d49f658..e4ca53bef8 100644 --- a/packages/node/src/subcommands/reindex.module.ts +++ b/packages/node/src/subcommands/reindex.module.ts @@ -13,9 +13,14 @@ import { PoiService, NodeConfig, storeModelFactory, + ConnectionPoolService, + ConnectionPoolStateManager, } from '@subql/node-core'; import { Sequelize } from '@subql/x-sequelize'; import { ConfigureModule } from '../configure/configure.module'; +import { SubqueryProject } from '../configure/SubqueryProject'; +import { EthereumApiService } from '../ethereum'; +import { EthereumApiConnection } from '../ethereum/api.connection'; import { DsProcessorService } from '../indexer/ds-processor.service'; import { DynamicDsService } from '../indexer/dynamic-ds.service'; import { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service'; @@ -40,10 +45,31 @@ import { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service'; useClass: DynamicDsService, }, DsProcessorService, + ConnectionPoolStateManager, + ConnectionPoolService, { - // Used to work with DI for unfinalizedBlocksService but not used with reindex provide: ApiService, - useFactory: () => undefined, + useFactory: async ( + project: SubqueryProject, + connectionPoolService: ConnectionPoolService, + eventEmitter: EventEmitter2, + nodeConfig: NodeConfig, + ) => { + const apiService = new EthereumApiService( + project, + connectionPoolService, + eventEmitter, + nodeConfig, + ); + await apiService.init(); + return apiService; + }, + inject: [ + 'ISubqueryProject', + ConnectionPoolService, + EventEmitter2, + NodeConfig, + ], }, SchedulerRegistry, ],