Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
2c7635f6
Commit
2c7635f6
authored
May 16, 2024
by
Uniswap Labs Service Account
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ci(release): publish latest release
parent
764fb94b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
20 deletions
+37
-20
RELEASE
RELEASE
+7
-7
VERSION
VERSION
+1
-1
useContract.ts
apps/web/src/hooks/useContract.ts
+17
-6
useEthersProvider.ts
apps/web/src/hooks/useEthersProvider.ts
+7
-6
SwapContext.test.tsx
apps/web/src/state/swap/SwapContext.test.tsx
+5
-0
No files found.
RELEASE
View file @
2c7635f6
IPFS hash of the deployment:
- CIDv0: `Qm
VRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy
`
- CIDv1: `bafybei
djiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai
`
- CIDv0: `Qm
ba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh
`
- CIDv1: `bafybei
getwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a
`
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.
Your Uniswap settings are never remembered across different URLs.
IPFS gateways:
- https://bafybei
djiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai
.ipfs.dweb.link/
- https://bafybei
djiiinp4v64dyircmic5w3lti4sj7e6jd37siispbgtytxx37gai
.ipfs.cf-ipfs.com/
- [ipfs://Qm
VRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy/](ipfs://QmVRXws3RJsdKSH89DSpmN8hFzfjAiJYjXCwdG7Q7g2sSy
/)
- https://bafybei
getwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a
.ipfs.dweb.link/
- https://bafybei
getwjqz26or3og65klvf2oefze44ct4oukkncojpcb5wocbc6x7a
.ipfs.cf-ipfs.com/
- [ipfs://Qm
ba9yfwsUsVcbQA6CAkQCxqFCoLJapvjV7RQsp26zJvBh/](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) 93d8a0
f
* **web:**
Allow viewing pool mgmt pages when disconnected - prod (#8248) f7cce8
f
VERSION
View file @
2c7635f6
web/5.27.5
\ No newline at end of file
web/5.27.6
\ No newline at end of file
apps/web/src/hooks/useContract.ts
View file @
2c7635f6
...
...
@@ -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
'
...
...
@@ -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
{
use
Account
,
use
ChainId
}
from
'
wagmi
'
const
{
abi
:
IUniswapV2PairABI
}
=
IUniswapV2PairJson
const
{
abi
:
IUniswapV2Router02ABI
}
=
IUniswapV2Router02Json
...
...
@@ -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
[
c
hainId
]
else
address
=
addressOrAddressMap
[
account
.
chainId
??
disconnectedC
hainId
]
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
{
...
...
apps/web/src/hooks/useEthersProvider.ts
View file @
2c7635f6
import
{
Web3Provider
}
from
'
@ethersproject/providers
'
import
{
useMemo
}
from
'
react
'
import
type
{
Chain
,
Client
,
Transport
}
from
'
viem
'
import
{
Config
,
useConnectorClient
}
from
'
wagmi
'
import
{
Config
,
useC
lient
,
useC
onnectorClient
}
from
'
wagmi
'
const
providers
=
new
WeakMap
<
Client
,
Web3Provider
>
()
...
...
@@ -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
])
}
apps/web/src/state/swap/SwapContext.test.tsx
View file @
2c7635f6
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment