import { IExchangeConfigurationService } from '@energyweb/exchange' ; import { ConfigurationService } from '@energyweb/origin-backend' ; import { BlockchainPropertiesService } from '@energyweb/issuer-api' ; import { IDeviceType } from '@energyweb/origin-backend-core' ; import { Injectable } from '@nestjs/common' ; import { ModuleRef } from '@nestjs/core' ; @ Injectable ( ) export class ExchangeConfigurationService implements IExchangeConfigurationService { private _configService : ConfigurationService ; private _blockchainPropertiesService : BlockchainPropertiesService ; constructor ( private readonly moduleRef ) { } private get configService ( ) { if ( this . _configService ) { return this . _configService ; } this . _configService = this . moduleRef . get < ConfigurationService > ( ConfigurationService , { strict : false } ) ; return this . _configService ; } private get blockchainPropertiesService ( ) { if ( this . _blockchainPropertiesService ) { return this . _blockchainPropertiesService ; } this . _blockchainPropertiesService = this . moduleRef . get < BlockchainPropertiesService > ( BlockchainPropertiesService , { strict : false } ) ; return this . _blockchainPropertiesService ; } public async getDeviceTypes ( ) { const { deviceTypes } = await this . configService . get ( ) ; return deviceTypes ; } public async getGridOperators ( ) { const { gridOperators } = await this . configService . get ( ) ; return gridOperators ; } public async getRegistryAddress ( ) { const { registry } = await this . blockchainPropertiesService . get ( ) ; return registry ; } public async getIssuerAddress ( ) { const { issuer } = await this . blockchainPropertiesService . get ( ) ; return issuer ; } }