aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/coinbase_api.ts
blob: 32401e4232df53fcd5bb75b3165c58d08da1ff1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import { BigNumber } from '@0x/utils';

import { COINBASE_API_BASE_URL } from '../constants';

export const coinbaseApi = {
    getEthUsdPrice: async (): Promise<BigNumber> => {
        const res = await fetch(`${COINBASE_API_BASE_URL}/prices/ETH-USD/buy`);
        const resJson = await res.json();
        return new BigNumber(resJson.data.amount);
    },
};