Skip to content

Commit

Permalink
Sync @subql dependencies (#91)
Browse files Browse the repository at this point in the history
* Update @subql deps

* Sync node core changes

* pr number

* update node-core

---------

Co-authored-by: jiqiang90 <[email protected]>
Co-authored-by: JQQQ <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2023
1 parent e55dde1 commit b8587fd
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 467 deletions.
4 changes: 4 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Updates to match changes in `@subql/node-core` (#91)
- Dictionary service to use dictionary registry
- Use yargs from node core

## [3.3.0] - 2023-11-06
### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@nestjs/schedule": "^3.0.1",
"@subql/common": "^3.3.0",
"@subql/common-algorand": "workspace:*",
"@subql/node-core": "^6.3.0",
"@subql/node-core": "^6.4.1",
"@subql/types-algorand": "workspace:*",
"algosdk": "^2.2.0",
"axios": "^1.3.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/indexer/dictionary.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { DictionaryService } from './dictionary.service';
describe('dictionary service', () => {
let dictionaryService: DictionaryService;

beforeEach(() => {
dictionaryService = new DictionaryService(
beforeEach(async () => {
dictionaryService = await DictionaryService.create(
{
network: {
chainId: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=',
Expand Down
22 changes: 20 additions & 2 deletions packages/node/src/indexer/dictionary.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { Inject, Injectable } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { NETWORK_FAMILY } from '@subql/common';
import {
NodeConfig,
DictionaryService as CoreDictionaryService,
Expand All @@ -12,13 +13,14 @@ import { SubqueryProject } from '../configure/SubqueryProject';

@Injectable()
export class DictionaryService extends CoreDictionaryService {
constructor(
private constructor(
@Inject('ISubqueryProject') protected project: SubqueryProject,
nodeConfig: NodeConfig,
eventEmitter: EventEmitter2,
dictionaryUrl?: string,
) {
super(
project.network.dictionary,
dictionaryUrl ?? project.network.dictionary,
project.network.chainId,
nodeConfig,
eventEmitter,
Expand All @@ -29,4 +31,20 @@ export class DictionaryService extends CoreDictionaryService {
// Chain id is used as genesis hash
return this.project.network.chainId === metaData.genesisHash;
}

static async create(
project: SubqueryProject,
nodeConfig: NodeConfig,
eventEmitter: EventEmitter2,
): Promise<DictionaryService> {
const url =
project.network.dictionary ??
(await CoreDictionaryService.resolveDictionary(
NETWORK_FAMILY.algorand,
project.network.chainId,
nodeConfig.dictionaryRegistry,
));

return new DictionaryService(project, nodeConfig, eventEmitter, url);
}
}
17 changes: 16 additions & 1 deletion packages/node/src/indexer/fetch.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,22 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
ConnectionPoolService,
IndexingBenchmarkService,
PoiBenchmarkService,
DictionaryService,
{
provide: DictionaryService,
useFactory: async (
project: SubqueryProject,
nodeConfig: NodeConfig,
eventEmitter: EventEmitter2,
) => {
const dictionaryService = await DictionaryService.create(
project,
nodeConfig,
eventEmitter,
);
return dictionaryService;
},
inject: ['ISubqueryProject', NodeConfig, EventEmitter2],
},
SandboxService,
DsProcessorService,
DynamicDsService,
Expand Down
Loading

0 comments on commit b8587fd

Please sign in to comment.