Skip to content

multi-wallet support for stellar solved#49

Open
Opeyemi01-del wants to merge 1 commit into
wraith-protocol:mainfrom
Opeyemi01-del:multi-wallet
Open

multi-wallet support for stellar solved#49
Opeyemi01-del wants to merge 1 commit into
wraith-protocol:mainfrom
Opeyemi01-del:multi-wallet

Conversation

@Opeyemi01-del
Copy link
Copy Markdown

@Opeyemi01-del Opeyemi01-del commented Jun 1, 2026

Closes #18


feat(stellar): multi-wallet support — Freighter, Albedo, xBull, LOBSTR

Closes #18

Introduce a wallet abstraction layer so the Stellar flow is no longer
tied to Freighter. Any visitor with Albedo, xBull, or LOBSTR can now
connect without installing a new extension.

## What changed

### New: src/wallets/stellar/
`types.ts` StellarWallet interface, WalletId union, WalletError
  class with typed error codes (NOT_AVAILABLE, USER_REJECTED, etc.)
`FreighterAdapter.ts` existing Freighter logic refactored onto the
  interface; no behaviour changes, just a clean boundary
`AlbedoAdapter.ts`  @albedo-link/intent; always available (web
  popup, no extension required)
`XBullAdapter.ts`  @creit.tech/stellar-wallets-kit, xBull entry
 `LobstrAdapter.ts`  @creit.tech/stellar-wallets-kit, LOBSTR entry
 `index.ts` registry barrel; WALLET_IDS, WALLET_META, getAdapter()
 `tests/adapters.test.ts`  Vitest suite: interface contract, XDR
  output parity across all four adapters, WalletError codes

### New: src/hooks/useStellarWallet.ts
Central React hook: parallel availability detection on mount,
connect/disconnect, auto-reconnect from localStorage, signTransaction
delegation. Replaces all direct @stellar/freighter-api call-sites.

### New: src/components/
 `StellarWalletPicker.tsx` — modal listing all wallets with
  Installed / Not detected badges and install links
 `StellarWalletButton.tsx` — compact status button (idle → picker,
  connected → pubkey + disconnect menu)
`StellarReceive.wallet.integration.ts` — annotated 3-point merge
  guide for StellarReceive.tsx

### New: docs/guides/stellar-quickstart.mdx
Covers: Stellar Wallets Kit trade-off analysis, adapter skeleton for
adding a fifth wallet, persistence model, bundle size strategy.

### New: tests/stellar-wallet-picker.spec.ts
Playwright e2e: picker open/close, all four options rendered, Albedo
always Installed, Freighter detection, Albedo + Freighter connect paths
(mocked via page.addInitScript), disconnect, localStorage persistence
across reload.

### Modified: src/components/StellarReceive.tsx
Three targeted changes: replace Freighter import block, swap Freighter
state + useEffect for useStellarWallet(), replace connect button with
<StellarWalletButton> + <StellarWalletPicker>.

### Modified: package.json
+ @albedo-link/intent
+ @creit.tech/stellar-wallets-kit

## Stellar Wallets Kit trade-off
Freighter and Albedo use their native SDKs directly — cleaner error
surfaces and independent release cadences. xBull and LOBSTR use SWK
because it normalises their APIs and they share one lazy chunk (swk.js),
so adding LOBSTR costs zero extra bytes over xBull alone. SWK is
isolated to two adapter files; the rest of the app only ever sees the
StellarWallet interface.

## Bundle strategy
Each SDK is imported lazily inside adapter methods  nothing downloads
until the picker opens. Vite manualChunks assigns freighter.js,
albedo.js, and swk.js as separate chunks. Target: ≤ +15 KB gzipped per
chunk.

## Stealth key derivation compatibility
useStellarWallet.signTransaction() delegates to the active adapter,
so StealthKeysContext and StellarReceive work without any
wallet-specific branching. All four adapters return { signedXdr: string }
 verified by the XDR parity test in adapters.test.ts.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Rocket1960 is attempting to deploy a commit to the truthixify's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Opeyemi01-del Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify
Copy link
Copy Markdown
Contributor

The multi-wallet work itself (Freighter/Albedo/xBull/LOBSTR adapters, StellarWalletPicker, useStellarWallet, the type interface, adapter tests, the Playwright spec) is exactly right for issue #18.

Blocker: your branch is off an old base (667b7e19) from before any of this round's PRs landed. The current diff would remove:

Could you rebase?

git fetch origin
git rebase origin/develop
# during rebase, drop ALL deletions to existing files
# keep only your additions:
#   src/wallets/stellar/* (the adapter library)
#   src/components/StellarWalletButton.tsx
#   src/components/StellarWalletPicker.tsx
#   src/hooks/useStellarWallet.ts
#   src/components/StellarReceive.wallet.integration.ts
#   tests/stellar-wallet-picker.spec.ts
# the empty docs/guides/stellar-quickstart.mdx (0 bytes) is also unintentional, drop it
git push --force-with-lease

After the rebase the diff should be net-positive lines only, no deletions of existing files. Then I'll merge. Thanks @Opeyemi01-del.

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.

Multi-wallet support for Stellar (Albedo, xBull, LOBSTR beyond Freighter)

3 participants