Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync @subql dependencies #91

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading