isConnected
Last updated
Was this helpful?
Checks whether the user is currently connected to a wallet. A user is considered connected if at least one STX or BTC address has been cached in local storage from a previous connect or request call.
import { isConnected } from '@stacks/connect';
if (isConnected()) {
console.log('Wallet is connected');
} else {
console.log('No wallet connected');
}This function relies on local storage data. It will only return true if enableLocalStorage was true (the default) when the user connected.
Calling disconnect or clearLocalStorage will cause this function to return false.
function isConnected(): booleanboolean
Returns true if at least one STX or BTC address exists in the local storage cache. Returns false otherwise.
This function takes no parameters.
Last updated
Was this helpful?
Was this helpful?