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

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