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

safe-global / safe-client-gateway / 12377183907

17 Dec 2024 04:25PM UTC coverage: 89.178% (-0.9%) from 90.091%
12377183907

Pull #2194

github

web-flow
Update migrations/deprecated/00013_targeted_messaging_add_outreach_2/index.sql

Co-authored-by: Aaron Cook <aaron@safe.global>
Pull Request #2194: Allow targeting of all safes for outreach campaigns

2781 of 3496 branches covered (79.55%)

Branch coverage included in aggregate %.

18 of 22 new or added lines in 6 files covered. (81.82%)

93 existing lines in 30 files now uncovered.

9456 of 10226 relevant lines covered (92.47%)

427.34 hits per line

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

81.25
/src/datasources/staking-api/staking-api.manager.ts
1
import { IConfigurationService } from '@/config/configuration.service.interface';
102✔
2
import { CacheFirstDataSource } from '@/datasources/cache/cache.first.data.source';
102✔
3
import {
102✔
4
  CacheService,
5
  ICacheService,
6
} from '@/datasources/cache/cache.service.interface';
7
import { HttpErrorFactory } from '@/datasources/errors/http-error-factory';
102✔
8
import { KilnApi } from '@/datasources/staking-api/kiln-api.service';
102✔
9
import { ChainSchema } from '@/domain/chains/entities/schemas/chain.schema';
102✔
10
import { IConfigApi } from '@/domain/interfaces/config-api.interface';
102✔
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';
102✔
14

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

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

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

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

38
    const baseUrl = this.configurationService.getOrThrow<string>(
100✔
39
      chain.isTestnet ? 'staking.testnet.baseUri' : 'staking.mainnet.baseUri',
50!
40
    );
41
    const apiKey = this.configurationService.getOrThrow<string>(
100✔
42
      chain.isTestnet ? 'staking.testnet.apiKey' : 'staking.mainnet.apiKey',
50!
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 {
UNCOV
59
    if (this.apis[chainId] !== undefined) {
×
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