fix: asset-swapper EthGasStation proxy url (#2614)

This commit is contained in:
Jacob Evans
2020-06-30 17:41:52 +10:00
committed by GitHub
parent a5a68acfec
commit d36acc7ec7
3 changed files with 16 additions and 4 deletions

View File

@@ -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", "version": "4.5.0",
"changes": [ "changes": [

View File

@@ -11,10 +11,9 @@ import {
SwapQuoteRequestOpts, SwapQuoteRequestOpts,
SwapQuoterOpts, SwapQuoterOpts,
} from './types'; } from './types';
import { DEFAULT_GET_MARKET_ORDERS_OPTS } from './utils/market_operation_utils/constants'; 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_BYTES = '0x';
const NULL_ERC20_ASSET_DATA = '0xf47261b00000000000000000000000000000000000000000000000000000000000000000'; const NULL_ERC20_ASSET_DATA = '0xf47261b00000000000000000000000000000000000000000000000000000000000000000';
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
@@ -72,7 +71,7 @@ const DEFAULT_RFQT_REQUEST_OPTS: Partial<RfqtRequestOpts> = {
}; };
export const constants = { export const constants = {
ETH_GAS_STATION_API_BASE_URL, ETH_GAS_STATION_API_URL,
PROTOCOL_FEE_MULTIPLIER, PROTOCOL_FEE_MULTIPLIER,
NULL_BYTES, NULL_BYTES,
ZERO_AMOUNT: new BigNumber(0), ZERO_AMOUNT: new BigNumber(0),

View File

@@ -35,7 +35,7 @@ export class ProtocolFeeUtils {
// tslint:disable-next-line: prefer-function-over-method // tslint:disable-next-line: prefer-function-over-method
private async _getGasPriceFromGasStationOrThrowAsync(): Promise<BigNumber> { private async _getGasPriceFromGasStationOrThrowAsync(): Promise<BigNumber> {
try { 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(); const gasInfo = await res.json();
// Eth Gas Station result is gwei * 10 // Eth Gas Station result is gwei * 10
// tslint:disable-next-line:custom-no-magic-numbers // tslint:disable-next-line:custom-no-magic-numbers