chore: Remove Hardcoded Uni Wallet Supported Chains List (#7320)

This commit is contained in:
Matthew Spector 2023-09-15 11:04:32 -07:00 committed by GitHub
parent 92cf5b42c0
commit 185cb52501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 18 deletions

@ -7,13 +7,7 @@ import { getConnection } from 'connection'
import { ConnectionType } from 'connection/types' import { ConnectionType } from 'connection/types'
import { WalletConnectV2 } from 'connection/WalletConnectV2' import { WalletConnectV2 } from 'connection/WalletConnectV2'
import { getChainInfo } from 'constants/chainInfo' import { getChainInfo } from 'constants/chainInfo'
import { import { getChainPriority, L1_CHAIN_IDS, L2_CHAIN_IDS, TESTNET_CHAIN_IDS } from 'constants/chains'
getChainPriority,
L1_CHAIN_IDS,
L2_CHAIN_IDS,
TESTNET_CHAIN_IDS,
UniWalletSupportedChains,
} from 'constants/chains'
import { useOnClickOutside } from 'hooks/useOnClickOutside' import { useOnClickOutside } from 'hooks/useOnClickOutside'
import useSelectChain from 'hooks/useSelectChain' import useSelectChain from 'hooks/useSelectChain'
import useSyncChainQuery from 'hooks/useSyncChainQuery' import useSyncChainQuery from 'hooks/useSyncChainQuery'
@ -39,14 +33,12 @@ interface ChainSelectorProps {
function useWalletSupportedChains(): ChainId[] { function useWalletSupportedChains(): ChainId[] {
const { connector } = useWeb3React() const { connector } = useWeb3React()
const connectionType = getConnection(connector).type const connectionType = getConnection(connector).type
switch (connectionType) { switch (connectionType) {
case ConnectionType.WALLET_CONNECT_V2: case ConnectionType.WALLET_CONNECT_V2:
return getSupportedChainIdsFromWalletConnectSession((connector as WalletConnectV2).provider?.session)
case ConnectionType.UNISWAP_WALLET_V2: case ConnectionType.UNISWAP_WALLET_V2:
return UniWalletSupportedChains return getSupportedChainIdsFromWalletConnectSession((connector as WalletConnectV2).provider?.session)
default: default:
return NETWORK_SELECTOR_CHAINS return NETWORK_SELECTOR_CHAINS
} }

@ -1,13 +1,5 @@
import { ChainId, SUPPORTED_CHAINS, SupportedChainsType } from '@uniswap/sdk-core' import { ChainId, SUPPORTED_CHAINS, SupportedChainsType } from '@uniswap/sdk-core'
export const UniWalletSupportedChains = [
ChainId.MAINNET,
ChainId.ARBITRUM_ONE,
ChainId.OPTIMISM,
ChainId.POLYGON,
ChainId.BASE,
]
export const CHAIN_IDS_TO_NAMES = { export const CHAIN_IDS_TO_NAMES = {
[ChainId.MAINNET]: 'mainnet', [ChainId.MAINNET]: 'mainnet',
[ChainId.GOERLI]: 'goerli', [ChainId.GOERLI]: 'goerli',