feat!: added Integrator service

This commit is contained in:
Alex Kraiz
2023-09-27 16:08:09 +04:00
parent dc58eeae9f
commit 65c21de2dd
16 changed files with 310 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import Exchange from './Exchange/index.js';
import FarmingManager from './FarmingManager/index.js';
import { chains, envs } from '../config/index.js';
import type { networkCodes } from '../constants/index.js';
import { IntegratorService } from '../services/Integrator/index.js';
type KnownConfig = {
env: KnownEnv
@@ -22,6 +23,8 @@ export default class Unit {
public readonly blockchainService: BlockchainService;
public readonly integrator: IntegratorService;
public readonly aggregator: Aggregator;
public readonly priceFeed: PriceFeed;
@@ -58,6 +61,9 @@ export default class Unit {
priceFeed: {
api: networkConfig.api + networkConfig.services.priceFeed.all,
},
integrator: {
api: networkConfig.api + networkConfig.services.integrator.http,
}
},
}
} else {
@@ -65,7 +71,7 @@ export default class Unit {
}
const chainInfo = chains[config.chainId];
if (!chainInfo) throw new Error('Chain info is required');
this.chainId = config.chainId;
this.networkCode = chainInfo.code;
this.contracts = chainInfo.contracts
@@ -75,6 +81,7 @@ export default class Unit {
this.provider.pollingInterval = 1000;
this.blockchainService = new BlockchainService(this.config.services.blockchainService.http, this.config.basicAuth);
this.integrator = new IntegratorService(this.config.services.integrator.api, intNetwork);
this.aggregator = new Aggregator(
this.config.services.aggregator.http,
this.config.services.aggregator.ws,