diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-30 08:17:04 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-30 08:17:04 +0800 |
commit | 09ee7d84f70418e128a445bf3a11b813ac1c7d2e (patch) | |
tree | 0ba8d983e4335ebca1f337a1fbe9bf897950fdf7 /packages/instant/src | |
parent | 2ad2644b6bcb3c1f4da5891d79856af46e808eab (diff) | |
download | dexon-0x-contracts-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar.gz dexon-0x-contracts-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar.zst dexon-0x-contracts-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.zip |
Add comment and use constant
Diffstat (limited to 'packages/instant/src')
-rw-r--r-- | packages/instant/src/util/gas_price_estimator.ts | 5 |
1 files changed, 3 insertions, 2 deletions
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 { |