Compare commits

...

7 Commits

Author SHA1 Message Date
Zach Pomerantz
15a2446ec8
build: fix promotion sha (#7021) 2023-07-26 11:47:12 -07:00
eddie
dc5775e318
fix: improve v2 network support (#7015)
* ci: add global CODEOWNERS

* fix: improve v2 network support

* add an unsupported message to all v2 pages

* add guard on transaction callbacks

* fix: dep array

---------

Co-authored-by: UL Service Account <hello-happy-puppy@users.noreply.github.com>
Co-authored-by: Jordan Frankfurt <jordanwfrankfurt@gmail.com>
2023-07-26 11:15:53 -07:00
cartcrom
95bb70cf4f
fix: uniswap wallet deeplinking (#7016)
fix: use deeplink instead of universal link
2023-07-26 13:46:28 -04:00
Jordan Frankfurt
e454521a97
fix: update safety check cache time (#7014) 2023-07-26 11:07:22 -05:00
Charles Bachmeier
6b99656c1b
fix: staging hotfixes for price range and search bar (#7003)
* fix: fixing price range filter passing as number (#6994)

* fix: use deferred value to avoid suspense issues with inputting text (#6996)

fix: use deferred value to avoid suspense issues with inputting text during supsended render causing errors

---------

Co-authored-by: Jack Short <john.short.tj@gmail.com>
Co-authored-by: Nate Wienert <natewienert@gmail.com>
2023-07-25 12:17:02 -07:00
UL Service Account
e1436c30c5 ci: add global CODEOWNERS 2023-07-21 19:01:14 +00:00
UL Service Account
16e4e0aefa ci(t9n): download translations from crowdin 2023-07-21 19:01:14 +00:00
50 changed files with 118816 additions and 66 deletions

View File

@ -21,7 +21,7 @@ jobs:
const statuses = await github.rest.repos.listCommitStatusesForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.payload.head_commit.sha
ref: context.sha
})
const status = statuses.data.find(status => status.context === 'Test / promotion')?.state || 'missing'
core.info('Status: ' + status)

1
CODEOWNERS Normal file
View File

@ -0,0 +1 @@
@uniswap/web-admins

View File

@ -13,6 +13,7 @@ import { QRCodeSVG } from 'qrcode.react'
import { useEffect, useState } from 'react'
import styled, { useTheme } from 'styled-components/macro'
import { CloseIcon, ThemedText } from 'theme'
import { isIOS } from 'utils/userAgent'
import uniPng from '../../assets/images/uniwallet_modal_icon.png'
import { DownloadButton } from './DownloadButton'
@ -41,8 +42,9 @@ export default function UniwalletModal() {
const { activationState, cancelActivation } = useActivationState()
const [uri, setUri] = useState<string>()
// Displays the modal if a Uniswap Wallet Connection is pending & qrcode URI is available
// Displays the modal if not on iOS, a Uniswap Wallet Connection is pending, & qrcode URI is available
const open =
!isIOS &&
activationState.status === ActivationStatus.PENDING &&
activationState.connection.type === ConnectionType.UNISWAP_WALLET_V2 &&
!!uri

View File

@ -1,5 +1,4 @@
import usePrevious from 'hooks/usePrevious'
import React, { Suspense } from 'react'
import React, { Suspense, useDeferredValue } from 'react'
/**
* This is useful for keeping the "last rendered" components on-screen while any suspense
@ -9,6 +8,7 @@ import React, { Suspense } from 'react'
*/
export const SuspenseWithPreviousRenderAsFallback = (props: { children: React.ReactNode }) => {
const previousContents = usePrevious(props.children)
return <Suspense fallback={previousContents ?? null}>{props.children}</Suspense>
const previousChildren = useDeferredValue(props.children)
return <Suspense fallback={previousChildren ?? null}>{props.children}</Suspense>
}

View File

@ -0,0 +1,28 @@
import { Trans } from '@lingui/macro'
import { AutoColumn } from 'components/Column'
import styled from 'styled-components/macro'
import { ThemedText } from 'theme'
const TextWrapper = styled.div`
border: 1px solid ${({ theme }) => theme.textPrimary};
padding: 16px 12px;
border-radius: 12px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`
export function V2Unsupported() {
return (
<AutoColumn gap="lg" justify="center">
<AutoColumn gap="md" style={{ width: '100%' }}>
<TextWrapper>
<ThemedText.BodySecondary color="textSecondary" textAlign="center">
<Trans>Uniswap V2 is not available on this network.</Trans>
</ThemedText.BodySecondary>
</TextWrapper>
</AutoColumn>
</AutoColumn>
)
}

View File

@ -83,10 +83,7 @@ export class UniwalletConnect extends WalletConnectV2 {
// Opens deeplink to Uniswap Wallet if on iOS
if (isIOS) {
const newTab = window.open(`https://uniswap.org/app/wc?uri=${encodeURIComponent(uri)}`)
// Fixes blank tab opening on mobile Chrome
newTab?.close()
window.location.href = `uniswap://wc?uri=${encodeURIComponent(uri)}`
}
})
}

View File

@ -41,16 +41,9 @@ export const SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [
] as const
/**
* Unsupported networks for V2 pool behavior.
* Supported networks for V2 pool behavior.
*/
export const UNSUPPORTED_V2POOL_CHAIN_IDS = [
ChainId.POLYGON,
ChainId.OPTIMISM,
ChainId.ARBITRUM_ONE,
ChainId.BNB,
ChainId.ARBITRUM_GOERLI,
ChainId.AVALANCHE,
] as const
export const SUPPORTED_V2POOL_CHAIN_IDS = [ChainId.MAINNET, ChainId.GOERLI] as const
export const TESTNET_CHAIN_IDS = [
ChainId.GOERLI,

View File

@ -35,8 +35,7 @@ export default function useAccountRiskCheck(account: string | null | undefined)
.catch(() => dispatch(setOpenModal(null)))
}
} finally {
// leaving this code in place w/ a negligible cache time in case we want to increase cache time later
localStorage.setItem(riskCheckLocalStorageKey, (now + ms`10 seconds`).toString())
localStorage.setItem(riskCheckLocalStorageKey, (now + ms`1 day`).toString())
}
}
}, [account, dispatch])

View File

@ -0,0 +1,7 @@
import { useWeb3React } from '@web3-react/core'
import { SUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains'
export function useNetworkSupportsV2() {
const { chainId } = useWeb3React()
return chainId && SUPPORTED_V2POOL_CHAIN_IDS.includes(chainId)
}

3597
src/locales/af-ZA.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/ar-SA.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/ca-ES.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/cs-CZ.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/da-DK.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/de-DE.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/el-GR.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/es-ES.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/fi-FI.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/fr-FR.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/he-IL.po Normal file

File diff suppressed because it is too large Load Diff

3598
src/locales/hu-HU.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/id-ID.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/it-IT.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/ja-JP.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/ko-KR.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/nl-NL.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/no-NO.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/pl-PL.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/pt-BR.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/pt-PT.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/ro-RO.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/ru-RU.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/sl-SI.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/sr-SP.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/sv-SE.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/sw-TZ.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/th-TH.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/tr-TR.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/uk-UA.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/vi-VN.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/zh-CN.po Normal file

File diff suppressed because it is too large Load Diff

3597
src/locales/zh-TW.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
import { BigNumber } from '@ethersproject/bignumber'
import { parseEther } from '@ethersproject/units'
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { TraceEvent } from 'analytics'
import clsx from 'clsx'
import { OpacityHoverState } from 'components/Common'
import { parseEther } from 'ethers/lib/utils'
import { NftAssetTraitInput, NftMarketplace, NftStandard } from 'graphql/data/__generated__/types-and-hooks'
import { ASSET_PAGE_SIZE, AssetFetcherParams, useNftAssets } from 'graphql/data/nft/Asset'
import useDebounce from 'hooks/useDebounce'
@ -266,8 +266,8 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
filter: {
listed: buyNow,
marketplaces: markets.length > 0 ? markets.map((market) => market.toUpperCase() as NftMarketplace) : undefined,
maxPrice: debouncedMaxPrice ? parseEther(debouncedMaxPrice).toString() : undefined,
minPrice: debouncedMinPrice ? parseEther(debouncedMinPrice).toString() : undefined,
maxPrice: debouncedMaxPrice ? parseEther(debouncedMaxPrice.toString()).toString() : undefined,
minPrice: debouncedMinPrice ? parseEther(debouncedMinPrice.toString()).toString() : undefined,
tokenSearchQuery: debouncedSearchByNameText,
traits:
traits.length > 0

View File

@ -9,6 +9,8 @@ import { useToggleAccountDrawer } from 'components/AccountDrawer'
import { sendEvent } from 'components/analytics'
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import { V2Unsupported } from 'components/V2Unsupported'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import { useCallback, useState } from 'react'
import { Plus } from 'react-feather'
import { useLocation, useNavigate, useParams } from 'react-router-dom'
@ -132,9 +134,10 @@ export default function AddLiquidity() {
const [approvalB, approveBCallback] = useApproveCallback(parsedAmounts[Field.CURRENCY_B], router?.address)
const addTransaction = useTransactionAdder()
const networkSupportsV2 = useNetworkSupportsV2()
async function onAdd() {
if (!chainId || !provider || !account || !router) return
if (!chainId || !provider || !account || !router || !networkSupportsV2) return
const { [Field.CURRENCY_A]: parsedAmountA, [Field.CURRENCY_B]: parsedAmountB } = parsedAmounts
if (!parsedAmountA || !parsedAmountB || !currencyA || !currencyB || !deadline) {
@ -318,6 +321,8 @@ export default function AddLiquidity() {
const addIsUnsupported = useIsSwapUnsupported(currencies?.CURRENCY_A, currencies?.CURRENCY_B)
if (!networkSupportsV2) return <V2Unsupported />
return (
<>
<AppBody>

View File

@ -14,8 +14,10 @@ import RangeSelector from 'components/RangeSelector'
import RateToggle from 'components/RateToggle'
import SettingsTab from 'components/Settings'
import { Dots } from 'components/swap/styleds'
import { V2Unsupported } from 'components/V2Unsupported'
import { ApprovalState, useApproveCallback } from 'hooks/useApproveCallback'
import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import { PoolState, usePool } from 'hooks/usePools'
import useTransactionDeadline from 'hooks/useTransactionDeadline'
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
@ -262,6 +264,8 @@ function V2PairMigration({
const addTransaction = useTransactionAdder()
const isMigrationPending = useIsTransactionPending(pendingMigrationHash ?? undefined)
const networkSupportsV2 = useNetworkSupportsV2()
const migrate = useCallback(() => {
if (
!migrator ||
@ -272,7 +276,8 @@ function V2PairMigration({
typeof tickUpper !== 'number' ||
!v3Amount0Min ||
!v3Amount1Min ||
!chainId
!chainId ||
!networkSupportsV2
)
return
@ -354,31 +359,34 @@ function V2PairMigration({
setConfirmingMigration(false)
})
}, [
chainId,
isNotUniswap,
migrator,
noLiquidity,
blockTimestamp,
token0,
token1,
feeAmount,
pairBalance,
tickLower,
tickUpper,
sqrtPrice,
v3Amount0Min,
v3Amount1Min,
account,
deadline,
blockTimestamp,
tickLower,
tickUpper,
v3Amount0Min,
v3Amount1Min,
chainId,
networkSupportsV2,
signatureData,
addTransaction,
pair,
noLiquidity,
pair.address,
pairBalance.quotient,
token0.address,
token1.address,
feeAmount,
sqrtPrice,
isNotUniswap,
currency0,
currency1,
addTransaction,
])
const isSuccessfullyMigrated = !!pendingMigrationHash && JSBI.equal(pairBalance.quotient, ZERO)
if (!networkSupportsV2) return <V2Unsupported />
return (
<AutoColumn gap="20px">
<ThemedText.DeprecatedBody my={9} style={{ fontWeight: 400 }}>

View File

@ -7,6 +7,8 @@ import { useWeb3React } from '@web3-react/core'
import MigrateSushiPositionCard from 'components/PositionCard/Sushi'
import MigrateV2PositionCard from 'components/PositionCard/V2'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import { V2Unsupported } from 'components/V2Unsupported'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import { PairState, useV2Pairs } from 'hooks/useV2Pairs'
import { ReactNode, useMemo } from 'react'
import { Text } from 'rebass'
@ -110,6 +112,9 @@ export default function MigrateV2() {
const v2Pairs = useV2Pairs(tokenPairsWithV2Balance)
const v2IsLoading = fetchingPairBalances || v2Pairs.some(([pairState]) => pairState === PairState.LOADING)
const networkSupportsV2 = useNetworkSupportsV2()
if (!networkSupportsV2) return <V2Unsupported />
return (
<>
<BodyWrapper style={{ padding: 24 }}>

View File

@ -1,6 +1,5 @@
import { Trans } from '@lingui/macro'
import { BrowserEvent, InterfaceElementName, InterfaceEventName, InterfacePageName } from '@uniswap/analytics-events'
import { V2_FACTORY_ADDRESSES } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { Trace, TraceEvent } from 'analytics'
import { useToggleAccountDrawer } from 'components/AccountDrawer'
@ -12,6 +11,7 @@ import { RowBetween, RowFixed } from 'components/Row'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import { isSupportedChain } from 'constants/chains'
import { useFilterPossiblyMaliciousPositions } from 'hooks/useFilterPossiblyMaliciousPositions'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import { useV3Positions } from 'hooks/useV3Positions'
import { useMemo } from 'react'
import { AlertTriangle, BookOpen, ChevronDown, ChevronsRight, Inbox, Layers } from 'react-feather'
@ -198,6 +198,7 @@ function WrongNetworkCard() {
export default function Pool() {
const { account, chainId } = useWeb3React()
const networkSupportsV2 = useNetworkSupportsV2()
const toggleWalletDrawer = useToggleAccountDrawer()
const theme = useTheme()
@ -225,7 +226,6 @@ export default function Pool() {
}
const showConnectAWallet = Boolean(!account)
const showV2Features = Boolean(V2_FACTORY_ADDRESSES[chainId])
const menuItems = [
{
@ -270,7 +270,7 @@ export default function Pool() {
<Trans>Pools</Trans>
</ThemedText.LargeHeader>
<ButtonRow>
{showV2Features && (
{networkSupportsV2 && (
<PoolMenu
menuItems={menuItems}
flyoutAlignment={FlyoutAlignment.LEFT}

View File

@ -3,7 +3,8 @@ import { InterfacePageName } from '@uniswap/analytics-events'
import { Pair } from '@uniswap/v2-sdk'
import { useWeb3React } from '@web3-react/core'
import { Trace } from 'analytics'
import { UNSUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains'
import { V2Unsupported } from 'components/V2Unsupported'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import JSBI from 'jsbi'
import { useMemo } from 'react'
import { ChevronsRight } from 'react-feather'
@ -35,8 +36,9 @@ const PageWrapper = styled(AutoColumn)`
`};
`
const VoteCard = styled(DataCard)`
const LPFeeExplainer = styled(DataCard)`
background: radial-gradient(76.02% 75.41% at 1.84% 0%, #27ae60 0%, #000000 100%);
margin: 0 0 16px 0;
overflow: hidden;
`
@ -85,18 +87,14 @@ const EmptyProposals = styled.div`
align-items: center;
`
const Layer2Prompt = styled(EmptyProposals)`
margin-top: 16px;
`
export default function Pool() {
const theme = useTheme()
const { account, chainId } = useWeb3React()
const unsupportedV2Network = chainId && UNSUPPORTED_V2POOL_CHAIN_IDS.includes(chainId)
const { account } = useWeb3React()
const networkSupportsV2 = useNetworkSupportsV2()
// fetch the user's balances of all tracked V2 LP tokens
let trackedTokenPairs = useTrackedTokenPairs()
if (unsupportedV2Network) trackedTokenPairs = []
if (!networkSupportsV2) trackedTokenPairs = []
const tokenPairsWithLiquidityTokens = useMemo(
() => trackedTokenPairs.map((tokens) => ({ liquidityToken: toV2LiquidityToken(tokens), tokens })),
[trackedTokenPairs]
@ -145,7 +143,7 @@ export default function Pool() {
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
<>
<PageWrapper>
<VoteCard>
<LPFeeExplainer>
<CardBGImage />
<CardNoise />
<CardSection>
@ -176,18 +174,10 @@ export default function Pool() {
</CardSection>
<CardBGImage />
<CardNoise />
</VoteCard>
</LPFeeExplainer>
{unsupportedV2Network ? (
<AutoColumn gap="lg" justify="center">
<AutoColumn gap="md" style={{ width: '100%' }}>
<Layer2Prompt>
<ThemedText.DeprecatedBody color={theme.textTertiary} textAlign="center">
<Trans>Uniswap V2 is not available on this network.</Trans>
</ThemedText.DeprecatedBody>
</Layer2Prompt>
</AutoColumn>
</AutoColumn>
{!networkSupportsV2 ? (
<V2Unsupported />
) : (
<AutoColumn gap="lg" justify="center">
<AutoColumn gap="md" style={{ width: '100%' }}>

View File

@ -3,6 +3,8 @@ import { InterfacePageName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { Trace } from 'analytics'
import { V2Unsupported } from 'components/V2Unsupported'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import JSBI from 'jsbi'
import { useCallback, useEffect, useState } from 'react'
import { Plus } from 'react-feather'
@ -96,6 +98,9 @@ export default function PoolFinder() {
</LightCard>
)
const networkSupportsV2 = useNetworkSupportsV2()
if (!networkSupportsV2) return <V2Unsupported />
return (
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
<>

View File

@ -8,7 +8,9 @@ import { useWeb3React } from '@web3-react/core'
import { TraceEvent } from 'analytics'
import { useToggleAccountDrawer } from 'components/AccountDrawer'
import { sendEvent } from 'components/analytics'
import { V2Unsupported } from 'components/V2Unsupported'
import { isSupportedChain } from 'constants/chains'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
import { PositionPageUnsupportedContent } from 'pages/Pool/PositionPage'
import { useCallback, useMemo, useState } from 'react'
@ -157,8 +159,12 @@ function RemoveLiquidity() {
// tx sending
const addTransaction = useTransactionAdder()
const networkSupportsV2 = useNetworkSupportsV2()
async function onRemove() {
if (!chainId || !provider || !account || !deadline || !router) throw new Error('missing dependencies')
if (!chainId || !provider || !account || !deadline || !router || !networkSupportsV2) {
throw new Error('missing dependencies')
}
const { [Field.CURRENCY_A]: currencyAmountA, [Field.CURRENCY_B]: currencyAmountB } = parsedAmounts
if (!currencyAmountA || !currencyAmountB) {
throw new Error('missing currency amounts')
@ -439,6 +445,8 @@ function RemoveLiquidity() {
liquidityPercentChangeCallback
)
if (!networkSupportsV2) return <V2Unsupported />
return (
<>
<AppBody>