From 4994d46c7e1906de3eaaa8e2484e030ca666e213 Mon Sep 17 00:00:00 2001 From: Anxo Rodriguez Date: Wed, 1 Jan 2025 14:15:36 +0100 Subject: [PATCH] feat: remove mock --- apps/cowswap-frontend/.env | 7 ------ apps/cowswap-frontend/.env.production | 5 ----- .../src/api/cowProtocol/api.ts | 2 +- .../src/api/cowProtocol/index.ts | 22 +------------------ .../src/api/cowProtocol/mock.ts | 12 ---------- apps/widget-configurator/.env.production | 6 +---- 6 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 apps/cowswap-frontend/src/api/cowProtocol/mock.ts diff --git a/apps/cowswap-frontend/.env b/apps/cowswap-frontend/.env index 2ea99eeddf..75848496b1 100644 --- a/apps/cowswap-frontend/.env +++ b/apps/cowswap-frontend/.env @@ -102,13 +102,6 @@ INTEGRATION_TESTS_INFURA_KEY= -####################################### -# Development -####################################### - -# Enables mock mode (default = false) -REACT_APP_MOCK=true - ####################################### diff --git a/apps/cowswap-frontend/.env.production b/apps/cowswap-frontend/.env.production index f6aaf29cee..8b13789179 100644 --- a/apps/cowswap-frontend/.env.production +++ b/apps/cowswap-frontend/.env.production @@ -1,6 +1 @@ -####################################### -# Development -####################################### -# Enables mock mode (default = false) -REACT_APP_MOCK=false diff --git a/apps/cowswap-frontend/src/api/cowProtocol/api.ts b/apps/cowswap-frontend/src/api/cowProtocol/api.ts index 90ff5493cf..a18c3035b5 100644 --- a/apps/cowswap-frontend/src/api/cowProtocol/api.ts +++ b/apps/cowswap-frontend/src/api/cowProtocol/api.ts @@ -37,7 +37,6 @@ import { ApiErrorCodes } from './errors/OperatorError' import QuoteApiError, { mapOperatorErrorToQuoteError, QuoteApiErrorDetails } from './errors/QuoteError' import { getIsOrderBookTypedError } from './getIsOrderBookTypedError' - function getProfileUrl(): Partial> { if (isLocal || isDev || isPr || isBarn) { return { @@ -155,6 +154,7 @@ function _getAppDataQuoteParams(params: FeeQuoteParams) { } export async function getQuote(params: FeeQuoteParams): Promise { + console.log(`ANXO: getQuote (${params.priceQuality})`, params) const { chainId } = params const quoteParams = _mapNewToLegacyParams(params) const { sellToken, buyToken } = quoteParams diff --git a/apps/cowswap-frontend/src/api/cowProtocol/index.ts b/apps/cowswap-frontend/src/api/cowProtocol/index.ts index 6f5cc47bff..3318fdbc97 100644 --- a/apps/cowswap-frontend/src/api/cowProtocol/index.ts +++ b/apps/cowswap-frontend/src/api/cowProtocol/index.ts @@ -1,21 +1 @@ -import * as realApi from './api' -import * as mockApi from './mock' - -export { getIsOrderBookTypedError } from './getIsOrderBookTypedError' - -const useMock = process.env.REACT_APP_MOCK === 'true' - -// Re-exporting the result, mocked or not. -// Unfortunately, did not find a way to export -// a mix of mock/real implementations -// without manually naming the exports -export const { - // functions that have a mock - getProfileData, - getQuote = realApi.getQuote, - getOrder = realApi.getOrder, - getNativePrice = realApi.getNativePrice, - getTrades = realApi.getTrades, - getOrders = realApi.getOrders, - // functions that only have a mock -} = useMock ? { ...mockApi } : { ...realApi } +export * from './api' diff --git a/apps/cowswap-frontend/src/api/cowProtocol/mock.ts b/apps/cowswap-frontend/src/api/cowProtocol/mock.ts deleted file mode 100644 index da882d5c60..0000000000 --- a/apps/cowswap-frontend/src/api/cowProtocol/mock.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ProfileData } from './api' - -export async function getProfileData(): Promise { - console.log('[utils:operatorMock] Get profile data') - return { - lastUpdated: new Date(2021, 9, 4, 7).toUTCString(), - referralVolumeUsd: 250_000, - totalReferrals: 45, - totalTrades: 542, - tradeVolumeUsd: 1_250_300, - } -} diff --git a/apps/widget-configurator/.env.production b/apps/widget-configurator/.env.production index f6aaf29cee..139597f9cb 100644 --- a/apps/widget-configurator/.env.production +++ b/apps/widget-configurator/.env.production @@ -1,6 +1,2 @@ -####################################### -# Development -####################################### -# Enables mock mode (default = false) -REACT_APP_MOCK=false +