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 764fb94 commit 2c7635f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
14 changes: 7 additions & 7 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
IPFS hash of the deployment:
- CIDv0: `QmVRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy`
- CIDv1: `bafybeidjiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai`
- CIDv0: `Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh`
- CIDv1: `bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a`

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://bafybeidjiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai.ipfs.dweb.link/
- https://bafybeidjiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai.ipfs.cf-ipfs.com/
- [ipfs://QmVRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy/](ipfs://QmVRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy/)
- https://bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a.ipfs.dweb.link/
- https://bafybeigetwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a.ipfs.cf-ipfs.com/
- [ipfs://Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh/](ipfs://Qmba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh/)

### 5.27.5 (2024-05-15)
### 5.27.6 (2024-05-16)


### Bug Fixes

* **web:** check for supported network on pools page - prod (#8226) 93d8a0f
* **web:** Allow viewing pool mgmt pages when disconnected - prod (#8248) f7cce8f


2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web/5.27.5
web/5.27.6
23 changes: 17 additions & 6 deletions apps/web/src/hooks/useContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useWeb3React } from '@web3-react/core'
import { sendAnalyticsEvent } from 'analytics'
import { RPC_PROVIDERS } from 'constants/providers'
import { WRAPPED_NATIVE_CURRENCY } from 'constants/tokens'
import { useEthersProvider } from 'hooks/useEthersProvider'
import { useEffect, useMemo } from 'react'
import ARGENT_WALLET_DETECTOR_ABI from 'uniswap/src/abis/argent-wallet-detector.json'
import EIP_2612 from 'uniswap/src/abis/eip_2612.json'
Expand All @@ -40,7 +41,7 @@ import { NonfungiblePositionManager, UniswapInterfaceMulticall } from 'uniswap/s
import { V3Migrator } from 'uniswap/src/abis/types/v3/V3Migrator'
import WETH_ABI from 'uniswap/src/abis/weth.json'
import { getContract } from 'utilities/src/contracts/getContract'
import { useChainId } from 'wagmi'
import { useAccount, useChainId } from 'wagmi'

const { abi: IUniswapV2PairABI } = IUniswapV2PairJson
const { abi: IUniswapV2Router02ABI } = IUniswapV2Router02Json
Expand All @@ -54,21 +55,31 @@ export function useContract<T extends Contract = Contract>(
ABI: any,
withSignerIfPossible = true
): T | null {
const { provider, account, chainId } = useWeb3React()
const account = useAccount()
const disconnectedChainId = useChainId()
const provider = useEthersProvider()

return useMemo(() => {
if (!addressOrAddressMap || !ABI || !provider || !chainId) return null
if (!addressOrAddressMap || !ABI || !provider) return null
let address: string | undefined
if (typeof addressOrAddressMap === 'string') address = addressOrAddressMap
else address = addressOrAddressMap[chainId]
else address = addressOrAddressMap[account.chainId ?? disconnectedChainId]
if (!address) return null
try {
return getContract(address, ABI, provider, withSignerIfPossible && account ? account : undefined)
return getContract(address, ABI, provider, withSignerIfPossible && account.address ? account.address : undefined)
} catch (error) {
console.error('Failed to get contract', error)
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 {
Expand Down
13 changes: 7 additions & 6 deletions apps/web/src/hooks/useEthersProvider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Web3Provider } from '@ethersproject/providers'
import { useMemo } from 'react'
import type { Chain, Client, Transport } from 'viem'
import { Config, useConnectorClient } from 'wagmi'
import { Config, useClient, useConnectorClient } from 'wagmi'

const providers = new WeakMap<Client, Web3Provider>()

Expand All @@ -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 } = {}) {
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 } = {}) {
const provider = useEthersProvider({ chainId })
return useMemo(() => (provider instanceof Web3Provider ? provider : undefined), [provider])
const { data: client } = useConnectorClient<Config>({ chainId })
return useMemo(() => clientToProvider(client, chainId), [chainId, client])
}
5 changes: 5 additions & 0 deletions apps/web/src/state/swap/SwapContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { useSwapAndLimitContext, useSwapContext } from 'state/swap/hooks'
import { SwapAndLimitContext, SwapInfo } from 'state/swap/types'
import { SwapAndLimitContextProvider, SwapContextProvider } from './SwapContext'

jest.mock('hooks/useContract', () => ({
...jest.requireActual('hooks/useContract'),
useContract: jest.fn(),
}))

describe('Swap Context', () => {
test('should use context', () => {
let swapContext
Expand Down

0 comments on commit 2c7635f

Please sign in to comment.