aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/data_sources/relayer-registry/index.ts
blob: 8133f5eae059378c5cc88cd32d485b53ffa04981 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import axios from 'axios';

export interface RelayerResponse {
    name: string;
    homepage_url: string;
    app_url: string;
    header_img: string;
    logo_img: string;
    networks: RelayerResponseNetwork[];
}

export interface RelayerResponseNetwork {
    networkId: number;
    sra_http_endpoint?: string;
    sra_ws_endpoint?: string;
    static_order_fields?: {
        fee_recipient_addresses?: string[];
        taker_addresses?: string[];
    };
}

export class RelayerRegistrySource {
    private readonly _url: string;

    constructor(url: string) {
        this._url = url;
    }

    public async getRelayerInfoAsync(): Promise<Map<string, RelayerResponse>> {
        const resp = await axios.get<Map<string, RelayerResponse>>(this._url);
        return resp.data;
    }
}