Disconnecting
Disconnecting wallets after use is recommended. Since wallets hold valuable assets, minimizing the connection duration reduces security exposure.
Programmatic Disconnection
Call the asynchronous disconnect() mtehod to disconnect a wallet. This releases all event listeners and returns the wallet to a locked state. Calling this method when no wallet is connected has no effect.
After disconnection, walletAddress and most other properties are set to null.
react
Disconnecting from wallet
import { useWalletConnect } from "@btc-vision/walletconnect";
function App() {
const {disconnect} = useWalletConnect()
return (
<button onClick={async () => { await disconnect()} } >Disconnect</button>
)
}UI Disconnection
The user can also disconnects through the wallet's interface. After disconnection, walletAddress and most other properties are set to null.
To disconnect from OP_WALLET:
- Open the wallet.
- Go to the bottom right and click on the COG wheel .
- Click on Lock Wallet.
