mirror of
https://github.com/status-im/dappconnect-vote-poll-sdk.git
synced 2025-01-11 13:54:40 +00:00
Fix window ethereum (#89)
This commit is contained in:
parent
02aa702bca
commit
02f2634bae
@ -43,7 +43,7 @@ export function WakuPolling({ appName, signer, theme }: WakuPollingProps) {
|
||||
<CreateButton
|
||||
theme={theme}
|
||||
onClick={() => {
|
||||
if ((window as any).ethereum) {
|
||||
if ((window as any)?.ethereum) {
|
||||
activateBrowserWallet()
|
||||
} else setSelectConnect(true)
|
||||
}}
|
||||
|
@ -31,7 +31,7 @@ function ProposalListHeader({ votesLength, theme, wakuVoting, tokenBalance, acco
|
||||
}, [mobileVersion])
|
||||
|
||||
const onConnectClick = useCallback(() => {
|
||||
if ((window as any).ethereum) {
|
||||
if ((window as any)?.ethereum) {
|
||||
activateBrowserWallet()
|
||||
} else setShowConnectionModal(true)
|
||||
}, [])
|
||||
|
@ -18,8 +18,8 @@ export function useWakuProposal(
|
||||
const network = await provider?.getNetwork()
|
||||
setChainId(network?.chainId ?? 0)
|
||||
}
|
||||
;(window as any).ethereum.on('chainChanged', updateChainId)
|
||||
return () => (window as any).ethereum.removeListener('chainChanged', updateChainId)
|
||||
;(window as any)?.ethereum?.on('chainChanged', updateChainId)
|
||||
return () => (window as any)?.ethereum?.removeListener('chainChanged', updateChainId)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -48,7 +48,7 @@ export function TopBar({ logo, title, theme, activate, deactivate, account }: To
|
||||
<ConnectButton
|
||||
theme={theme}
|
||||
onClick={() => {
|
||||
if ((window as any).ethereum) {
|
||||
if ((window as any)?.ethereum) {
|
||||
activate()
|
||||
} else setSelectConnect(true)
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user