mirror of
https://github.com/status-im/dappconnect-voting-sdk.git
synced 2025-02-27 09:50:39 +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
|
<CreateButton
|
||||||
theme={theme}
|
theme={theme}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if ((window as any).ethereum) {
|
if ((window as any)?.ethereum) {
|
||||||
activateBrowserWallet()
|
activateBrowserWallet()
|
||||||
} else setSelectConnect(true)
|
} else setSelectConnect(true)
|
||||||
}}
|
}}
|
||||||
|
@ -31,7 +31,7 @@ function ProposalListHeader({ votesLength, theme, wakuVoting, tokenBalance, acco
|
|||||||
}, [mobileVersion])
|
}, [mobileVersion])
|
||||||
|
|
||||||
const onConnectClick = useCallback(() => {
|
const onConnectClick = useCallback(() => {
|
||||||
if ((window as any).ethereum) {
|
if ((window as any)?.ethereum) {
|
||||||
activateBrowserWallet()
|
activateBrowserWallet()
|
||||||
} else setShowConnectionModal(true)
|
} else setShowConnectionModal(true)
|
||||||
}, [])
|
}, [])
|
||||||
|
@ -18,8 +18,8 @@ export function useWakuProposal(
|
|||||||
const network = await provider?.getNetwork()
|
const network = await provider?.getNetwork()
|
||||||
setChainId(network?.chainId ?? 0)
|
setChainId(network?.chainId ?? 0)
|
||||||
}
|
}
|
||||||
;(window as any).ethereum.on('chainChanged', updateChainId)
|
;(window as any)?.ethereum?.on('chainChanged', updateChainId)
|
||||||
return () => (window as any).ethereum.removeListener('chainChanged', updateChainId)
|
return () => (window as any)?.ethereum?.removeListener('chainChanged', updateChainId)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -48,7 +48,7 @@ export function TopBar({ logo, title, theme, activate, deactivate, account }: To
|
|||||||
<ConnectButton
|
<ConnectButton
|
||||||
theme={theme}
|
theme={theme}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if ((window as any).ethereum) {
|
if ((window as any)?.ethereum) {
|
||||||
activate()
|
activate()
|
||||||
} else setSelectConnect(true)
|
} else setSelectConnect(true)
|
||||||
}}
|
}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user