From d36acc7ec740b0dd98eb3994c240b261eeeeb40b Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 30 Jun 2020 17:41:52 +1000 Subject: [PATCH] fix: asset-swapper EthGasStation proxy url (#2614) --- packages/asset-swapper/CHANGELOG.json | 13 +++++++++++++ packages/asset-swapper/src/constants.ts | 5 ++--- .../asset-swapper/src/utils/protocol_fee_utils.ts | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/asset-swapper/CHANGELOG.json b/packages/asset-swapper/CHANGELOG.json index cd1850d347..51b5e66081 100644 --- a/packages/asset-swapper/CHANGELOG.json +++ b/packages/asset-swapper/CHANGELOG.json @@ -1,4 +1,17 @@ [ + { + "version": "4.6.0", + "changes": [ + { + "note": "Use internal Eth Gas Station proxy", + "pr": 2614 + }, + { + "note": "Renamed RFQT request parameters", + "pr": 2582 + } + ] + }, { "version": "4.5.0", "changes": [ diff --git a/packages/asset-swapper/src/constants.ts b/packages/asset-swapper/src/constants.ts index c556a3c4b2..4c2dd3ebd3 100644 --- a/packages/asset-swapper/src/constants.ts +++ b/packages/asset-swapper/src/constants.ts @@ -11,10 +11,9 @@ import { SwapQuoteRequestOpts, SwapQuoterOpts, } from './types'; - import { DEFAULT_GET_MARKET_ORDERS_OPTS } from './utils/market_operation_utils/constants'; -const ETH_GAS_STATION_API_BASE_URL = 'https://ethgasstation.info'; +const ETH_GAS_STATION_API_URL = 'https://ethgasstation.api.0x.org/api/ethgasAPI.json'; const NULL_BYTES = '0x'; const NULL_ERC20_ASSET_DATA = '0xf47261b00000000000000000000000000000000000000000000000000000000000000000'; const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; @@ -72,7 +71,7 @@ const DEFAULT_RFQT_REQUEST_OPTS: Partial = { }; export const constants = { - ETH_GAS_STATION_API_BASE_URL, + ETH_GAS_STATION_API_URL, PROTOCOL_FEE_MULTIPLIER, NULL_BYTES, ZERO_AMOUNT: new BigNumber(0), diff --git a/packages/asset-swapper/src/utils/protocol_fee_utils.ts b/packages/asset-swapper/src/utils/protocol_fee_utils.ts index 11c42cae9b..0bcaba2522 100644 --- a/packages/asset-swapper/src/utils/protocol_fee_utils.ts +++ b/packages/asset-swapper/src/utils/protocol_fee_utils.ts @@ -35,7 +35,7 @@ export class ProtocolFeeUtils { // tslint:disable-next-line: prefer-function-over-method private async _getGasPriceFromGasStationOrThrowAsync(): Promise { try { - const res = await fetch(`${constants.ETH_GAS_STATION_API_BASE_URL}/json/ethgasAPI.json`); + const res = await fetch(constants.ETH_GAS_STATION_API_URL); const gasInfo = await res.json(); // Eth Gas Station result is gwei * 10 // tslint:disable-next-line:custom-no-magic-numbers