Skip to content

feat: multi-wallet support (Freighter, xBull, Albedo)#162

Open
aunysillyme wants to merge 1 commit into
sorosave-protocol:mainfrom
aunysillyme:feat/multi-wallet-issue-66
Open

feat: multi-wallet support (Freighter, xBull, Albedo)#162
aunysillyme wants to merge 1 commit into
sorosave-protocol:mainfrom
aunysillyme:feat/multi-wallet-issue-66

Conversation

@aunysillyme
Copy link
Copy Markdown

Summary

Closes #66.

Adds a wallet adapter abstraction so SoroSave can connect through any of the major Stellar wallets, not just Freighter.

  • New WalletAdapter interface in src/lib/wallets/ with adapters for Freighter (existing @stellar/freighter-api), xBull (window.xBullSDK), and Albedo (lazy-loaded @albedo-link/intent).
  • WalletSelectModal lists each wallet, shows install/availability state, and lets the user pick one. Wallets that aren't installed show an "Install" link to the wallet's site.
  • WalletContext tracks the active adapter, exposes signTransaction(xdr), and persists the last used wallet in localStorage under sorosave:lastWallet so the app reconnects automatically when the wallet is still available.
  • All call sites (ContributeModal, CreateGroupForm) sign through the active adapter via context instead of importing a Freighter-only helper. The legacy src/lib/wallet.ts is removed.
  • @albedo-link/intent added as a runtime dependency; xBull is detected through its injected global so no SDK install is required.

Acceptance criteria

  • Create wallet adapter interface — src/lib/wallets/types.ts
  • Implement adapters for Freighter, xBull, and Albedo — src/lib/wallets/{freighter,xbull,albedo}.ts
  • Show wallet selection modal on connect — src/components/WalletSelectModal.tsx
  • Remember last used wallet in localStorage — loadLastWalletId / saveLastWalletId in src/lib/wallets/index.ts
  • Gracefully handle wallet not installed — modal shows "Not installed" + install link; adapters throw WalletNotInstalledError

Test plan

  • Open /, click Connect Wallet → modal shows Freighter / xBull / Albedo
  • With only Freighter installed, the other two show "Install" links to their sites
  • Pick Freighter → wallet approves → navbar shows Freighter · G...XYZ
  • Disconnect, reload → no auto-connect (localStorage cleared on disconnect)
  • Connect xBull, reload → app auto-reconnects to xBull
  • Cancel the wallet popup → error is surfaced in the modal, no crash
  • Create a group / contribute → transaction is signed by the active adapter

Notes

This PR is AI-assisted (drafted with Claude). Please review carefully — in particular the xBull/Albedo signing flows have not been exercised against a live wallet in this environment.

/claim #66

🤖 Generated with Claude Code

Add a wallet adapter abstraction so SoroSave can connect through any of
the major Stellar wallets, not just Freighter.

- New WalletAdapter interface in src/lib/wallets/ with adapters for
  Freighter (existing API), xBull (window.xBullSDK), and Albedo
  (lazy-loaded @albedo-link/intent).
- WalletSelectModal lists each wallet, shows install/availability state,
  and lets users pick one.
- WalletContext tracks the active adapter, exposes signTransaction, and
  remembers the last used wallet in localStorage (sorosave:lastWallet)
  to auto-reconnect when the wallet is still available.
- Replace direct @/lib/wallet imports across components; sign through
  the active adapter via context.

Closes sorosave-protocol#66

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement multi-wallet support (Freighter, xBull, Albedo)

1 participant