Make Indexer optional (#231)

* feature: added new Thena exchange and indexer was made optional

* fix: updated indexer types

* Update package.json

* fix: updated indexer types

* fix: updated indexer types

* fix: updated indexer types

---------

Co-authored-by: TheJuze <dimanikus0106@gmail.com>
This commit is contained in:
Mikhail Gladchenko
2024-02-02 07:39:02 +00:00
committed by GitHub
parent 85963892cb
commit c597fa0805
6 changed files with 20 additions and 18 deletions

View File

@@ -1,16 +1,16 @@
import { JsonRpcProvider } from 'ethers';
import { Aggregator } from '../services/Aggregator/index.js';
import { BlockchainService } from '../services/BlockchainService/index.js';
import { PriceFeed } from '../services/PriceFeed/index.js';
import { Aggregator } from '../services/Aggregator';
import { BlockchainService } from '../services/BlockchainService';
import { PriceFeed } from '../services/PriceFeed';
import type {
KnownEnv,
SupportedChainId,
VerboseUnitConfig,
} from '../types.js';
import Exchange from './Exchange/index.js';
import { chains, envs } from '../config/index.js';
import { chains, envs } from '../config';
import type { networkCodes } from '../constants/index.js';
import { IndexerService } from '../services/Indexer/index.js';
import { IndexerService } from '../services/Indexer';
type KnownConfig = {
env: KnownEnv
@@ -26,7 +26,7 @@ export default class Unit {
public readonly blockchainService: BlockchainService;
public readonly indexer: IndexerService;
public readonly indexer: IndexerService | undefined;
public readonly aggregator: Aggregator;
@@ -83,7 +83,7 @@ export default class Unit {
api: networkConfig.api + networkConfig.services.priceFeed.all,
},
indexer: {
api: networkConfig.api + networkConfig.services.indexer.http,
api: networkConfig.api + networkConfig.services.indexer?.http,
},
},
};
@@ -106,10 +106,12 @@ export default class Unit {
this.config.services.blockchainService.http,
this.config.basicAuth
);
this.indexer = new IndexerService(
this.config.services.indexer.api,
intNetwork
);
this.indexer = this.config.services.indexer
? new IndexerService(
this.config.services.indexer.api,
intNetwork
)
: undefined;
this.aggregator = new Aggregator(
this.config.services.aggregator.http,
this.config.services.aggregator.ws,