diff --git a/ui/pages/swaps/swaps.util.js b/ui/pages/swaps/swaps.util.js index e4a8cb4e6..aee102070 100644 --- a/ui/pages/swaps/swaps.util.js +++ b/ui/pages/swaps/swaps.util.js @@ -53,6 +53,8 @@ const TOKEN_TRANSFER_LOG_TOPIC_HASH = const CACHE_REFRESH_FIVE_MINUTES = 300000; +const clientIdHeader = { 'X-Client-Id': 'extension' }; + /** * @param {string} type Type of an API call, e.g. "tokens" * @param {string} chainId @@ -316,7 +318,7 @@ export async function fetchTradesInfo( )}${queryString}`; const tradesResponse = await fetchWithCache( tradeURL, - { method: 'GET' }, + { method: 'GET', headers: clientIdHeader }, { cacheRefreshTime: 0, timeout: SECOND * 15 }, ); const newQuotes = tradesResponse.reduce((aggIdTradeMap, quote) => { @@ -361,7 +363,7 @@ export async function fetchToken(contractAddress, chainId, useNewSwapsApi) { const tokenUrl = getBaseApi('token', chainId, useNewSwapsApi); const token = await fetchWithCache( `${tokenUrl}?address=${contractAddress}`, - { method: 'GET' }, + { method: 'GET', headers: clientIdHeader }, { cacheRefreshTime: CACHE_REFRESH_FIVE_MINUTES }, ); return token; @@ -371,7 +373,7 @@ export async function fetchTokens(chainId, useNewSwapsApi) { const tokensUrl = getBaseApi('tokens', chainId, useNewSwapsApi); const tokens = await fetchWithCache( tokensUrl, - { method: 'GET' }, + { method: 'GET', headers: clientIdHeader }, { cacheRefreshTime: CACHE_REFRESH_FIVE_MINUTES }, ); const filteredTokens = [ @@ -397,7 +399,7 @@ export async function fetchAggregatorMetadata(chainId, useNewSwapsApi) { ); const aggregators = await fetchWithCache( aggregatorMetadataUrl, - { method: 'GET' }, + { method: 'GET', headers: clientIdHeader }, { cacheRefreshTime: CACHE_REFRESH_FIVE_MINUTES }, ); const filteredAggregators = {}; @@ -419,7 +421,7 @@ export async function fetchTopAssets(chainId, useNewSwapsApi) { const topAssetsUrl = getBaseApi('topAssets', chainId, useNewSwapsApi); const response = await fetchWithCache( topAssetsUrl, - { method: 'GET' }, + { method: 'GET', headers: clientIdHeader }, { cacheRefreshTime: CACHE_REFRESH_FIVE_MINUTES }, ); const topAssetsMap = response.reduce((_topAssetsMap, asset, index) => { @@ -437,7 +439,7 @@ export async function fetchSwapsFeatureFlags() { : SWAPS_API_V2_BASE_URL; const response = await fetchWithCache( `${v2ApiBaseUrl}/featureFlags`, - { method: 'GET' }, + { method: 'GET', headers: clientIdHeader }, { cacheRefreshTime: 600000 }, ); return response; @@ -467,7 +469,7 @@ export async function fetchSwapsGasPrices(chainId, useNewSwapsApi) { const gasPricesUrl = getBaseApi('gasPrices', chainId, useNewSwapsApi); const response = await fetchWithCache( gasPricesUrl, - { method: 'GET' }, + { method: 'GET', headers: clientIdHeader }, { cacheRefreshTime: 30000 }, ); const responseIsValid = validateData(