Skip to content

Commit

Permalink
feat: remove mock
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolin committed Jan 1, 2025
1 parent a8efd5c commit 4994d46
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 51 deletions.
7 changes: 0 additions & 7 deletions apps/cowswap-frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,6 @@ INTEGRATION_TESTS_INFURA_KEY=



#######################################
# Development
#######################################

# Enables mock mode (default = false)
REACT_APP_MOCK=true



#######################################
Expand Down
5 changes: 0 additions & 5 deletions apps/cowswap-frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
#######################################
# Development
#######################################

# Enables mock mode (default = false)
REACT_APP_MOCK=false
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/src/api/cowProtocol/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { ApiErrorCodes } from './errors/OperatorError'
import QuoteApiError, { mapOperatorErrorToQuoteError, QuoteApiErrorDetails } from './errors/QuoteError'
import { getIsOrderBookTypedError } from './getIsOrderBookTypedError'


function getProfileUrl(): Partial<Record<ChainId, string>> {
if (isLocal || isDev || isPr || isBarn) {
return {
Expand Down Expand Up @@ -155,6 +154,7 @@ function _getAppDataQuoteParams(params: FeeQuoteParams) {
}

export async function getQuote(params: FeeQuoteParams): Promise<OrderQuoteResponse> {
console.log(`ANXO: getQuote (${params.priceQuality})`, params)
const { chainId } = params
const quoteParams = _mapNewToLegacyParams(params)
const { sellToken, buyToken } = quoteParams
Expand Down
22 changes: 1 addition & 21 deletions apps/cowswap-frontend/src/api/cowProtocol/index.ts
Original file line number Diff line number Diff line change
@@ -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'
12 changes: 0 additions & 12 deletions apps/cowswap-frontend/src/api/cowProtocol/mock.ts

This file was deleted.

6 changes: 1 addition & 5 deletions apps/widget-configurator/.env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
#######################################
# Development
#######################################

# Enables mock mode (default = false)
REACT_APP_MOCK=false

0 comments on commit 4994d46

Please sign in to comment.