ci(release): publish latest release

parent 764fb94b
IPFS hash of the deployment: IPFS hash of the deployment:
- CIDv0: `QmVRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy` - CIDv0: `Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh`
- CIDv1: `bafybeidjiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai` - CIDv1: `bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a`
The latest release is always mirrored at [app.uniswap.org](https://app.uniswap.org). The latest release is always mirrored at [app.uniswap.org](https://app.uniswap.org).
...@@ -10,15 +10,15 @@ You can also access the Uniswap Interface from an IPFS gateway. ...@@ -10,15 +10,15 @@ You can also access the Uniswap Interface from an IPFS gateway.
Your Uniswap settings are never remembered across different URLs. Your Uniswap settings are never remembered across different URLs.
IPFS gateways: IPFS gateways:
- https://bafybeidjiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai.ipfs.dweb.link/ - https://bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a.ipfs.dweb.link/
- https://bafybeidjiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai.ipfs.cf-ipfs.com/ - https://bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a.ipfs.cf-ipfs.com/
- [ipfs://QmVRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy/](ipfs://QmVRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy/) - [ipfs://Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh/](ipfs://Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh/)
### 5.27.5 (2024-05-15) ### 5.27.6 (2024-05-16)
### Bug Fixes ### Bug Fixes
* **web:** check for supported network on pools page - prod (#8226) 93d8a0f * **web:** Allow viewing pool mgmt pages when disconnected - prod (#8248) f7cce8f
web/5.27.5 web/5.27.6
\ No newline at end of file \ No newline at end of file
...@@ -18,6 +18,7 @@ import { useWeb3React } from '@web3-react/core' ...@@ -18,6 +18,7 @@ import { useWeb3React } from '@web3-react/core'
import { sendAnalyticsEvent } from 'analytics' import { sendAnalyticsEvent } from 'analytics'
import { RPC_PROVIDERS } from 'constants/providers' import { RPC_PROVIDERS } from 'constants/providers'
import { WRAPPED_NATIVE_CURRENCY } from 'constants/tokens' import { WRAPPED_NATIVE_CURRENCY } from 'constants/tokens'
import { useEthersProvider } from 'hooks/useEthersProvider'
import { useEffect, useMemo } from 'react' import { useEffect, useMemo } from 'react'
import ARGENT_WALLET_DETECTOR_ABI from 'uniswap/src/abis/argent-wallet-detector.json' import ARGENT_WALLET_DETECTOR_ABI from 'uniswap/src/abis/argent-wallet-detector.json'
import EIP_2612 from 'uniswap/src/abis/eip_2612.json' import EIP_2612 from 'uniswap/src/abis/eip_2612.json'
...@@ -40,7 +41,7 @@ import { NonfungiblePositionManager, UniswapInterfaceMulticall } from 'uniswap/s ...@@ -40,7 +41,7 @@ import { NonfungiblePositionManager, UniswapInterfaceMulticall } from 'uniswap/s
import { V3Migrator } from 'uniswap/src/abis/types/v3/V3Migrator' import { V3Migrator } from 'uniswap/src/abis/types/v3/V3Migrator'
import WETH_ABI from 'uniswap/src/abis/weth.json' import WETH_ABI from 'uniswap/src/abis/weth.json'
import { getContract } from 'utilities/src/contracts/getContract' import { getContract } from 'utilities/src/contracts/getContract'
import { useChainId } from 'wagmi' import { useAccount, useChainId } from 'wagmi'
const { abi: IUniswapV2PairABI } = IUniswapV2PairJson const { abi: IUniswapV2PairABI } = IUniswapV2PairJson
const { abi: IUniswapV2Router02ABI } = IUniswapV2Router02Json const { abi: IUniswapV2Router02ABI } = IUniswapV2Router02Json
...@@ -54,21 +55,31 @@ export function useContract<T extends Contract = Contract>( ...@@ -54,21 +55,31 @@ export function useContract<T extends Contract = Contract>(
ABI: any, ABI: any,
withSignerIfPossible = true withSignerIfPossible = true
): T | null { ): T | null {
const { provider, account, chainId } = useWeb3React() const account = useAccount()
const disconnectedChainId = useChainId()
const provider = useEthersProvider()
return useMemo(() => { return useMemo(() => {
if (!addressOrAddressMap || !ABI || !provider || !chainId) return null if (!addressOrAddressMap || !ABI || !provider) return null
let address: string | undefined let address: string | undefined
if (typeof addressOrAddressMap === 'string') address = addressOrAddressMap if (typeof addressOrAddressMap === 'string') address = addressOrAddressMap
else address = addressOrAddressMap[chainId] else address = addressOrAddressMap[account.chainId ?? disconnectedChainId]
if (!address) return null if (!address) return null
try { try {
return getContract(address, ABI, provider, withSignerIfPossible && account ? account : undefined) return getContract(address, ABI, provider, withSignerIfPossible && account.address ? account.address : undefined)
} catch (error) { } catch (error) {
console.error('Failed to get contract', error) console.error('Failed to get contract', error)
return null return null
} }
}, [addressOrAddressMap, ABI, provider, chainId, withSignerIfPossible, account]) as T }, [
addressOrAddressMap,
ABI,
provider,
account.chainId,
account.address,
disconnectedChainId,
withSignerIfPossible,
]) as T
} }
function useMainnetContract<T extends Contract = Contract>(address: string | undefined, ABI: any): T | null { function useMainnetContract<T extends Contract = Contract>(address: string | undefined, ABI: any): T | null {
......
import { Web3Provider } from '@ethersproject/providers' import { Web3Provider } from '@ethersproject/providers'
import { useMemo } from 'react' import { useMemo } from 'react'
import type { Chain, Client, Transport } from 'viem' import type { Chain, Client, Transport } from 'viem'
import { Config, useConnectorClient } from 'wagmi' import { Config, useClient, useConnectorClient } from 'wagmi'
const providers = new WeakMap<Client, Web3Provider>() const providers = new WeakMap<Client, Web3Provider>()
...@@ -28,14 +28,15 @@ function clientToProvider(client?: Client<Transport, Chain>, chainId?: number) { ...@@ -28,14 +28,15 @@ function clientToProvider(client?: Client<Transport, Chain>, chainId?: number) {
} }
} }
/** Hook to convert a viem Client to an ethers.js Provider. */ /** Hook to convert a viem Client to an ethers.js Provider with a default disconnected Network fallback. */
export function useEthersProvider({ chainId }: { chainId?: number } = {}) { export function useEthersProvider({ chainId }: { chainId?: number } = {}) {
const { data: client } = useConnectorClient<Config>({ chainId }) const { data: client } = useConnectorClient<Config>({ chainId })
return useMemo(() => clientToProvider(client, chainId), [chainId, client]) const disconnectedClient = useClient<Config>({ chainId })
return useMemo(() => clientToProvider(client ?? disconnectedClient, chainId), [chainId, client, disconnectedClient])
} }
/** Hook to convert a viem Client to an ethers.js Provider. */ /** Hook to convert a connected viem Client to an ethers.js Provider. */
export function useEthersWeb3Provider({ chainId }: { chainId?: number } = {}) { export function useEthersWeb3Provider({ chainId }: { chainId?: number } = {}) {
const provider = useEthersProvider({ chainId }) const { data: client } = useConnectorClient<Config>({ chainId })
return useMemo(() => (provider instanceof Web3Provider ? provider : undefined), [provider]) return useMemo(() => clientToProvider(client, chainId), [chainId, client])
} }
...@@ -7,6 +7,11 @@ import { useSwapAndLimitContext, useSwapContext } from 'state/swap/hooks' ...@@ -7,6 +7,11 @@ import { useSwapAndLimitContext, useSwapContext } from 'state/swap/hooks'
import { SwapAndLimitContext, SwapInfo } from 'state/swap/types' import { SwapAndLimitContext, SwapInfo } from 'state/swap/types'
import { SwapAndLimitContextProvider, SwapContextProvider } from './SwapContext' import { SwapAndLimitContextProvider, SwapContextProvider } from './SwapContext'
jest.mock('hooks/useContract', () => ({
...jest.requireActual('hooks/useContract'),
useContract: jest.fn(),
}))
describe('Swap Context', () => { describe('Swap Context', () => {
test('should use context', () => { test('should use context', () => {
let swapContext let swapContext
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment