aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-30 08:11:02 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-30 08:11:02 +0800
commit30454fe46746b8c1caf47cb35f39b46d0749a224 (patch)
treeb0313759968b7b3ea43e68c95d34fa4ed087af2d /packages/instant/src
parent274e4b3bcd1633e8fe78a33528d63b7567355f9e (diff)
downloaddexon-sol-tools-30454fe46746b8c1caf47cb35f39b46d0749a224.tar
dexon-sol-tools-30454fe46746b8c1caf47cb35f39b46d0749a224.tar.gz
dexon-sol-tools-30454fe46746b8c1caf47cb35f39b46d0749a224.tar.bz2
dexon-sol-tools-30454fe46746b8c1caf47cb35f39b46d0749a224.tar.lz
dexon-sol-tools-30454fe46746b8c1caf47cb35f39b46d0749a224.tar.xz
dexon-sol-tools-30454fe46746b8c1caf47cb35f39b46d0749a224.tar.zst
dexon-sol-tools-30454fe46746b8c1caf47cb35f39b46d0749a224.zip
async suffix and use polyfill fetch util
Diffstat (limited to 'packages/instant/src')
-rw-r--r--packages/instant/src/util/gas_price_estimator.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts
index 818bf6f92..33eeb932d 100644
--- a/packages/instant/src/util/gas_price_estimator.ts
+++ b/packages/instant/src/util/gas_price_estimator.ts
@@ -1,4 +1,4 @@
-import { BigNumber } from '@0x/utils';
+import { BigNumber, fetchAsync } from '@0x/utils';
import { DEFAULT_GAS_PRICE, ETH_GAS_STATION_API_BASE_URL } from '../constants';
@@ -16,8 +16,8 @@ interface EthGasStationResult {
safeLow: number;
}
-const fetchFastAmountInWei = async () => {
- const res = await fetch(`${ETH_GAS_STATION_API_BASE_URL}/json/ethgasAPI.json`);
+const fetchFastAmountInWeiAsync = async () => {
+ const res = await fetchAsync(`${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);
@@ -28,7 +28,7 @@ export class GasPriceEstimator {
public async getFastAmountInWeiAsync(): Promise<BigNumber> {
let fetchedAmount: BigNumber | undefined;
try {
- fetchedAmount = await fetchFastAmountInWei();
+ fetchedAmount = await fetchFastAmountInWeiAsync();
} catch {
fetchedAmount = undefined;
}