import React, { Dispatch, SetStateAction } from "react"; import { BeaconWallet } from "@taquito/beacon-wallet"; import { TezosToolkit } from "@taquito/taquito"; interface ButtonProps { wallet: BeaconWallet | null; setPublicToken: Dispatch>; setUserAddress: Dispatch>; setUserBalance: Dispatch>; setWallet: Dispatch>; setTezos: Dispatch>; setBeaconConnection: Dispatch>; } const DisconnectButton = ({ wallet, setPublicToken, setUserAddress, setUserBalance, setWallet, setTezos, setBeaconConnection }: ButtonProps): JSX.Element => { const disconnectWallet = async (): Promise => { //window.localStorage.clear(); setUserAddress(""); setUserBalance(0); setWallet(null); const tezosTK = new TezosToolkit("https://api.tez.ie/rpc/granadanet"); setTezos(tezosTK); setBeaconConnection(false); setPublicToken(null); console.log("disconnecting wallet"); if (wallet) { await wallet.client.removeAllAccounts(); await wallet.client.removeAllPeers(); await wallet.client.destroy(); } }; return (
); }; export default DisconnectButton;