aboutsummaryrefslogblamecommitdiffstats
path: root/packages/pipeline/src/data_sources/relayer-registry/index.ts
blob: c97b50d274c31a5877679aa117feb829aa07eb48 (plain) (tree)
































                                                                    
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 _url: string;

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

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