Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 1.69 KB

File metadata and controls

26 lines (22 loc) · 1.69 KB

Issue #354: Implement Soroban Wallet Auto-Reconnect System

PR Title: feat: implement Soroban wallet auto-reconnect system (#354)

CORS_ORIGIN: Comma-separated list of allowed origins

IMPORTANT: Never use * in production, always specify exact domains

PR Description:

## Description
Closes #354.
<!-- ## Stellar/Soroban Features - All Issues Implemented -->
This PR implements a robust auto-reconnect system for Stellar/Soroban wallets (such as Freighter) within the `@bridgewise/wallet` package. It preserves disconnected wallet sessions persistently in browser storage and automatically restores them transparently during application initialization, preventing workflow interruptions in bridge operations.

## Changes Made
- Created `StellarReconnectManager` to serialize, store, and clear active Stellar wallet sessions (adapter type, address, chain ID) in `localStorage` under `bridgewise-stellar-session`.
- Implemented a 7-day expiration guard to ignore and clean up outdated session states.
- Extended `WalletManager` with connection persistence hooks in `connect()` and `disconnect()`.
- Exposed `autoReconnectStellar()` as a public method and integrated an initialization trigger in the `WalletManager` constructor when `autoReconnect` option is enabled.
- Added comprehensive unit and integration regression tests in `StellarReconnect.test.ts` verifying connection persistence, auto-reconnection, expiration pruning, and graceful missing-extension recovery.

## Acceptance Criteria Met
- [x] Persist session state of Stellar/Soroban wallets.
- [x] Reconnect wallets automatically on initialization.
- [x] Regression and unit tests verify protection and connection restoration logic.