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 Jun 14, 2024
1 parent aa949db commit 5c039dc
Show file tree
Hide file tree
Showing 28 changed files with 191 additions and 267 deletions.
16 changes: 8 additions & 8 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IPFS hash of the deployment:
- CIDv0: `QmWqSfbLDY22q6duTWFocMGoy317SVW13YLpc1yrkrHoeJ`
- CIDv1: `bafybeid6hw4k6jbgyrrwnqtzrgszxdpwotrphjy2nys4mssjakpzbsbztm`
- CIDv0: `QmSx41VP5fQ6sZTMUmtCBn74MEsfmxA1Y7X6jNw7CLMJyx`
- CIDv1: `bafybeiceqbv4zz2qxq34hgptfzhv7bbtfzif2cdqnn4hpc23vsbcbn6w7m`

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

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

IPFS gateways:
- https://bafybeid6hw4k6jbgyrrwnqtzrgszxdpwotrphjy2nys4mssjakpzbsbztm.ipfs.dweb.link/
- https://bafybeid6hw4k6jbgyrrwnqtzrgszxdpwotrphjy2nys4mssjakpzbsbztm.ipfs.cf-ipfs.com/
- [ipfs://QmWqSfbLDY22q6duTWFocMGoy317SVW13YLpc1yrkrHoeJ/](ipfs://QmWqSfbLDY22q6duTWFocMGoy317SVW13YLpc1yrkrHoeJ/)
- https://bafybeiceqbv4zz2qxq34hgptfzhv7bbtfzif2cdqnn4hpc23vsbcbn6w7m.ipfs.dweb.link/
- https://bafybeiceqbv4zz2qxq34hgptfzhv7bbtfzif2cdqnn4hpc23vsbcbn6w7m.ipfs.cf-ipfs.com/
- [ipfs://QmSx41VP5fQ6sZTMUmtCBn74MEsfmxA1Y7X6jNw7CLMJyx/](ipfs://QmSx41VP5fQ6sZTMUmtCBn74MEsfmxA1Y7X6jNw7CLMJyx/)

## 5.35.0 (2024-06-13)
### 5.35.1 (2024-06-14)


### Features
### Bug Fixes

* **web:** Add ZKsync - prod (#9083) 90c6c69
* **web:** Revert 8059 fallback to gql (token balances) - prod (#9094) 8ce2c94


2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web/5.35.0
web/5.35.1
18 changes: 0 additions & 18 deletions apps/web/cypress/e2e/swap/swap.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SwapEventName } from '@uniswap/analytics-events'
import { ChainId } from '@uniswap/sdk-core'

import { FeatureFlags } from 'uniswap/src/features/gating/flags'
import { UNI, USDC_MAINNET } from '../../../src/constants/tokens'
import { getBalance, getTestSelector } from '../../utils'

Expand Down Expand Up @@ -101,22 +100,5 @@ describe('Swap', () => {
getBalance(USDC_MAINNET).should('eq', finalBalance)
})
})
describe('multichain balances', () => {
it('shows balances for disconnected chains', () => {
cy.hardhat().then((hardhat) => {
cy.visit('/swap', {
featureFlags: [{ flag: FeatureFlags.MultichainUX, value: true }],
})

cy.get('#swap-currency-input .open-currency-select-button').click()
cy.get(getTestSelector('chain-selector')).last().click()
cy.contains('Arbitrum').click()
const sendSpy = cy.spy(hardhat.provider, 'send')
cy.wrap(sendSpy).should('not.be.calledWith', 'wallet_switchEthereumChain')
cy.get(getTestSelector('common-base-USDC')).click()
cy.get('#swap-currency-input').contains(`Balance: 0.002`)
})
})
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ const SwapCurrencyInputPanel = forwardRef<HTMLInputElement, SwapCurrencyInputPan
const account = useAccount()
const { chainId } = useSwapAndLimitContext()
const chainAllowed = useIsSupportedChainId(chainId)
const selectedCurrencyBalance = useCurrencyBalance(account.address, currency ?? undefined, chainId)
const selectedCurrencyBalance = useCurrencyBalance(account.address, currency ?? undefined)
const theme = useTheme()
const { formatCurrencyAmount } = useFormatter()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ it('renders currency rows correctly with balances', () => {
isAddressSearch=""
showCurrencyAmount
balances={{
[`1-${DAI.address.toLowerCase()}`]: { usdValue: 2, balance: 2 },
[DAI.address.toLowerCase()]: { usdValue: 2, balance: 2 },
}}
/>
)
Expand Down
18 changes: 9 additions & 9 deletions apps/web/src/components/SearchModal/CurrencyList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { ThemedText } from 'theme/components'
import Trace from 'uniswap/src/features/telemetry/Trace'
import { WalletEventName } from 'uniswap/src/features/telemetry/constants'
import { shortenAddress } from 'utilities/src/addresses'
import { currencyKey } from 'utils/currencyKey'
import { NumberType, useFormatter } from 'utils/formatNumbers'
import { useIsUserAddedToken } from '../../../hooks/Tokens'
import { TokenFromList } from '../../../state/lists/tokenFromList'
Expand All @@ -26,16 +25,16 @@ import { MouseoverTooltip, TooltipSize } from '../../Tooltip'
import { LoadingRows, MenuItem } from '../styled'
import { scrollbarStyle } from './index.css'

function currencyListRowKey(data: Currency | CurrencyListRow): string {
function currencyKey(data: Currency | CurrencyListRow): string {
if (data instanceof CurrencyListSectionTitle) {
return data.label
}

if (data instanceof CurrencyListRow) {
return currencyKey(data.currency!)
return data.currency?.isToken ? data.currency.address : 'ETHER'
}

return currencyKey(data)
return data.isToken ? data.address : 'ETHER'
}

const ROW_ITEM_SIZE = 56
Expand Down Expand Up @@ -156,7 +155,7 @@ export function CurrencyRow({
showAddress?: boolean
}) {
const account = useAccount()
const key = currencyListRowKey(currency)
const key = currencyKey(currency)
const customAdded = useIsUserAddedToken(currency)
const warning = useTokenWarning(currency?.isNative ? undefined : currency?.address, currency.chainId)
const isBlockedToken = !!warning && !warning.canProceed
Expand Down Expand Up @@ -327,11 +326,12 @@ export default function CurrencyList({
}

const currency: Currency = row.currency
const key = currencyKey(currency)

const balance =
tryParseCurrencyAmount(String(balances[key]?.balance ?? 0), currency) ??
CurrencyAmount.fromRawAmount(currency, 0)
tryParseCurrencyAmount(
String(balances[currency.isNative ? 'ETH' : currency.address?.toLowerCase()]?.balance ?? 0),
currency
) ?? CurrencyAmount.fromRawAmount(currency, 0)

const isSelected = Boolean(currency && selectedCurrency && selectedCurrency.equals(currency))
const otherSelected = Boolean(currency && otherCurrency && otherCurrency.equals(currency))
Expand Down Expand Up @@ -375,7 +375,7 @@ export default function CurrencyList({

const itemKey = useCallback((index: number, data: typeof currencies) => {
const currency = data[index]
return currencyListRowKey(currency)
return currencyKey(currency)
}, [])

return (
Expand Down
9 changes: 6 additions & 3 deletions apps/web/src/components/SearchModal/CurrencySearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { isAddress } from 'utilities/src/addresses'

import { useAccount } from 'hooks/useAccount'
import { useSwapAndLimitContext } from 'state/swap/hooks'
import { currencyKey } from 'utils/currencyKey'
import Column from '../Column'
import Row, { RowBetween } from '../Row'
import CommonBases from './CommonBases'
Expand Down Expand Up @@ -225,8 +224,12 @@ export function CurrencySearch({
isAddressSearch
)}
balance={
tryParseCurrencyAmount(String(balanceMap[currencyKey(searchCurrency)]?.balance ?? 0), searchCurrency) ??
CurrencyAmount.fromRawAmount(searchCurrency, 0)
tryParseCurrencyAmount(
String(
balanceMap[searchCurrency.isNative ? 'ETH' : searchCurrency.address?.toLowerCase()]?.balance ?? 0
),
searchCurrency
) ?? CurrencyAmount.fromRawAmount(searchCurrency, 0)
}
/>
</Column>
Expand Down
15 changes: 8 additions & 7 deletions apps/web/src/components/SearchModal/useCurrencySearchResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
useTopTokensQuery,
} from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks'
import { isSameAddress } from 'utilities/src/addresses'
import { currencyKey } from 'utils/currencyKey'

interface CurrencySearchParams {
searchQuery?: string
Expand Down Expand Up @@ -141,8 +140,11 @@ export function useCurrencySearchResults({

// Filter out tokens with balances so they aren't duplicated when we merge below.
const filteredListTokens = fullBaseList.filter((token) => {
const key = currencyKey(token)
return !(key in balanceMap)
if (token.isNative) {
return !((token.symbol ?? 'ETH') in balanceMap)
} else {
return !(token.address?.toLowerCase() in balanceMap)
}
})

if (balancesLoading) {
Expand All @@ -162,13 +164,12 @@ export function useCurrencySearchResults({
// This is where we apply extra filtering based on the callsite's
// customization, on top of the basic searchQuery filtering.
const currencyFilter = (currency: Currency) => {
const key = currencyKey(currency)
if (filters?.onlyShowCurrenciesWithBalance) {
if (currency.isNative) {
return balanceMap[key]?.usdValue > 0
return balanceMap[currency.symbol ?? 'ETH']?.usdValue > 0
}

return balanceMap[key]?.usdValue > 0
return balanceMap[currency.address?.toLowerCase()]?.usdValue > 0
}

if (currency.isNative && filters?.disableNonToken) {
Expand All @@ -180,7 +181,7 @@ export function useCurrencySearchResults({
if (selectedCurrency?.equals(currency) || otherSelectedCurrency?.equals(currency)) {
return true
}
return balanceMap[key]?.usdValue > 0
return balanceMap[currency.address.toLowerCase()]?.usdValue > 0
}

return true
Expand Down
5 changes: 2 additions & 3 deletions apps/web/src/components/vote/DelegateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import { ReactNode, useState } from 'react'
import { X } from 'react-feather'
import styled from 'styled-components'
import { ThemedText } from 'theme/components'
import { formatCurrencyAmount } from 'utils/formatCurrencyAmount'

import { useTokenBalance } from 'lib/hooks/useCurrencyBalance'
import { Text } from 'ui/src'
import { logger } from 'utilities/src/logger/logger'
import { formatCurrencyAmount } from 'utils/formatCurrencyAmount'
import { UNI } from '../../constants/tokens'
import useENS from '../../hooks/useENS'
import { useTokenBalance } from '../../state/connection/hooks'
import { useDelegateCallback } from '../../state/governance/hooks'
import AddressInputPanel from '../AddressInputPanel'
import { ButtonPrimary } from '../Button'
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/hooks/useSocksBalance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChainId, SOCKS_CONTROLLER_ADDRESSES, Token } from '@uniswap/sdk-core'
import { useAccount } from 'hooks/useAccount'
import { useTokenBalance } from 'lib/hooks/useCurrencyBalance'
import { useMemo } from 'react'
import { useTokenBalance } from 'state/connection/hooks'

// technically a 721, not an ERC20, but suffices for our purposes
const SOCKS = new Token(ChainId.MAINNET, SOCKS_CONTROLLER_ADDRESSES[ChainId.MAINNET], 0)
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/hooks/useTokenBalances.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ describe('useTokenBalances', () => {
} as any)
const { balanceMap, loading } = renderHook(() => useTokenBalances()).result.current
expect(balanceMap).toEqual({
'1-0x123': {
'0x123': {
balance: 123,
usdValue: 123,
},
'1-native': {
ETH: {
balance: 123,
usdValue: 123,
},
Expand Down
38 changes: 18 additions & 20 deletions apps/web/src/hooks/useTokenBalances.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
import { useTokenBalancesQuery } from 'graphql/data/apollo/TokenBalancesProvider'
import { supportedChainIdFromGQLChain } from 'graphql/data/util'
import { useAccount } from 'hooks/useAccount'
import { TokenBalances } from 'lib/hooks/useTokenList/sorting'
import { useMemo } from 'react'
import { PortfolioTokenBalancePartsFragment } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks'
import { currencyKeyFromGraphQL } from 'utils/currencyKey'

/**
* Returns the user's token balances via graphql as a map and list.
*/
export function useTokenBalances({ cacheOnly }: { cacheOnly?: boolean } = {}): {
export function useTokenBalances(): {
balanceMap: TokenBalances
balanceList: readonly (PortfolioTokenBalancePartsFragment | undefined)[]
loading: boolean
} {
const { data, loading } = useTokenBalancesQuery({ cacheOnly })
const { chainId } = useAccount()
const { data, loading } = useTokenBalancesQuery()
return useMemo(() => {
const balanceList = data?.portfolios?.[0]?.tokenBalances ?? []
const balanceMap =
balanceList?.reduce((balanceMap, tokenBalance) => {
if (!tokenBalance?.token) {
return balanceMap
}

const key = currencyKeyFromGraphQL({
address: tokenBalance.token.address,
chain: tokenBalance.token.chain,
standard: tokenBalance.token.standard,
})
if (tokenBalance.denominatedValue?.value !== undefined) {
const usdValue = tokenBalance.denominatedValue?.value
const balance = tokenBalance.quantity
balanceMap[key] = { usdValue, balance: balance ?? 0 }
const address =
tokenBalance?.token?.standard === 'ERC20'
? tokenBalance.token?.address?.toLowerCase()
: tokenBalance?.token?.symbol ?? 'ETH'
if (
tokenBalance?.token?.chain &&
supportedChainIdFromGQLChain(tokenBalance.token?.chain) === chainId &&
address
) {
const usdValue = tokenBalance.denominatedValue?.value ?? 0
const balance = tokenBalance.quantity ?? 0
balanceMap[address] = { usdValue, balance }
}
return balanceMap
}, {} as TokenBalances) ?? {}
return { balanceMap, balanceList, loading }
}, [data?.portfolios, loading])
}, [chainId, data?.portfolios, loading])
}
Loading

0 comments on commit 5c039dc

Please sign in to comment.