diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-30 06:23:16 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-10-30 06:23:16 +0800 |
commit | 9610ada4467472318db0de17f794737ada42836b (patch) | |
tree | 8b4f3272adf1e0042fea63483903e1c494083ee4 /packages/instant/src/util | |
parent | 8ab8c279989114662d6dce4b5b998ad8fd88fc1a (diff) | |
download | dexon-sol-tools-9610ada4467472318db0de17f794737ada42836b.tar dexon-sol-tools-9610ada4467472318db0de17f794737ada42836b.tar.gz dexon-sol-tools-9610ada4467472318db0de17f794737ada42836b.tar.bz2 dexon-sol-tools-9610ada4467472318db0de17f794737ada42836b.tar.lz dexon-sol-tools-9610ada4467472318db0de17f794737ada42836b.tar.xz dexon-sol-tools-9610ada4467472318db0de17f794737ada42836b.tar.zst dexon-sol-tools-9610ada4467472318db0de17f794737ada42836b.zip |
Use constant that exists now
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/gas_price_estimator.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts index bd81ea05f..9eccfe510 100644 --- a/packages/instant/src/util/gas_price_estimator.ts +++ b/packages/instant/src/util/gas_price_estimator.ts @@ -1,8 +1,6 @@ import { BigNumber } from '@0x/utils'; -// TODO: merge development and move to constants -const ENDPOINT_URL = 'https://ethgasstation.info/json/ethgasAPI.json'; -const DEFAULT_GAS_PRICE_WEI = new BigNumber(20000000000); +import { DEFAULT_GAS_PRICE } from '../constants'; interface GasStationResult { average: number; @@ -18,8 +16,9 @@ interface GasStationResult { safeLow: number; } +const endpointUrl = 'https://ethgasstation.info/json/ethgasAPI.json'; const fetchFastAmountInWei = async () => { - const res = await fetch(ENDPOINT_URL); + const res = await fetch(endpointUrl); const gasInfo = (await res.json()) as GasStationResult; const gasPriceInGwei = new BigNumber(gasInfo.fast / 10); return gasPriceInGwei.mul(1000000000); @@ -39,7 +38,7 @@ export class GasPriceEstimator { this._lastFetched = fetchedAmount; } - return fetchedAmount || this._lastFetched || DEFAULT_GAS_PRICE_WEI; + return fetchedAmount || this._lastFetched || DEFAULT_GAS_PRICE; } } export const gasPriceEstimator = new GasPriceEstimator(); |