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

safe-global / safe-client-gateway / 14131637198

28 Mar 2025 02:50PM UTC coverage: 90.473% (-0.1%) from 90.577%
14131637198

push

github

web-flow
Add datasource for Safe Decoder Service (#2313)

The new [Safe Decoder Service](https://safe-decoder.safe.global/docs) improves upon the decoder of the Safe Transaction Service. As such, we intend to migrate to it.

This lays the foundation of usage, by creating a datasource (with manager) and base repository for validating the responses:

- Add `safeDataDecoder.baseUri` (test) configuration
- Add `DataDecoderApiManager` interface, implementation and module
- Add `DataDecoderApi` interface, implementation and module
- Add validation schemas for `DataDecoded` and `Contract, with inferred types and builders
- Add base `DataDecoderRepository` for accessing/validating datasource responses
- Add appropriate test coverage of service and schemas

3207 of 3846 branches covered (83.39%)

Branch coverage included in aggregate %.

46 of 68 new or added lines in 8 files covered. (67.65%)

10980 of 11835 relevant lines covered (92.78%)

535.66 hits per line

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

0.0
/src/domain/data-decoder/v2/data-decoder.repository.ts
NEW
1
import { Inject, Injectable } from '@nestjs/common';
×
NEW
2
import {
×
3
  DataDecoded,
4
  DataDecodedSchema,
5
} from '@/domain/data-decoder/v2/entities/data-decoded.entity';
6
import { IDataDecoderRepository } from '@/domain/data-decoder/v2/data-decoder.repository.interface';
NEW
7
import { IDataDecoderApi } from '@/domain/interfaces/data-decoder-api.interface';
×
8
import { Page } from '@/domain/entities/page.entity';
NEW
9
import {
×
10
  Contract,
11
  ContractPageSchema,
12
} from '@/domain/data-decoder/v2/entities/contract.entity';
13

14
@Injectable()
NEW
15
export class DataDecoderRepository implements IDataDecoderRepository {
×
16
  constructor(
17
    @Inject(IDataDecoderApi)
NEW
18
    private readonly dataDecoderApi: IDataDecoderApi,
×
19
  ) {}
20

21
  public async getDecodedData(args: {
22
    chainId: string;
23
    data: `0x${string}`;
24
    to: `0x${string}`;
25
  }): Promise<DataDecoded> {
NEW
26
    const dataDecoded = await this.dataDecoderApi.getDecodedData(args);
×
NEW
27
    return DataDecodedSchema.parse(dataDecoded);
×
28
  }
29

30
  public async getContracts(args: {
31
    chainIds: Array<string>;
32
    address: `0x${string}`;
33
  }): Promise<Page<Contract>> {
NEW
34
    const contracts = await this.dataDecoderApi.getContracts(args);
×
NEW
35
    return ContractPageSchema.parse(contracts);
×
36
  }
37
}
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