Skip to content

Commit

Permalink
feat: add error handling to useWeb3StatusConnected hook
Browse files Browse the repository at this point in the history
  • Loading branch information
luchobonatti committed Jul 5, 2024
1 parent 627e7ce commit 38939c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hooks/useWeb3Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Web3Status>
}

0 comments on commit 38939c4

Please sign in to comment.