From 2e0dc8d83b6c068ddc34f2df8de449ebd400a06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20Stu=CC=88ber?= <15174476+TorstenStueber@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:44:06 -0300 Subject: [PATCH] Wait for wallet connection --- src/hooks/useMainProcess.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hooks/useMainProcess.ts b/src/hooks/useMainProcess.ts index 161c4f06..5e4e5c4f 100644 --- a/src/hooks/useMainProcess.ts +++ b/src/hooks/useMainProcess.ts @@ -257,6 +257,8 @@ export const useMainProcess = () => { }, [updateHookStateFromState, offrampingState]); useEffect(() => { + if (wagmiConfig.state.status !== 'connected') return; + (async () => { const nextState = await advanceOfframpingState(offrampingState, { renderEvent: addEvent, @@ -267,7 +269,13 @@ export const useMainProcess = () => { if (offrampingState !== nextState) updateHookStateFromState(nextState); })(); - }, [offrampingState, updateHookStateFromState, trackEvent, wagmiConfig]); + }, [ + offrampingState, + updateHookStateFromState, + trackEvent, + wagmiConfig, + wagmiConfig.state.status, // wagmiConfig is a mutable object so we need to list wagmiConfig.state.status here + ]); return { handleOnSubmit,