fix: remove unused feature flags (#7234)

* fix: remove unused feature flags

* fix: remove flag from tests

* fix: tests

* fix: remove useUniswapX param
This commit is contained in:
eddie 2023-08-30 12:37:50 -07:00 committed by GitHub
parent 4eda18a4d5
commit 366f4d98ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 719 additions and 642 deletions

@ -1,9 +1,8 @@
import { FeatureFlag } from '../../src/featureFlags'
import { getTestSelector } from '../utils'
describe('Buy Crypto Modal', () => {
it('should open and close', () => {
cy.visit('/', { featureFlags: [FeatureFlag.fiatOnRampButtonOnSwap] })
cy.visit('/')
// Open the fiat onramp modal
cy.get(getTestSelector('buy-fiat-button')).click()
@ -16,7 +15,7 @@ describe('Buy Crypto Modal', () => {
it('should open and close, mobile viewport', () => {
cy.viewport('iphone-6')
cy.visit('/', { featureFlags: [FeatureFlag.fiatOnRampButtonOnSwap] })
cy.visit('/')
// Open the fiat onramp modal
cy.get(getTestSelector('buy-fiat-button')).click()

@ -24,6 +24,6 @@ describe('Swap settings', () => {
cy.contains('Transaction deadline').should('exist')
cy.contains('UniswapX').should('exist')
cy.contains('Local routing').should('exist')
cy.get(getTestSelector('mobile-settings-scrim')).click()
cy.get(getTestSelector('mobile-settings-scrim')).click({ force: true })
})
})

@ -1,7 +1,6 @@
import Column from 'components/Column'
import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags'
import { useCurrencyConversionFlag } from 'featureFlags/flags/currencyConversion'
import { useForceUniswapXOnFlag } from 'featureFlags/flags/forceUniswapXOn'
import { useFotAdjustmentsFlag } from 'featureFlags/flags/fotAdjustments'
import { useInfoExploreFlag } from 'featureFlags/flags/infoExplore'
import { useInfoLiveViewsFlag } from 'featureFlags/flags/infoLiveViews'
@ -236,12 +235,6 @@ export default function FeatureFlagModal() {
featureFlag={FeatureFlag.uniswapXEnabled}
label="Enable UniswapX on interface"
/>
<FeatureFlagOption
variant={BaseVariant}
value={useForceUniswapXOnFlag()}
featureFlag={FeatureFlag.forceUniswapXOn}
label="Force routing api to enable UniswapX"
/>
<FeatureFlagOption
variant={BaseVariant}
value={useUniswapXSyntheticQuoteFlag()}

@ -1,6 +1,5 @@
import { Trans } from '@lingui/macro'
import { Percent } from '@uniswap/sdk-core'
import { useFiatOnRampButtonEnabled } from 'featureFlags/flags/fiatOnRampButton'
import { InterfaceTrade } from 'state/routing/types'
import styled from 'styled-components'
import { ThemedText } from 'theme'
@ -28,15 +27,13 @@ export default function SwapHeader({
chainId?: number
trade?: InterfaceTrade
}) {
const fiatOnRampButtonEnabled = useFiatOnRampButtonEnabled()
return (
<StyledSwapHeader>
<HeaderButtonContainer>
<ThemedText.SubHeader>
<Trans>Swap</Trans>
</ThemedText.SubHeader>
{fiatOnRampButtonEnabled && <SwapBuyFiatButton />}
<SwapBuyFiatButton />
</HeaderButtonContainer>
<RowFixed>
<SettingsTab autoSlippage={autoSlippage} chainId={chainId} trade={trade} />

@ -1,9 +0,0 @@
import { BaseVariant, FeatureFlag, useBaseFlag } from '../index'
function useFiatOnRampButtonFlag(): BaseVariant {
return useBaseFlag(FeatureFlag.fiatOnRampButtonOnSwap)
}
export function useFiatOnRampButtonEnabled(): boolean {
return useFiatOnRampButtonFlag() === BaseVariant.Enabled
}

@ -1,9 +0,0 @@
import { BaseVariant, FeatureFlag, useBaseFlag } from '../index'
export function useForceUniswapXOnFlag(): BaseVariant {
return useBaseFlag(FeatureFlag.forceUniswapXOn)
}
export function useForceUniswapXOn(): boolean {
return useForceUniswapXOnFlag() === BaseVariant.Enabled
}

@ -7,12 +7,9 @@ import { useGate } from 'statsig-react'
*/
export enum FeatureFlag {
traceJsonRpc = 'traceJsonRpc',
permit2 = 'permit2',
fiatOnRampButtonOnSwap = 'fiat_on_ramp_button_on_swap_page',
debounceSwapQuote = 'debounce_swap_quote',
uniswapXEnabled = 'uniswapx_enabled', // enables sending dutch_limit config to routing-api
uniswapXSyntheticQuote = 'uniswapx_synthetic_quote',
forceUniswapXOn = 'uniswapx_force_on', // forces routing-api's feature flag for uniswapx to turn on as well
uniswapXEthOutputEnabled = 'uniswapx_eth_output_enabled',
uniswapXExactOutputEnabled = 'uniswapx_exact_output_enabled',
multichainUX = 'multichain_ux',

@ -1,6 +1,5 @@
import { SkipToken, skipToken } from '@reduxjs/toolkit/query/react'
import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core'
import { useForceUniswapXOn } from 'featureFlags/flags/forceUniswapXOn'
import { useFotAdjustmentsEnabled } from 'featureFlags/flags/fotAdjustments'
import { useUniswapXEnabled } from 'featureFlags/flags/uniswapx'
import { useUniswapXEthOutputEnabled } from 'featureFlags/flags/uniswapXEthOutput'
@ -33,7 +32,6 @@ export function useRoutingAPIArguments({
}): GetQuoteArgs | SkipToken {
const uniswapXEnabled = useUniswapXEnabled()
const uniswapXForceSyntheticQuotes = useUniswapXSyntheticQuoteEnabled()
const forceUniswapXOn = useForceUniswapXOn()
const userDisabledUniswapX = useUserDisabledUniswapX()
const uniswapXEthOutputEnabled = useUniswapXEthOutputEnabled()
const uniswapXExactOutputEnabled = useUniswapXExactOutputEnabled()
@ -59,7 +57,6 @@ export function useRoutingAPIArguments({
needsWrapIfUniswapX: tokenIn.isNative,
uniswapXEnabled,
uniswapXForceSyntheticQuotes,
forceUniswapXOn,
userDisabledUniswapX,
uniswapXEthOutputEnabled,
uniswapXExactOutputEnabled,
@ -75,7 +72,6 @@ export function useRoutingAPIArguments({
uniswapXEnabled,
uniswapXExactOutputEnabled,
uniswapXForceSyntheticQuotes,
forceUniswapXOn,
userDisabledUniswapX,
uniswapXEthOutputEnabled,
fotAdjustmentsEnabled,

File diff suppressed because it is too large Load Diff

@ -128,15 +128,7 @@ export const routingApi = createApi({
if (shouldUseAPIRouter(args)) {
fellBack = true
try {
const {
tokenInAddress,
tokenInChainId,
tokenOutAddress,
tokenOutChainId,
amount,
tradeType,
forceUniswapXOn,
} = args
const { tokenInAddress, tokenInChainId, tokenOutAddress, tokenOutChainId, amount, tradeType } = args
const type = isExactInput(tradeType) ? 'EXACT_INPUT' : 'EXACT_OUTPUT'
const requestBody = {
@ -146,8 +138,6 @@ export const routingApi = createApi({
tokenOut: tokenOutAddress,
amount,
type,
// if forceUniswapXOn is not ON, then use the backend's default value
useUniswapX: forceUniswapXOn || undefined,
configs: getRoutingAPIConfig(args),
}

@ -46,7 +46,6 @@ export interface GetQuoteArgs {
uniswapXForceSyntheticQuotes: boolean
uniswapXEthOutputEnabled: boolean
uniswapXExactOutputEnabled: boolean
forceUniswapXOn: boolean
userDisabledUniswapX: boolean
fotAdjustmentsEnabled: boolean
}