parent
e04be0711f
commit
9fbdc3cab1
@ -11,7 +11,6 @@ import { useWeb3React } from '@web3-react/core'
|
||||
import { isSupportedChain } from 'constants/chains'
|
||||
import { RPC_PROVIDERS } from 'constants/providers'
|
||||
import { BaseContract } from 'ethers/lib/ethers'
|
||||
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
|
||||
import { ContractInput, useUniswapPricesQuery } from 'graphql/data/__generated__/types-and-hooks'
|
||||
import { toContractInput } from 'graphql/data/util'
|
||||
import useStablecoinPrice from 'hooks/useStablecoinPrice'
|
||||
@ -31,14 +30,13 @@ function useContractMultichain<T extends BaseContract>(
|
||||
chainIds?: ChainId[]
|
||||
): ContractMap<T> {
|
||||
const { chainId: walletChainId, provider: walletProvider } = useWeb3React()
|
||||
const baseEnabledChains = useBaseEnabledChains()
|
||||
|
||||
return useMemo(() => {
|
||||
const relevantChains =
|
||||
chainIds ??
|
||||
Object.keys(addressMap)
|
||||
.map((chainId) => parseInt(chainId))
|
||||
.filter((chainId) => isSupportedChain(chainId, baseEnabledChains))
|
||||
.filter((chainId) => isSupportedChain(chainId))
|
||||
|
||||
return relevantChains.reduce((acc: ContractMap<T>, chainId) => {
|
||||
const provider =
|
||||
@ -52,7 +50,7 @@ function useContractMultichain<T extends BaseContract>(
|
||||
}
|
||||
return acc
|
||||
}, {})
|
||||
}, [ABI, addressMap, baseEnabledChains, chainIds, walletChainId, walletProvider])
|
||||
}, [ABI, addressMap, chainIds, walletChainId, walletProvider])
|
||||
}
|
||||
|
||||
export function useV3ManagerContracts(chainIds: ChainId[]): ContractMap<NonfungiblePositionManager> {
|
||||
|
@ -5,7 +5,6 @@ import { MissingImageLogo } from 'components/Logo/AssetLogo'
|
||||
import CurrencyLogo from 'components/Logo/CurrencyLogo'
|
||||
import { Unicon } from 'components/Unicon'
|
||||
import { getChainInfo } from 'constants/chainInfo'
|
||||
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
|
||||
import useTokenLogoSource from 'hooks/useAssetLogoSource'
|
||||
import useENSAvatar from 'hooks/useENSAvatar'
|
||||
import React from 'react'
|
||||
@ -99,8 +98,7 @@ export function PortfolioLogo({
|
||||
size = '40px',
|
||||
style,
|
||||
}: MultiLogoProps) {
|
||||
const baseEnabledChains = useBaseEnabledChains()
|
||||
const chainInfo = getChainInfo(chainId, baseEnabledChains)
|
||||
const chainInfo = getChainInfo(chainId)
|
||||
const squareLogoUrl = chainInfo?.squareLogoUrl
|
||||
const logoUrl = chainInfo?.logoUrl
|
||||
const chainLogo = squareLogoUrl ?? logoUrl
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags'
|
||||
import { useBaseEnabledFlag } from 'featureFlags/flags/baseEnabled'
|
||||
import { useForceUniswapXOnFlag } from 'featureFlags/flags/forceUniswapXOn'
|
||||
import { useMultichainUXFlag } from 'featureFlags/flags/multichainUx'
|
||||
import { useRoutingAPIForPriceFlag } from 'featureFlags/flags/priceRoutingApi'
|
||||
@ -237,12 +236,6 @@ export default function FeatureFlagModal() {
|
||||
featureFlag={FeatureFlag.routingAPIPrice}
|
||||
label="Use the routing-api v2 for price fetches"
|
||||
/>
|
||||
<FeatureFlagOption
|
||||
variant={BaseVariant}
|
||||
value={useBaseEnabledFlag()}
|
||||
featureFlag={FeatureFlag.baseEnabled}
|
||||
label="Enable Base"
|
||||
/>
|
||||
<FeatureFlagOption
|
||||
variant={BaseVariant}
|
||||
value={useMultichainUXFlag()}
|
||||
|
@ -14,7 +14,6 @@ import {
|
||||
TESTNET_CHAIN_IDS,
|
||||
UniWalletSupportedChains,
|
||||
} from 'constants/chains'
|
||||
import { useBaseEnabled, useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
|
||||
import { useOnClickOutside } from 'hooks/useOnClickOutside'
|
||||
import useSelectChain from 'hooks/useSelectChain'
|
||||
import useSyncChainQuery from 'hooks/useSyncChainQuery'
|
||||
@ -60,18 +59,11 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => {
|
||||
|
||||
const theme = useTheme()
|
||||
|
||||
const baseEnabled = useBaseEnabled()
|
||||
const showTestnets = useAtomValue(showTestnetsAtom)
|
||||
const walletSupportsChain = useWalletSupportedChains()
|
||||
|
||||
const [supportedChains, unsupportedChains] = useMemo(() => {
|
||||
const { supported, unsupported } = NETWORK_SELECTOR_CHAINS.filter((chain: number) => {
|
||||
if (chain === ChainId.BASE) {
|
||||
return baseEnabled
|
||||
}
|
||||
if (chain === ChainId.BASE_GOERLI) {
|
||||
return showTestnets && baseEnabled
|
||||
}
|
||||
return showTestnets || !TESTNET_CHAIN_IDS.includes(chain)
|
||||
})
|
||||
.sort((a, b) => getChainPriority(a) - getChainPriority(b))
|
||||
@ -87,14 +79,13 @@ export const ChainSelector = ({ leftAlign }: ChainSelectorProps) => {
|
||||
{ supported: [], unsupported: [] } as Record<string, ChainId[]>
|
||||
)
|
||||
return [supported, unsupported]
|
||||
}, [baseEnabled, showTestnets, walletSupportsChain])
|
||||
}, [showTestnets, walletSupportsChain])
|
||||
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
const modalRef = useRef<HTMLDivElement>(null)
|
||||
useOnClickOutside(ref, () => setIsOpen(false), [modalRef])
|
||||
|
||||
const baseEnabledChains = useBaseEnabledChains()
|
||||
const info = getChainInfo(chainId, baseEnabledChains)
|
||||
const info = getChainInfo(chainId)
|
||||
|
||||
const selectChain = useSelectChain()
|
||||
useSyncChainQuery()
|
||||
|
@ -3,7 +3,6 @@ import { ChainId } from '@uniswap/sdk-core'
|
||||
import { useWeb3React } from '@web3-react/core'
|
||||
import Loader from 'components/Icons/LoadingSpinner'
|
||||
import { getChainInfo } from 'constants/chainInfo'
|
||||
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
|
||||
import { CheckMarkIcon } from 'nft/components/icons'
|
||||
import styled, { useTheme } from 'styled-components'
|
||||
|
||||
@ -71,8 +70,7 @@ interface ChainSelectorRowProps {
|
||||
export default function ChainSelectorRow({ disabled, targetChain, onSelectChain, isPending }: ChainSelectorRowProps) {
|
||||
const { chainId } = useWeb3React()
|
||||
const active = chainId === targetChain
|
||||
const baseEnabledChains = useBaseEnabledChains()
|
||||
const chainInfo = getChainInfo(targetChain, baseEnabledChains)
|
||||
const chainInfo = getChainInfo(targetChain)
|
||||
const label = chainInfo?.label
|
||||
const logoUrl = chainInfo?.logoUrl
|
||||
|
||||
|
@ -2,7 +2,6 @@ import { Trans } from '@lingui/macro'
|
||||
import { ChainId } from '@uniswap/sdk-core'
|
||||
import { useWeb3React } from '@web3-react/core'
|
||||
import { getChainInfo } from 'constants/chainInfo'
|
||||
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
|
||||
import { ArrowUpRight } from 'react-feather'
|
||||
import styled from 'styled-components'
|
||||
import { ExternalLink, HideSmall } from 'theme'
|
||||
@ -171,13 +170,12 @@ function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertCh
|
||||
export function NetworkAlert() {
|
||||
const { chainId } = useWeb3React()
|
||||
const [darkMode] = useDarkModeManager()
|
||||
const baseEnabledChains = useBaseEnabledChains()
|
||||
|
||||
if (!shouldShowAlert(chainId)) {
|
||||
return null
|
||||
}
|
||||
|
||||
const chainInfo = getChainInfo(chainId, baseEnabledChains)
|
||||
const chainInfo = getChainInfo(chainId)
|
||||
|
||||
if (!chainInfo) return null
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
import { ChainId } from '@uniswap/sdk-core'
|
||||
|
||||
import { BaseVariant, FeatureFlag, useBaseFlag } from '../index'
|
||||
|
||||
export function useBaseEnabledFlag(): BaseVariant {
|
||||
return useBaseFlag(FeatureFlag.baseEnabled)
|
||||
}
|
||||
|
||||
export function useBaseEnabled(): boolean {
|
||||
return useBaseEnabledFlag() === BaseVariant.Enabled
|
||||
}
|
||||
|
||||
export function useBaseEnabledChains(): Record<number, boolean> {
|
||||
const baseEnabled = useBaseEnabled()
|
||||
return {
|
||||
[ChainId.BASE]: baseEnabled,
|
||||
[ChainId.BASE_GOERLI]: baseEnabled,
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ export enum FeatureFlag {
|
||||
routingAPIPrice = 'routing_api_price',
|
||||
forceUniswapXOn = 'uniswapx_force_on', // forces routing-api's feature flag for uniswapx to turn on as well
|
||||
uniswapXEthOutputEnabled = 'uniswapx_eth_output_enabled',
|
||||
baseEnabled = 'base_enabled',
|
||||
multichainUX = 'multichain_ux',
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import PositionList from 'components/PositionList'
|
||||
import { RowBetween, RowFixed } from 'components/Row'
|
||||
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
|
||||
import { isSupportedChain } from 'constants/chains'
|
||||
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
|
||||
import { useFilterPossiblyMaliciousPositions } from 'hooks/useFilterPossiblyMaliciousPositions'
|
||||
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
|
||||
import { useV3Positions } from 'hooks/useV3Positions'
|
||||
@ -213,9 +212,8 @@ export default function Pool() {
|
||||
)
|
||||
|
||||
const filteredPositions = useFilterPossiblyMaliciousPositions(userSelectedPositionSet)
|
||||
const baseEnabledChains = useBaseEnabledChains()
|
||||
|
||||
if (!isSupportedChain(chainId, baseEnabledChains)) {
|
||||
if (!isSupportedChain(chainId)) {
|
||||
return <WrongNetworkCard />
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@ import TokenSafetyModal from 'components/TokenSafety/TokenSafetyModal'
|
||||
import { getChainInfo } from 'constants/chainInfo'
|
||||
import { asSupportedChain, isSupportedChain } from 'constants/chains'
|
||||
import { getSwapCurrencyId, TOKEN_SHORTHANDS } from 'constants/tokens'
|
||||
import { useBaseEnabledChains } from 'featureFlags/flags/baseEnabled'
|
||||
import { useCurrency, useDefaultActiveTokens } from 'hooks/Tokens'
|
||||
import { useIsSwapUnsupported } from 'hooks/useIsSwapUnsupported'
|
||||
import { useMaxAmountIn } from 'hooks/useMaxAmountIn'
|
||||
@ -136,11 +135,10 @@ function largerPercentValue(a?: Percent, b?: Percent) {
|
||||
export default function SwapPage({ className }: { className?: string }) {
|
||||
const { chainId: connectedChainId } = useWeb3React()
|
||||
const loadedUrlParams = useDefaultsFromURLSearch()
|
||||
const baseEnabledChains = useBaseEnabledChains()
|
||||
|
||||
const location = useLocation()
|
||||
|
||||
const supportedChainId = asSupportedChain(connectedChainId, baseEnabledChains)
|
||||
const supportedChainId = asSupportedChain(connectedChainId)
|
||||
|
||||
return (
|
||||
<Trace page={InterfacePageName.SWAP_PAGE} shouldLogImpression>
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { ChainId } from '@uniswap/sdk-core'
|
||||
import { useWeb3React } from '@web3-react/core'
|
||||
import { useBaseEnabled } from 'featureFlags/flags/baseEnabled'
|
||||
import { useIsNftPage } from 'hooks/useIsNftPage'
|
||||
import { useEffect } from 'react'
|
||||
import { useDarkModeManager } from 'theme/components/ThemeToggle'
|
||||
@ -40,7 +39,6 @@ export default function RadialGradientByChainUpdater(): null {
|
||||
const { chainId } = useWeb3React()
|
||||
const [darkMode] = useDarkModeManager()
|
||||
const isNftPage = useIsNftPage()
|
||||
const baseEnabled = useBaseEnabled()
|
||||
|
||||
// manage background color
|
||||
useEffect(() => {
|
||||
@ -117,10 +115,6 @@ export default function RadialGradientByChainUpdater(): null {
|
||||
}
|
||||
case ChainId.BASE:
|
||||
case ChainId.BASE_GOERLI: {
|
||||
if (!baseEnabled) {
|
||||
setDefaultBackground(backgroundRadialGradientElement, darkMode)
|
||||
return
|
||||
}
|
||||
setBackground(backgroundResetStyles)
|
||||
const baseLightGradient =
|
||||
'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0.20) 0%, rgba(0, 82, 255, 0.08) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)'
|
||||
@ -133,6 +127,6 @@ export default function RadialGradientByChainUpdater(): null {
|
||||
setDefaultBackground(backgroundRadialGradientElement, darkMode)
|
||||
}
|
||||
}
|
||||
}, [darkMode, chainId, isNftPage, baseEnabled])
|
||||
}, [darkMode, chainId, isNftPage])
|
||||
return null
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user