aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-13 00:55:33 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-13 00:55:33 +0800
commit09c5ae4e65f8fddd4504be041f27f9107d12df7d (patch)
tree2ea933f00101bc4e075d705155cb59d1618abc01 /packages/instant/src/util
parent03b235bb428e8a61934ff603f22f057d8394b56a (diff)
downloaddexon-sol-tools-09c5ae4e65f8fddd4504be041f27f9107d12df7d.tar
dexon-sol-tools-09c5ae4e65f8fddd4504be041f27f9107d12df7d.tar.gz
dexon-sol-tools-09c5ae4e65f8fddd4504be041f27f9107d12df7d.tar.bz2
dexon-sol-tools-09c5ae4e65f8fddd4504be041f27f9107d12df7d.tar.lz
dexon-sol-tools-09c5ae4e65f8fddd4504be041f27f9107d12df7d.tar.xz
dexon-sol-tools-09c5ae4e65f8fddd4504be041f27f9107d12df7d.tar.zst
dexon-sol-tools-09c5ae4e65f8fddd4504be041f27f9107d12df7d.zip
feat: have coinbase API return BigNumber for eth-usd price endpoint
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/coinbase_api.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/instant/src/util/coinbase_api.ts b/packages/instant/src/util/coinbase_api.ts
index 63c8077da..94a5d3c80 100644
--- a/packages/instant/src/util/coinbase_api.ts
+++ b/packages/instant/src/util/coinbase_api.ts
@@ -1,8 +1,10 @@
+import { BigNumber } from '@0xproject/utils';
+
const baseEndpoint = 'https://api.coinbase.com/v2';
export const coinbaseApi = {
- getEthUsdPrice: async (): Promise<string> => {
+ getEthUsdPrice: async (): Promise<BigNumber> => {
const res = await fetch(`${baseEndpoint}/prices/ETH-USD/buy`);
const resJson = await res.json();
- return resJson.data.amount;
+ return new BigNumber(resJson.data.amount);
},
};