diff --git a/src/custom/api/gnosisProtocol/api.ts b/src/custom/api/gnosisProtocol/api.ts index 1cc5919bf..7cb2939cc 100644 --- a/src/custom/api/gnosisProtocol/api.ts +++ b/src/custom/api/gnosisProtocol/api.ts @@ -59,18 +59,18 @@ function getProfileUrl(): Partial> { process.env.REACT_APP_PROFILE_API_URL_STAGING_MAINNET || 'https://protocol-affiliate.gnosis.io/api', } } - +const STRATEGY_URL_BASE = 'https://raw.githubusercontent.com/gnosis/cowswap/configuration/config/strategies' function getPriceStrategyUrl(): Record { return { - [SupportedChainId.MAINNET]: 'https://raw.githubusercontent.com/gnosis/cowswap/configuration/price/strategy-1.json', - [SupportedChainId.RINKEBY]: 'https://raw.githubusercontent.com/gnosis/cowswap/configuration/price/strategy-4.json', - [SupportedChainId.XDAI]: 'https://raw.githubusercontent.com/gnosis/cowswap/configuration/price/strategy-100.json', + [SupportedChainId.MAINNET]: STRATEGY_URL_BASE + '/strategy-1.json', + [SupportedChainId.RINKEBY]: STRATEGY_URL_BASE + '/strategy-4.json', + [SupportedChainId.XDAI]: STRATEGY_URL_BASE + '/strategy-100.json', } } const API_BASE_URL = getGnosisProtocolUrl() const PROFILE_API_BASE_URL = getProfileUrl() -const STRATEGY_API_BASE_URL = getPriceStrategyUrl() +const STRATEGY_API_URL = getPriceStrategyUrl() const DEFAULT_HEADERS = { 'Content-Type': 'application/json', @@ -156,7 +156,7 @@ function _getProfileApiBaseUrl(chainId: ChainId): string { } function _getPriceStrategyApiBaseUrl(chainId: ChainId): string { - const baseUrl = STRATEGY_API_BASE_URL[chainId] + const baseUrl = STRATEGY_API_URL[chainId] if (!baseUrl) { new Error( @@ -200,10 +200,7 @@ function _fetchProfile( function _fetchPriceStrategy(chainId: ChainId): Promise { const baseUrl = _getPriceStrategyApiBaseUrl(chainId) - return fetch(baseUrl, { - headers: DEFAULT_HEADERS, - method: 'GET', - }) + return fetch(baseUrl) } function _post(chainId: ChainId, url: string, data: any): Promise { diff --git a/src/custom/hooks/useGetGpPriceStrategy.ts b/src/custom/hooks/useGetGpPriceStrategy.ts index 0c8384bf5..1252226b3 100644 --- a/src/custom/hooks/useGetGpPriceStrategy.ts +++ b/src/custom/hooks/useGetGpPriceStrategy.ts @@ -1,7 +1,6 @@ import ms from 'ms.macro' import { useState, useEffect, useCallback } from 'react' import { DEFAULT_GP_PRICE_STRATEGY } from 'constants/index' -import { registerOnWindow } from 'utils/misc' import { getPriceStrategy, PriceStrategy } from 'api/gnosisProtocol/api' import { useActiveWeb3React } from 'hooks' import { supportedChainId } from 'utils/supportedChainId' @@ -43,12 +42,5 @@ export default function useGetGpPriceStrategy(): GpPriceStrategy { return () => clearInterval(intervalId) }, [_handleSetStrategy, gpPriceStrategy, preChainId]) - // TODO: REMOVE - return process.env.NODE_ENV !== 'production' ? (window as any).GP_STRATEGY : gpPriceStrategy + return gpPriceStrategy } - -/* TESTING ONLY! */ -;(window as any).GP_STRATEGY = DEFAULT_GP_PRICE_STRATEGY -registerOnWindow({ - setStrategy: (strat: GpPriceStrategy) => ((window as any).GP_STRATEGY = strat), -})