• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-client-gateway / 12631213015

06 Jan 2025 10:54AM UTC coverage: 90.148% (-0.1%) from 90.284%
12631213015

Pull #2222

github

PooyaRaki
fix review comments
Pull Request #2222: Add Authentication to Redis

2831 of 3516 branches covered (80.52%)

Branch coverage included in aggregate %.

6 of 7 new or added lines in 2 files covered. (85.71%)

13 existing lines in 8 files now uncovered.

9641 of 10319 relevant lines covered (93.43%)

468.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.38
/src/datasources/staking-api/staking-api.manager.ts
1
import { IConfigurationService } from '@/config/configuration.service.interface';
120✔
2
import { CacheFirstDataSource } from '@/datasources/cache/cache.first.data.source';
120✔
3
import {
120✔
4
  CacheService,
5
  ICacheService,
6
} from '@/datasources/cache/cache.service.interface';
7
import { HttpErrorFactory } from '@/datasources/errors/http-error-factory';
120✔
8
import { KilnApi } from '@/datasources/staking-api/kiln-api.service';
120✔
9
import { ChainSchema } from '@/domain/chains/entities/schemas/chain.schema';
120✔
10
import { IConfigApi } from '@/domain/interfaces/config-api.interface';
120✔
11
import { IStakingApi } from '@/domain/interfaces/staking-api.interface';
12
import { IStakingApiManager } from '@/domain/interfaces/staking-api.manager.interface';
13
import { Inject, Injectable } from '@nestjs/common';
120✔
14

15
@Injectable()
16
export class StakingApiManager implements IStakingApiManager {
120✔
17
  private readonly apis: Record<string, IStakingApi> = {};
1,422✔
18

19
  constructor(
20
    private readonly dataSource: CacheFirstDataSource,
1,422✔
21
    @Inject(IConfigurationService)
22
    private readonly configurationService: IConfigurationService,
1,422✔
23
    @Inject(IConfigApi) private readonly configApi: IConfigApi,
1,422✔
24
    private readonly httpErrorFactory: HttpErrorFactory,
1,422✔
25
    @Inject(CacheService)
26
    private readonly cacheService: ICacheService,
1,422✔
27
  ) {}
28

29
  async getApi(chainId: string): Promise<IStakingApi> {
30
    if (this.apis[chainId]) {
206✔
31
      return Promise.resolve(this.apis[chainId]);
88✔
32
    }
33

34
    const chain = await this.configApi
118✔
35
      .getChain(chainId)
36
      .then(ChainSchema.parse);
37

38
    const baseUrl = this.configurationService.getOrThrow<string>(
118✔
39
      chain.isTestnet ? 'staking.testnet.baseUri' : 'staking.mainnet.baseUri',
59!
40
    );
41
    const apiKey = this.configurationService.getOrThrow<string>(
118✔
42
      chain.isTestnet ? 'staking.testnet.apiKey' : 'staking.mainnet.apiKey',
59!
43
    );
44

45
    this.apis[chainId] = new KilnApi(
100✔
46
      baseUrl,
47
      apiKey,
48
      this.dataSource,
49
      this.httpErrorFactory,
50
      this.configurationService,
51
      this.cacheService,
52
      chain.chainId,
53
    );
54

55
    return Promise.resolve(this.apis[chainId]);
100✔
56
  }
57

58
  destroyApi(chainId: string): void {
59
    if (this.apis[chainId] !== undefined) {
2!
UNCOV
60
      delete this.apis[chainId];
×
61
    }
62
  }
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc