diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-30 08:11:02 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-30 08:11:02 +0800 |
commit | 30454fe46746b8c1caf47cb35f39b46d0749a224 (patch) | |
tree | b0313759968b7b3ea43e68c95d34fa4ed087af2d | |
parent | 274e4b3bcd1633e8fe78a33528d63b7567355f9e (diff) | |
download | dexon-0x-contracts-30454fe46746b8c1caf47cb35f39b46d0749a224.tar.gz dexon-0x-contracts-30454fe46746b8c1caf47cb35f39b46d0749a224.tar.zst dexon-0x-contracts-30454fe46746b8c1caf47cb35f39b46d0749a224.zip |
async suffix and use polyfill fetch util
-rw-r--r-- | packages/instant/src/util/gas_price_estimator.ts | 8 |
1 files changed, 4 insertions, 4 deletions
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<BigNumber> { let fetchedAmount: BigNumber | undefined; try { - fetchedAmount = await fetchFastAmountInWei(); + fetchedAmount = await fetchFastAmountInWeiAsync(); } catch { fetchedAmount = undefined; } |