getLocalStorage
Last updated
Was this helpful?
Retrieves the current Stacks Connect data from local storage. The data is stored as a hex-encoded JSON string under the @stacks/connect key.
import { getLocalStorage } from '@stacks/connect';
const data = getLocalStorage();
if (data) {
console.log('STX addresses:', data.addresses.stx);
console.log('BTC addresses:', data.addresses.btc);
console.log('Last updated:', data.updatedAt);
}Returns null if no data is stored or if reading from local storage fails.
The stored data is hex-encoded for safety. This function handles decoding automatically.
Data is written to local storage automatically when request is called with enableLocalStorage: true (the default) and addresses are returned from the wallet.
StorageData | null
Returns the parsed storage data object, or null if no data exists or an error occurs.
This function takes no parameters.
Last updated
Was this helpful?
Was this helpful?
function getLocalStorage(): StorageData | null