Skip to content

Commit

Permalink
ci(release): publish latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
hello-happy-puppy committed May 16, 2024
1 parent 2c7635f commit e79630c
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 82 deletions.
15 changes: 8 additions & 7 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IPFS hash of the deployment:
- CIDv0: `Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh`
- CIDv1: `bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a`
- CIDv0: `QmccrxuuPdXnhgCm2377DmcpBZtS36JK2kHNhGcutyYCfC`
- CIDv1: `bafybeiguflcfu2p2lxehliz5wutxlmqtjfeg7qk4pw2ifw24xbbhjhcf5m`

The latest release is always mirrored at [app.uniswap.org](https://app.uniswap.org).

Expand All @@ -10,15 +10,16 @@ You can also access the Uniswap Interface from an IPFS gateway.
Your Uniswap settings are never remembered across different URLs.

IPFS gateways:
- https://bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a.ipfs.dweb.link/
- https://bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a.ipfs.cf-ipfs.com/
- [ipfs://Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh/](ipfs://Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh/)
- https://bafybeiguflcfu2p2lxehliz5wutxlmqtjfeg7qk4pw2ifw24xbbhjhcf5m.ipfs.dweb.link/
- https://bafybeiguflcfu2p2lxehliz5wutxlmqtjfeg7qk4pw2ifw24xbbhjhcf5m.ipfs.cf-ipfs.com/
- [ipfs://QmccrxuuPdXnhgCm2377DmcpBZtS36JK2kHNhGcutyYCfC/](ipfs://QmccrxuuPdXnhgCm2377DmcpBZtS36JK2kHNhGcutyYCfC/)

### 5.27.6 (2024-05-16)
### 5.27.7 (2024-05-16)


### Bug Fixes

* **web:** Allow viewing pool mgmt pages when disconnected - prod (#8248) f7cce8f
* **web:** support multichain input params 272661d
* **web:** support multichain input params 8620c6c


2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web/5.27.6
web/5.27.7
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default memo(function CurrencySearchModal({
if (warningToken) {
content = (
<TokenSafety
tokenAddress={warningToken.address}
token0={warningToken}
onContinue={() => handleCurrencySelect(warningToken)}
onCancel={() => setModalView(CurrencyModalView.search)}
showCancel={true}
Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/components/TokenSafety/TokenSafetyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ interface TokenSafetyModalProps extends TokenSafetyProps {

export default function TokenSafetyModal({
isOpen,
tokenAddress,
secondTokenAddress,
token0,
token1,
onContinue,
onCancel,
onBlocked,
Expand All @@ -17,8 +17,8 @@ export default function TokenSafetyModal({
return (
<Modal isOpen={isOpen} onDismiss={onCancel}>
<TokenSafety
tokenAddress={tokenAddress}
secondTokenAddress={secondTokenAddress}
token0={token0}
token1={token1}
onContinue={onContinue}
onBlocked={onBlocked}
onCancel={onCancel}
Expand Down
44 changes: 17 additions & 27 deletions apps/web/src/components/TokenSafety/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
useTokenWarning,
Warning,
} from 'constants/tokenSafety'
import { useToken } from 'hooks/Tokens'
import { Trans } from 'i18n'
import { ExternalLink as LinkIconFeather } from 'react-feather'
import { Text } from 'rebass'
Expand Down Expand Up @@ -196,59 +195,50 @@ const StyledExternalLink = styled(ExternalLink)`
`

export interface TokenSafetyProps {
tokenAddress?: string
secondTokenAddress?: string
token0?: Token
token1?: Token
onContinue: () => void
onCancel: () => void
onBlocked?: () => void
showCancel?: boolean
}

export default function TokenSafety({
tokenAddress,
secondTokenAddress,
onContinue,
onCancel,
onBlocked,
showCancel,
}: TokenSafetyProps) {
export default function TokenSafety({ token0, token1, onContinue, onCancel, onBlocked, showCancel }: TokenSafetyProps) {
const logos = []
const urls = []

const token1 = useToken(tokenAddress)
const token1Warning = useTokenWarning(tokenAddress, token1?.chainId)
const token2 = useToken(secondTokenAddress)
const token2Warning = useTokenWarning(secondTokenAddress, token2?.chainId)
const token0Warning = useTokenWarning(token0?.address, token0?.chainId)
const token1Warning = useTokenWarning(token1?.address, token1?.chainId)

const token0Unsupported = !token0Warning?.canProceed
const token1Unsupported = !token1Warning?.canProceed
const token2Unsupported = !token2Warning?.canProceed

// Logic for only showing the 'unsupported' warning if one is supported and other isn't
if (token1 && token1Warning && (token1Unsupported || !(token2Warning && token2Unsupported))) {
if (token0 && token0Warning && (token0Unsupported || !(token1Warning && token1Unsupported))) {
logos.push(<CurrencyLogo key={token0.address} currency={token0} size={48} />)
urls.push(<ExplorerView token={token0} />)
}
if (token1 && token1Warning && (token1Unsupported || !(token0Warning && token0Unsupported))) {
logos.push(<CurrencyLogo key={token1.address} currency={token1} size={48} />)
urls.push(<ExplorerView token={token1} />)
}
if (token2 && token2Warning && (token2Unsupported || !(token1Warning && token1Unsupported))) {
logos.push(<CurrencyLogo key={token2.address} currency={token2} size={48} />)
urls.push(<ExplorerView token={token2} />)
}

const plural = logos.length > 1
// Show higher level warning if two are present
let displayWarning = token1Warning
if (!token1Warning || (token2Warning && token2Unsupported && !token1Unsupported)) {
displayWarning = token2Warning
let displayWarning = token0Warning
if (!token0Warning || (token1Warning && token1Unsupported && !token0Unsupported)) {
displayWarning = token1Warning
}

// If a warning is acknowledged, import these tokens
const addToken = useAddUserToken()
const acknowledge = () => {
if (token0) {
addToken(token0)
}
if (token1) {
addToken(token1)
}
if (token2) {
addToken(token2)
}
onContinue()
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Tokens/TokenDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function TDPSwapComponent() {
{warning && <TokenSafetyMessage tokenAddress={address} warning={warning} />}
<TokenSafetyModal
isOpen={openTokenSafetyModal || !!continueSwap}
tokenAddress={address}
token0={currency.isToken ? currency : undefined}
onContinue={() => onResolveSwap(true)}
onBlocked={() => {
setOpenTokenSafetyModal(false)
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/hooks/useSyncChainQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function getChainIdFromName(name: string) {
return chainId ? parseInt(chainId) : undefined
}

function getParsedChainId(parsedQs?: ParsedQs) {
export function getParsedChainId(parsedQs?: ParsedQs) {
const chain = parsedQs?.chain
if (!chain || typeof chain !== 'string') return

Expand Down Expand Up @@ -44,8 +44,8 @@ export default function useSyncChainQuery() {
const [searchParams, setSearchParams] = useSearchParams()

useEffect(() => {
// Change a user's chain on pageload if the connected chainId does not match the query param chain
if (isConnected && urlChainId && chainIdRef.current === chainId && chainId !== urlChainId) {
// Change a page chain on pageload if the app chainId does not match the query param chain
if (urlChainId && chainIdRef.current === chainId && chainId !== urlChainId) {
selectChain(urlChainId)
}
// If a user has a connected wallet and has manually changed their chain, update the query parameter if it's supported
Expand Down
29 changes: 9 additions & 20 deletions apps/web/src/pages/Swap/SwapForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ import { ArrowContainer, ArrowWrapper, OutputSwapSection, SwapSection } from 'co
import { CHAIN_INFO, useIsSupportedChainId } from 'constants/chains'
import { useIsSwapUnsupported } from 'hooks/useIsSwapUnsupported'
import { useMaxAmountIn } from 'hooks/useMaxAmountIn'
import useParsedQueryString from 'hooks/useParsedQueryString'
import usePermit2Allowance, { AllowanceState } from 'hooks/usePermit2Allowance'
import usePrevious from 'hooks/usePrevious'
import { SwapResult, useSwapCallback } from 'hooks/useSwapCallback'
import { useSwitchChain } from 'hooks/useSwitchChain'
import { useUSDPrice } from 'hooks/useUSDPrice'
import useWrapCallback, { WrapErrorText, WrapType } from 'hooks/useWrapCallback'
import { Trans } from 'i18n'
Expand All @@ -42,12 +40,7 @@ import { Text } from 'rebass'
import { useAppSelector } from 'state/hooks'
import { InterfaceTrade, RouterPreference, TradeState } from 'state/routing/types'
import { isClassicTrade } from 'state/routing/utils'
import {
queryParametersToCurrencyState,
useSwapActionHandlers,
useSwapAndLimitContext,
useSwapContext,
} from 'state/swap/hooks'
import { useSwapActionHandlers, useSwapAndLimitContext, useSwapContext } from 'state/swap/hooks'
import { useTheme } from 'styled-components'
import { ExternalLink, ThemedText } from 'theme/components'
import { maybeLogFirstSwapAction } from 'tracing/swapFlowLoggers'
Expand All @@ -61,6 +54,7 @@ import { didUserReject } from 'utils/swapErrorToUserReadableMessage'
import Error from 'components/Icons/Error'
import Row from 'components/Row'
import { useCurrencyInfo } from 'hooks/Tokens'
import useSelectChain from 'hooks/useSelectChain'
import { CurrencyState } from 'state/swap/types'
import { SafetyLevel } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks'
import { CurrencyInfo } from 'uniswap/src/features/dataApi/types'
Expand Down Expand Up @@ -88,14 +82,8 @@ export function SwapForm({ disableTokenInputs = false, onCurrencyChange }: SwapF
const { typedValue, independentField } = swapState

// token warning stuff
const parsedQs = useParsedQueryString()
const prefilledCurrencies = useMemo(() => {
return queryParametersToCurrencyState(parsedQs)
}, [parsedQs])

const prefilledInputCurrencyInfo = useCurrencyInfo(prefilledCurrencies?.inputCurrencyId, chainId)
const prefilledOutputCurrencyInfo = useCurrencyInfo(prefilledCurrencies?.outputCurrencyId, chainId)

const prefilledInputCurrencyInfo = useCurrencyInfo(prefilledState.inputCurrency)
const prefilledOutputCurrencyInfo = useCurrencyInfo(prefilledState.outputCurrency)
const [dismissTokenWarning, setDismissTokenWarning] = useState<boolean>(false)
const [showPriceImpactModal, setShowPriceImpactModal] = useState<boolean>(false)

Expand Down Expand Up @@ -463,7 +451,8 @@ export function SwapForm({ disableTokenInputs = false, onCurrencyChange }: SwapF
)

const inputCurrency = currencies[Field.INPUT] ?? undefined
const switchChain = useSwitchChain()
const selectChain = useSelectChain()

const switchingChain = useAppSelector((state) => state.wallets.switchingChain)
const targetChain = switchingChain ? switchingChain : undefined
const switchingChainIsSupported = useIsSupportedChainId(targetChain)
Expand All @@ -474,8 +463,8 @@ export function SwapForm({ disableTokenInputs = false, onCurrencyChange }: SwapF
<>
<TokenSafetyModal
isOpen={urlTokensNotInDefault.length > 0 && !dismissTokenWarning}
tokenAddress={urlTokensNotInDefault[0]?.address}
secondTokenAddress={urlTokensNotInDefault[1]?.address}
token0={urlTokensNotInDefault[0]}
token1={urlTokensNotInDefault[1]}
onContinue={handleConfirmTokenWarning}
onCancel={handleDismissTokenWarning}
showCancel={true}
Expand Down Expand Up @@ -624,7 +613,7 @@ export function SwapForm({ disableTokenInputs = false, onCurrencyChange }: SwapF
$borderRadius="16px"
onClick={async () => {
try {
await switchChain(chainId)
await selectChain(chainId)
} catch (error) {
if (didUserReject(error)) {
// Ignore error, which keeps the user on the previous chain.
Expand Down
21 changes: 5 additions & 16 deletions apps/web/src/pages/Swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ import SwapHeader from 'components/swap/SwapHeader'
import { SwapTab } from 'components/swap/constants'
import { PageWrapper, SwapWrapper } from 'components/swap/styled'
import { useSupportedChainId } from 'constants/chains'
import { useCurrency } from 'hooks/Tokens'
import useParsedQueryString from 'hooks/useParsedQueryString'
import { useScreenSize } from 'hooks/useScreenSize'
import { SendForm } from 'pages/Swap/Send/SendForm'
import { ReactNode, useMemo } from 'react'
import { ReactNode } from 'react'
import { useLocation } from 'react-router-dom'
import { InterfaceTrade, TradeState } from 'state/routing/types'
import { isPreviewTrade } from 'state/routing/utils'
import { SwapAndLimitContextProvider, SwapContextProvider } from 'state/swap/SwapContext'
import { queryParametersToCurrencyState } from 'state/swap/hooks'
import { useInitialCurrencyState } from 'state/swap/hooks'
import { CurrencyState, SwapAndLimitContext } from 'state/swap/types'
import { useChainId } from 'wagmi'

import { useIsDarkMode } from '../../theme/components/ThemeToggle'
import { LimitFormWrapper } from './Limit/LimitForm'
import { SwapForm } from './SwapForm'
Expand All @@ -39,24 +36,16 @@ export function getIsReviewableQuote(
export default function SwapPage({ className }: { className?: string }) {
const location = useLocation()

const supportedChainId = useSupportedChainId(useChainId())
const chainId = supportedChainId || ChainId.MAINNET

const parsedQs = useParsedQueryString()
const parsedCurrencyState = useMemo(() => {
return queryParametersToCurrencyState(parsedQs)
}, [parsedQs])

const initialInputCurrency = useCurrency(parsedCurrencyState.inputCurrencyId, chainId)
const initialOutputCurrency = useCurrency(parsedCurrencyState.outputCurrencyId, chainId)
const { initialInputCurrency, initialOutputCurrency, chainId } = useInitialCurrencyState()
const shouldDisableTokenInputs = useSupportedChainId(useChainId()) === undefined

return (
<Trace page={InterfacePageName.SWAP_PAGE} shouldLogImpression>
<PageWrapper>
<Swap
className={className}
chainId={chainId}
disableTokenInputs={supportedChainId === undefined}
disableTokenInputs={shouldDisableTokenInputs}
initialInputCurrency={initialInputCurrency}
initialOutputCurrency={initialOutputCurrency}
syncTabToUrl={true}
Expand Down
29 changes: 27 additions & 2 deletions apps/web/src/state/swap/hooks.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core'
import { ChainId, Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { Field } from 'components/swap/constants'
import useAutoSlippageTolerance from 'hooks/useAutoSlippageTolerance'
Expand All @@ -13,9 +13,13 @@ import { isClassicTrade, isSubmittableTrade, isUniswapXTrade } from 'state/routi
import { useUserSlippageToleranceWithDefault } from 'state/user/hooks'
import { isAddress } from 'utilities/src/addresses'

import { useSupportedChainId } from 'constants/chains'
import { useCurrency } from 'hooks/Tokens'
import useParsedQueryString from 'hooks/useParsedQueryString'
import { getParsedChainId } from 'hooks/useSyncChainQuery'
import useNativeCurrency from 'lib/hooks/useNativeCurrency'
import { InterfaceTrade, RouterPreference, TradeState } from 'state/routing/types'
import { useAccount } from 'wagmi'
import { useAccount, useChainId } from 'wagmi'
import { useCurrencyBalance, useCurrencyBalances } from '../connection/hooks'
import {
CurrencyState,
Expand Down Expand Up @@ -280,6 +284,7 @@ export function queryParametersToCurrencyState(parsedQs: ParsedQs): SerializedCu
let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency ?? parsedQs.inputcurrency)
let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency ?? parsedQs.outputcurrency)
const independentField = parseIndependentFieldURLParameter(parsedQs.exactField)
const chainId = getParsedChainId(parsedQs)

if (inputCurrency === '' && outputCurrency === '' && independentField === Field.INPUT) {
// Defaults to having the native currency selected
Expand All @@ -292,5 +297,25 @@ export function queryParametersToCurrencyState(parsedQs: ParsedQs): SerializedCu
return {
inputCurrencyId: inputCurrency === '' ? undefined : inputCurrency ?? undefined,
outputCurrencyId: outputCurrency === '' ? undefined : outputCurrency ?? undefined,
chainId,
}
}

export function useInitialCurrencyState(): {
initialInputCurrency?: Currency
initialOutputCurrency?: Currency
chainId: ChainId
} {
const parsedQs = useParsedQueryString()
const parsedCurrencyState = useMemo(() => {
return queryParametersToCurrencyState(parsedQs)
}, [parsedQs])

const connectedChainId = useChainId()
const chainId = useSupportedChainId(parsedCurrencyState.chainId ?? connectedChainId) ?? ChainId.MAINNET

const initialInputCurrency = useCurrency(parsedCurrencyState.inputCurrencyId, chainId)
const initialOutputCurrency = useCurrency(parsedCurrencyState.outputCurrencyId, chainId)

return { initialInputCurrency, initialOutputCurrency, chainId }
}
1 change: 1 addition & 0 deletions apps/web/src/state/swap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const SwapAndLimitContext = createContext<SwapAndLimitContextType>({
export interface SerializedCurrencyState {
inputCurrencyId?: string
outputCurrencyId?: string
chainId?: number
}

// shared state between Swap and Limit
Expand Down

0 comments on commit e79630c

Please sign in to comment.