Skip to content

Commit

Permalink
fix: refactor wip
Browse files Browse the repository at this point in the history
  • Loading branch information
simodrws committed May 26, 2023
1 parent d3b422c commit 81193be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/refactor/wallet-client/network.ts
@@ -0,0 +1,9 @@
import { useSwitchNetwork } from "wagmi"

export const useNetwork = () => {
const { switchNetwork } = useSwitchNetwork();

return {
switchNetwork
}
}
8 changes: 5 additions & 3 deletions src/refactor/wallet-client/wallet-client.ts
Expand Up @@ -3,17 +3,16 @@ import { useMemo } from 'react';

import { useAccount, useDisconnect, useProvider, useSigner } from 'wagmi';

export interface UseWalletClientReturn {}

export const useWalletClient = () => {
const { openConnectModal } = useConnectModal();
const { isConnected, isConnecting, isDisconnected, connector, address } =
useAccount();
const provider = useProvider();
const signer = useSigner();
const { data: signer, isLoading: isLoadingSigner } = useSigner();
const { disconnect, disconnectAsync } = useDisconnect();

const useWalletClientReturn: UseWalletClientReturn = useMemo(
const useWalletClientReturn = useMemo(
() => ({
address,
provider,
Expand All @@ -25,6 +24,7 @@ export const useWalletClient = () => {
openConnectModal,
disconnect,
disconnectAsync,
isLoadingSigner,
}),
[
address,
Expand All @@ -37,8 +37,10 @@ export const useWalletClient = () => {
openConnectModal,
disconnect,
disconnectAsync,
isLoadingSigner,
]
);

return useWalletClientReturn;
};

0 comments on commit 81193be

Please sign in to comment.