fix: uniswap_wallet -> uniwallet (#6764)

* fix: uniswap_wallet -> uniwallet

update tests

Revert "fix: uniswap_wallet -> uniwallet"

This reverts commit 7bdf34b33025d0b564c5870b073eb20e3d1774e1.

Revert "update tests"

This reverts commit cc841cb5e01a1a239f79fa4d9d480e6479128f08.

add migration

* refactor: add deprecated value back to enum (#6768)

* add deprecated value back to enum

* Update src/connection/types.ts

Co-authored-by: Zach Pomerantz <zzmp@uniswap.org>

---------

Co-authored-by: Charles Bachmeier <charlie@genie.xyz>
Co-authored-by: Zach Pomerantz <zzmp@uniswap.org>

* add deprecated case to getConnection

---------

Co-authored-by: Charles Bachmeier <charles@bachmeier.io>
Co-authored-by: Charles Bachmeier <charlie@genie.xyz>
Co-authored-by: Zach Pomerantz <zzmp@uniswap.org>
This commit is contained in:
Jordan Frankfurt 2023-06-14 18:16:12 -05:00 committed by GitHub
parent e69a7c2712
commit 7a3c51bc90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

@ -173,6 +173,7 @@ export function getConnection(c: Connector | ConnectionType) {
return walletConnectConnection
case ConnectionType.WALLET_CONNECT_V2:
return walletConnectV2Connection
case ConnectionType.UNIWALLET:
case ConnectionType.UNISWAP_WALLET:
return uniwalletConnectConnection
case ConnectionType.NETWORK:

@ -3,6 +3,8 @@ import { Connector } from '@web3-react/types'
export enum ConnectionType {
UNISWAP_WALLET = 'UNISWAP_WALLET',
/** @deprecated - Use {@link UNISWAP_WALLET} instead. */
UNIWALLET = 'UNIWALLET',
INJECTED = 'INJECTED',
COINBASE_WALLET = 'COINBASE_WALLET',
WALLET_CONNECT = 'WALLET_CONNECT',

@ -131,6 +131,11 @@ const userSlice = createSlice({
// for all existing users with a previous version of the state in their localStorage.
// In order to avoid this, we need to set a default value for each new property manually during hydration.
builder.addCase(updateVersion, (state) => {
// If `selectedWallet` is ConnectionType.UNI_WALLET (deprecated) switch it to ConnectionType.UNISWAP_WALLET
if (state.selectedWallet === 'UNIWALLET') {
state.selectedWallet = ConnectionType.UNISWAP_WALLET
}
// If `userSlippageTolerance` is not present or its value is invalid, reset to default
if (
typeof state.userSlippageTolerance !== 'number' ||