From 38939c47277dfc44aaa588b6c52033605c7fbeba Mon Sep 17 00:00:00 2001 From: luchobonatti Date: Fri, 5 Jul 2024 11:17:52 -0300 Subject: [PATCH] feat: add error handling to useWeb3StatusConnected hook --- src/hooks/useWeb3Status.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hooks/useWeb3Status.tsx b/src/hooks/useWeb3Status.tsx index f67b81b5..b90471fd 100644 --- a/src/hooks/useWeb3Status.tsx +++ b/src/hooks/useWeb3Status.tsx @@ -95,5 +95,9 @@ export const useWeb3Status = () => { } export const useWeb3StatusConnected = () => { + const context = useWeb3Status() + if (!context.address) { + throw new Error('Use useWeb3StatusConnected only when a wallet is connected') + } return useWeb3Status() as RequiredNonNull }