import type { CoinbaseWallet } from '@web3-react/coinbase-wallet' import type { Web3ReactHooks } from '@web3-react/core' import { GnosisSafe } from '@web3-react/gnosis-safe' import type { MetaMask } from '@web3-react/metamask' import { Network } from '@web3-react/network' import { WalletConnect } from '@web3-react/walletconnect' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' import { useCallback, useEffect, useState } from 'react' import { CHAINS, getAddChainParameters } from '../chains' function ChainSelect({ activeChainId, switchChain, chainIds, }: { activeChainId: number switchChain: (chainId: number) => void chainIds: number[] }) { return ( ) } export function ConnectWithSelect({ connector, activeChainId, chainIds = Object.keys(CHAINS).map(Number), isActivating, isActive, error, setError, }: { connector: MetaMask | WalletConnect | WalletConnectV2 | CoinbaseWallet | Network | GnosisSafe activeChainId: ReturnType chainIds?: ReturnType[] isActivating: ReturnType isActive: ReturnType error: Error | undefined setError: (error: Error | undefined) => void }) { const [desiredChainId, setDesiredChainId] = useState(undefined) /** * When user connects eagerly (`desiredChainId` is undefined) or to the default chain (`desiredChainId` is -1), * update the `desiredChainId` value so that