Skip to content

Commit

Permalink
Update useWallet hook
Browse files Browse the repository at this point in the history
The wagmi returns the connector object even if we call `disconnect`
function. In that case the connector has basic information like: id,
name, type and uuid and the status is set to `connected`. So here we
need to make sure the `getAccounts` and `getBitcoinAddress` functions
exist in the connector object.
  • Loading branch information
r-czajkowski committed Oct 29, 2024
1 parent 590e226 commit fa48081
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dapp/src/hooks/useWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ export function useWallet(): UseWalletReturn {

useEffect(() => {
const fetchBitcoinAddress = async () => {
if (connector) {
if (
connector &&
typeof connector.getAccounts === "function" &&
typeof connector.getBitcoinAddress === "function"
) {
const btcAddress = await connector.getBitcoinAddress()
const accounts = await connector.getAccounts()

Expand Down

0 comments on commit fa48081

Please sign in to comment.