From 09ee7d84f70418e128a445bf3a11b813ac1c7d2e Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Mon, 29 Oct 2018 17:17:04 -0700 Subject: Add comment and use constant --- packages/instant/src/util/gas_price_estimator.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packages/instant/src/util') diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts index 33eeb932d..336c4a3fa 100644 --- a/packages/instant/src/util/gas_price_estimator.ts +++ b/packages/instant/src/util/gas_price_estimator.ts @@ -1,6 +1,6 @@ import { BigNumber, fetchAsync } from '@0x/utils'; -import { DEFAULT_GAS_PRICE, ETH_GAS_STATION_API_BASE_URL } from '../constants'; +import { DEFAULT_GAS_PRICE, ETH_GAS_STATION_API_BASE_URL, GWEI_IN_WEI } from '../constants'; interface EthGasStationResult { average: number; @@ -19,8 +19,9 @@ interface EthGasStationResult { const fetchFastAmountInWeiAsync = async () => { const res = await fetchAsync(`${ETH_GAS_STATION_API_BASE_URL}/json/ethgasAPI.json`); const gasInfo = (await res.json()) as EthGasStationResult; + // Eth Gas Station result is gwei * 10 const gasPriceInGwei = new BigNumber(gasInfo.fast / 10); - return gasPriceInGwei.mul(1000000000); + return gasPriceInGwei.mul(GWEI_IN_WEI); }; export class GasPriceEstimator { -- cgit v1.2.3