aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-30 08:17:04 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-30 08:17:04 +0800
commit09ee7d84f70418e128a445bf3a11b813ac1c7d2e (patch)
tree0ba8d983e4335ebca1f337a1fbe9bf897950fdf7 /packages/instant/src/util
parent2ad2644b6bcb3c1f4da5891d79856af46e808eab (diff)
downloaddexon-sol-tools-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar
dexon-sol-tools-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar.gz
dexon-sol-tools-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar.bz2
dexon-sol-tools-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar.lz
dexon-sol-tools-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar.xz
dexon-sol-tools-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.tar.zst
dexon-sol-tools-09ee7d84f70418e128a445bf3a11b813ac1c7d2e.zip
Add comment and use constant
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/gas_price_estimator.ts5
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 {