feat: set is wallet connected
This commit is contained in:
parent
f1458124a7
commit
efae345225
|
@ -1,10 +1,22 @@
|
||||||
import { Avatar, Button } from '@status-im/components'
|
import { Avatar, Button } from '@status-im/components'
|
||||||
import { useConnectWallet } from '@web3-onboard/react'
|
import { useConnectWallet } from '@web3-onboard/react'
|
||||||
import { XStack } from 'tamagui'
|
import { XStack } from 'tamagui'
|
||||||
import { ethers } from 'ethers'
|
import { useDispatch } from 'react-redux'
|
||||||
|
|
||||||
|
import { setIsWalletConnected } from '../../../redux/ValidatorOnboarding/Deposit/slice'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
const ConnectWallet = () => {
|
const ConnectWallet = () => {
|
||||||
const [{ wallet, connecting }, connect, disconnect] = useConnectWallet()
|
const [{ wallet, connecting }, connect, disconnect] = useConnectWallet()
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (wallet) {
|
||||||
|
dispatch(setIsWalletConnected(true))
|
||||||
|
} else {
|
||||||
|
dispatch(setIsWalletConnected(false))
|
||||||
|
}
|
||||||
|
}, [wallet])
|
||||||
|
|
||||||
const onConnectWalletClick = () => {
|
const onConnectWalletClick = () => {
|
||||||
if (wallet) {
|
if (wallet) {
|
||||||
|
|
Loading…
Reference in New Issue