-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathWalletModalManager.tsx
38 lines (32 loc) · 1.18 KB
/
WalletModalManager.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { useTranslation } from '@pancakeswap/localization'
import { WalletModalV2 } from '@pancakeswap/ui-wallets'
import { createWallets, getDocLink } from 'config/wallet'
import { useActiveChainId } from 'hooks/useActiveChainId'
import useAuth from 'hooks/useAuth'
import { ChainId } from '@pancakeswap/chains'
import { useMemo } from 'react'
import { logGTMWalletConnectEvent } from 'utils/customGTMEventTracking'
import { useConnect } from 'wagmi'
const WalletModalManager: React.FC<{ isOpen: boolean; onDismiss?: () => void }> = ({ isOpen, onDismiss }) => {
const { login } = useAuth()
const {
t,
currentLanguage: { code },
} = useTranslation()
const { connectAsync } = useConnect()
const { chainId } = useActiveChainId()
const docLink = useMemo(() => getDocLink(code), [code])
const wallets = useMemo(() => createWallets(chainId || ChainId.BSC, connectAsync), [chainId, connectAsync])
return (
<WalletModalV2
docText={t('Learn How to Connect')}
docLink={docLink}
isOpen={isOpen}
wallets={wallets}
login={login}
onDismiss={onDismiss}
onWalletConnectCallBack={logGTMWalletConnectEvent}
/>
)
}
export default WalletModalManager