Skip to content

Commit

Permalink
Export disconnect function from useWallet hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Carson Aberle committed Jul 17, 2023
1 parent f00cb53 commit a88f38f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/react/src/lib/hooks/useWallet/useWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ type UseWallet = {
rpcUrl: string;
offlineSigner?: OfflineSigner;
accounts: readonly AccountData[];
disconnect: () => void;
};
const useWallet = (): UseWallet => {
const { connectedWallet, chainId, restUrl, rpcUrl, offlineSigner, accounts } = useContext(SeiWalletContext);
const { connectedWallet, chainId, restUrl, rpcUrl, offlineSigner, accounts, disconnect } = useContext(SeiWalletContext);

return { connectedWallet, chainId, restUrl, rpcUrl, offlineSigner, accounts };
return { connectedWallet, chainId, restUrl, rpcUrl, offlineSigner, accounts, disconnect };
};

export default useWallet;
3 changes: 3 additions & 0 deletions packages/react/src/lib/provider/SeiWalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ const SeiWalletProvider = ({ children, chainConfiguration, wallets, autoConnect

const disconnect = () => {
setTargetWallet(undefined);
setOfflineSigner(undefined);
setAccounts([]);
setConnectedWallet(undefined);
};

const contextValue: WalletProvider = {
Expand Down

0 comments on commit a88f38f

Please sign in to comment.