feat: add feature flag for URA (#6593)

This commit is contained in:
eddie 2023-05-18 10:14:18 -07:00 committed by GitHub
parent b2966f8d29
commit 03095f4e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

@ -1,6 +1,7 @@
import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags'
import { DetailsV2Variant, useDetailsV2Flag } from 'featureFlags/flags/nftDetails'
import { TraceJsonRpcVariant, useTraceJsonRpcFlag } from 'featureFlags/flags/traceJsonRpc'
import { UnifiedRouterVariant, useUnifiedRoutingAPIFlag } from 'featureFlags/flags/unifiedRouter'
import { useUpdateAtom } from 'jotai/utils'
import { Children, PropsWithChildren, ReactElement, ReactNode, useCallback, useState } from 'react'
import { X } from 'react-feather'
@ -207,6 +208,12 @@ export default function FeatureFlagModal() {
featureFlag={FeatureFlag.detailsV2}
label="Use the new details page for nfts"
/>
<FeatureFlagOption
variant={UnifiedRouterVariant}
value={useUnifiedRoutingAPIFlag()}
featureFlag={FeatureFlag.uraEnabled}
label="Enable the Unified Routing API"
/>
<FeatureFlagGroup name="Debug">
<FeatureFlagOption
variant={TraceJsonRpcVariant}

@ -6,4 +6,5 @@ export enum FeatureFlag {
permit2 = 'permit2',
fiatOnRampButtonOnSwap = 'fiat_on_ramp_button_on_swap_page',
detailsV2 = 'details_v2',
uraEnabled = 'ura_enabled',
}

@ -0,0 +1,12 @@
import { BaseVariant, FeatureFlag, useBaseFlag } from '../index'
export function useUnifiedRoutingAPIFlag(): BaseVariant {
return useBaseFlag(FeatureFlag.uraEnabled)
}
// eslint-disable-next-line import/no-unused-modules
export function useUnifiedRoutingAPIEnabled(): boolean {
return useUnifiedRoutingAPIFlag() === BaseVariant.Enabled
}
export { BaseVariant as UnifiedRouterVariant }