/** * Service for managing localStorage operations for wallet connections */ export class StorageService { private readonly STORAGE_KEY_SOLANA_WALLETS = 'uwc_connected_solana_wallets' /** * Get previously connected Solana wallet UUIDs from localStorage */ getStoredSolanaWalletUUIDs(): string[] { try { const stored = localStorage.getItem(this.STORAGE_KEY_SOLANA_WALLETS) return stored ? JSON.parse(stored) : [] } catch { return [] } } /** * Store a Solana wallet UUID as connected in localStorage */ storeSolanaWalletUUID(uuid: string): void { try { const existing = this.getStoredSolanaWalletUUIDs() if (!existing.includes(uuid)) { existing.push(uuid) localStorage.setItem( this.STORAGE_KEY_SOLANA_WALLETS, JSON.stringify(existing) ) } } catch { // Silently fail if localStorage is not available } } /** * Check if a Solana wallet UUID was previously connected */ wasSolanaWalletPreviouslyConnected(uuid: string): boolean { const storedUUIDs = this.getStoredSolanaWalletUUIDs() return storedUUIDs.includes(uuid) } }