From 30454fe46746b8c1caf47cb35f39b46d0749a224 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Mon, 29 Oct 2018 17:11:02 -0700 Subject: async suffix and use polyfill fetch util --- packages/instant/src/util/gas_price_estimator.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/instant/src/util/gas_price_estimator.ts') diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts index 818bf6f92..33eeb932d 100644 --- a/packages/instant/src/util/gas_price_estimator.ts +++ b/packages/instant/src/util/gas_price_estimator.ts @@ -1,4 +1,4 @@ -import { BigNumber } from '@0x/utils'; +import { BigNumber, fetchAsync } from '@0x/utils'; import { DEFAULT_GAS_PRICE, ETH_GAS_STATION_API_BASE_URL } from '../constants'; @@ -16,8 +16,8 @@ interface EthGasStationResult { safeLow: number; } -const fetchFastAmountInWei = async () => { - const res = await fetch(`${ETH_GAS_STATION_API_BASE_URL}/json/ethgasAPI.json`); +const fetchFastAmountInWeiAsync = async () => { + const res = await fetchAsync(`${ETH_GAS_STATION_API_BASE_URL}/json/ethgasAPI.json`); const gasInfo = (await res.json()) as EthGasStationResult; const gasPriceInGwei = new BigNumber(gasInfo.fast / 10); return gasPriceInGwei.mul(1000000000); @@ -28,7 +28,7 @@ export class GasPriceEstimator { public async getFastAmountInWeiAsync(): Promise { let fetchedAmount: BigNumber | undefined; try { - fetchedAmount = await fetchFastAmountInWei(); + fetchedAmount = await fetchFastAmountInWeiAsync(); } catch { fetchedAmount = undefined; } -- cgit v1.2.3