Disconnecting from a Wallet
The follwing examples show how to properly disconnect from a wallet.
warning
If you are using the P2P transport, it is not recommended to manually disconnect from the transport. Doing so may interrupt the syncing process, resulting in an error message indicating "Syncing stopped manually."
- Beacon
- Taquito
Live Editor
import { DAppClient } from "@airgap/beacon-sdk"; const dAppClient = new DAppClient({ name: "Beacon Docs" }); dAppClient .disconnect() .then(() => { const account = await dAppClient.getActiveAccount(); console.log("Active Account", account); }) .catch((err) => console.error(err.message));
Loading...
Live Editor
import { TezosToolkit } from "@taquito/taquito"; import { BeaconWallet } from "@taquito/beacon-wallet"; const Tezos = new TezosToolkit("https://mainnet.api.tez.ie"); const wallet = new BeaconWallet({ name: "Beacon Docs Taquito" }); Tezos.setWalletProvider(wallet); await wallet.clearActiveAccount(); try { const account = await wallet.getPKH(); console.log("Active Account", account); } catch { console.log("No wallet connected"); }
Loading...