aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/data_sources/trusted_tokens/index.ts
blob: 552739fb96f64b2858756fae64531ab75b6fe75a (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
import axios from 'axios';

export interface ZeroExTrustedTokenMeta {
    address: string;
    name: string;
    symbol: string;
    decimals: number;
}

export interface MetamaskTrustedTokenMeta {
    address: string;
    name: string;
    erc20: boolean;
    symbol: string;
    decimals: number;
}

export class TrustedTokenSource<T> {
    private readonly _url: string;

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

    public async getTrustedTokenMetaAsync(): Promise<T> {
        const resp = await axios.get<T>(this._url);
        return resp.data;
    }
}