aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-30 06:23:16 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-30 06:23:16 +0800
commit9610ada4467472318db0de17f794737ada42836b (patch)
tree8b4f3272adf1e0042fea63483903e1c494083ee4
parent8ab8c279989114662d6dce4b5b998ad8fd88fc1a (diff)
downloaddexon-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
-rw-r--r--packages/instant/src/util/gas_price_estimator.ts9
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();