From 274e4b3bcd1633e8fe78a33528d63b7567355f9e Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Mon, 29 Oct 2018 16:53:18 -0700 Subject: Introduce constants for eth gas station and coinbase --- packages/instant/src/util/gas_price_estimator.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'packages/instant/src/util/gas_price_estimator.ts') diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts index 9eccfe510..818bf6f92 100644 --- a/packages/instant/src/util/gas_price_estimator.ts +++ b/packages/instant/src/util/gas_price_estimator.ts @@ -1,8 +1,8 @@ import { BigNumber } from '@0x/utils'; -import { DEFAULT_GAS_PRICE } from '../constants'; +import { DEFAULT_GAS_PRICE, ETH_GAS_STATION_API_BASE_URL } from '../constants'; -interface GasStationResult { +interface EthGasStationResult { average: number; fastestWait: number; fastWait: number; @@ -16,10 +16,9 @@ interface GasStationResult { safeLow: number; } -const endpointUrl = 'https://ethgasstation.info/json/ethgasAPI.json'; const fetchFastAmountInWei = async () => { - const res = await fetch(endpointUrl); - const gasInfo = (await res.json()) as GasStationResult; + const res = await fetch(`${ETH_GAS_STATION_API_BASE_URL}/json/ethgasAPI.json`); + const gasInfo = (await res.json()) as EthGasStationResult; const gasPriceInGwei = new BigNumber(gasInfo.fast / 10); return gasPriceInGwei.mul(1000000000); }; -- cgit v1.2.3