Skip to content

Fix: 4 issues (#884, #885, #886, #888) - #945

Open
Busiii-adetiba wants to merge 1 commit into
Stellar-split:mainfrom
Busiii-adetiba:simple/884-885-886-888
Open

Busiii-adetiba wants to merge 1 commit into
Stellar-split:mainfrom
Busiii-adetiba:simple/884-885-886-888

Conversation

@Busiii-adetiba

Copy link
Copy Markdown
Contributor

Closes #884
Closes #885
Closes #886
Closes #888

Issues

#884 Implement WalletConnect v2 integration for mobile wallets

Overview

Add WalletConnect v2 support for mobile wallet integration with QR code scanning.

Requirements

  • Integrate WalletConnect v2 SDK
  • Implement QR code generation
  • Add session management
  • Handle mobile wallet signing
  • Implement timeout and retry logic
  • Add connection status display

Acceptance Criteria

[ ] WalletConnect QR codes generated correctly
[ ] Mobile wallets can sign transactions
[ ] Session management works properly
[ ] Timeouts handled with retries
[ ] Status displayed to user

Definition of Done

All CI checks must pass before the PR is reviewed.

#885 Add wallet address validation and ENS/federation resolution

Overview

Validate wallet addresses and resolve human-readable names (ENS, Stellar federation).

Requirements

  • Implement Stellar address validation
  • Add federation address resolution
  • Cache resolution results
  • Handle resolution failures gracefully
  • Display resolved addresses clearly
  • Add address verification UI

Acceptance Criteria

[ ] Address validation works correctly
[ ] Federation addresses resolve properly
[ ] Caching improves performance
[ ] Failures handled gracefully
[ ] User sees verified addresses

Definition of Done

All CI checks must pass before the PR is reviewed.

#886 Implement account balance display and monitoring

Overview

Show user wallet balances for all connected tokens with real-time updates.

Requirements

  • Fetch balance from blockchain
  • Support multiple tokens/assets
  • Implement polling for updates
  • Add balance history tracking
  • Display formatted amounts
  • Add low balance warnings

Acceptance Criteria

[ ] Balances displayed accurately
[ ] Multiple assets supported
[ ] Updates reflect blockchain state
[ ] History tracked correctly
[ ] Low balance alerts work

Definition of Done

All CI checks must pass before the PR is reviewed.

#888 Implement wallet connection persistence across sessions

Overview

Remember user's wallet connection and restore it automatically on return.

Requirements

  • Store connection data securely
  • Implement auto-reconnection on page load
  • Handle connection failures gracefully
  • Add manual disconnect option
  • Respect user privacy settings
  • Clear connection on logout

Acceptance Criteria

[ ] Connection persists across sessions
[ ] Auto-reconnection works reliably
[ ] Manual disconnect works
[ ] No security vulnerabilities
[ ] Privacy respected

Definition of Done

All CI checks must pass before the PR is reviewed.

Summary

Add @walletconnect/web3wallet, @walletconnect/core, and @walletconnect/utils dependencies and set NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID in env. The WalletConnect service must be browser-only and lazily initialized to avoid SSR/build issues. Persistence should use localStorage with an opt-out privacy flag; do not store secrets, only address and wallet type. Auto-reconnect must verify the stored address with the wallet before trusting it. Federation resolution should be cached with a TTL and must never throw to the UI. Balance polling should pause when the tab is hidden. All new hooks and components need unit tests, and CI (lint, typecheck, tests) must pass before review.

Changes

  • Create a WalletConnect v2 service module that wraps @walletconnect/web3wallet and @walletconnect/core. Implement pairing proposal creation (returning the pairing URI for QR display), session approval/management, session persistence, signing request handling for Stellar transactions, and timeout/retry wrappers around session proposals and signing. Export functions: initWalletConnect, connectWalletConnect (returns { uri, publicKey }), getWalletConnectPublicKey, signWithWalletConnect, disconnectWalletConnect, and an event emitter for connection status. This replaces the current stub-based implementation and resolves the missing WalletConnect v2 SDK integration (Implement WalletConnect v2 integration for mobile wallets #884). (src/lib/walletconnect.ts)
  • Update the Freighter/WalletConnect abstraction to delegate WalletConnect calls to the new src/lib/walletconnect.ts service instead of the stub kit. Keep the existing exported API (connectWalletConnect, getWalletConnectPublicKey, signWithWalletConnect, disconnectWalletConnect, isWalletConnected) stable so callers don't break, but route them through the real WalletConnect v2 service. Ensure SSR guards remain and that signing uses the Stellar namespace with the correct network passphrase (Implement WalletConnect v2 integration for mobile wallets #884). (src/lib/freighter.ts)
  • Add WalletConnect v2 configuration to the app config: project ID (from NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID), relay URL, supported Stellar chain IDs (mainnet/testnet), session timeout, and retry policy constants. Export a walletConnectConfig object for use by the WalletConnect service and hooks (Implement WalletConnect v2 integration for mobile wallets #884). (src/lib/config.ts)
  • Extend error classification to cover WalletConnect-specific failures: session proposal timeout, user rejection, session not found, relay connection failure, and signing rejection. Add new ErrorKind values (walletconnect_timeout, walletconnect_rejected, walletconnect_session_expired) with user-friendly messages so the UI can surface connection status and retry guidance (Implement WalletConnect v2 integration for mobile wallets #884). (src/lib/errors.ts)
  • Create a useWalletConnect hook that manages the WalletConnect v2 lifecycle: initiating pairing, exposing the QR URI, tracking connection status (idle/connecting/awaiting_scan/connected/error), handling session approval events, implementing timeout with retry (e.g., 3 attempts with backoff) for session proposals, and exposing signTransaction and disconnect. Integrate with the toast/error system for status display (Implement WalletConnect v2 integration for mobile wallets #884). (src/hooks/useWalletConnect.ts)
  • Integrate WalletConnect v2 into the shared wallet state. Replace the direct connectWalletConnect call with the new useWalletConnect hook, expose connection status (including awaiting_scan and retry state) and the pairing URI through the hook's return value, and ensure disconnect calls the WalletConnect service. Also add persistence for the connection: store { address, walletType, timestamp } in localStorage (respecting a privacy opt-out flag), attempt auto-reconnect on mount by verifying the stored address with the wallet (Freighter getPublicKey / WalletConnect session restore), handle failures by clearing storage and surfacing a non-blocking error, and clear storage on disconnect/logout (Implement WalletConnect v2 integration for mobile wallets #884, Implement wallet connection persistence across sessions #888). (src/hooks/useWallet.ts)
  • Wire the WalletConnect hook and persistence into the WalletProvider. Expose connection status, pairing URI, retry state, and a manual disconnect method via context. On mount, trigger auto-reconnect from persisted state and surface reconnection status so ReconnectionBanner can display it. Ensure SEP-10 auth only runs after a verified address is restored (Implement WalletConnect v2 integration for mobile wallets #884, Implement wallet connection persistence across sessions #888). (src/contexts/WalletContext.tsx)
  • Update the WalletConnect component to support the WalletConnect v2 flow: show a 'Connect with mobile wallet' option that opens the QR modal with the pairing URI, display connection status (awaiting scan, connecting, connected, retrying, error), show retry button on timeout, and surface session errors via WalletErrorModal. Keep the existing Freighter flow intact and use the new context status fields (Implement WalletConnect v2 integration for mobile wallets #884). (src/components/WalletConnect.tsx)
  • Update QRModal to work with WalletConnect v2: accept a connection status prop, show a spinner/status text while awaiting scan, display retry and cancel actions on timeout, and stop polling isWalletConnected in favor of the WalletConnect session event provided by the parent. Ensure the QR code renders the pairing URI correctly and the modal closes on successful session approval (Implement WalletConnect v2 integration for mobile wallets #884). (src/components/QRModal.tsx)
  • Extend the Stellar library with helpers for address validation and federation resolution: validateStellarAddress using StrKey, resolveFederationAddress with a configurable federation server URL and timeout, and a fetchAccountBalances function that returns all account balances (native XLM plus issued assets) from Horizon. These helpers back the address validation (Add wallet address validation and ENS/federation resolution #885) and balance monitoring (Implement account balance display and monitoring #886) features. (src/lib/stellar.ts)
  • Add formatters for multi-asset balances: formatAssetAmount(amount, assetCode, decimals) with per-asset precision, formatBalanceWithCode, and a helper to compute low-balance warnings against configurable thresholds. Keep existing formatXLM/stroopsToXLM exports intact (Implement account balance display and monitoring #886). (src/lib/formatters.ts)
  • Enhance useAddressValidation to: validate Stellar public keys via StrKey, resolve federation addresses (name*domain) with graceful failure messages, cache resolution results in memory and localStorage with a TTL (e.g., 5 minutes), expose resolvedAddress and verification status, and debounce live validation. Ensure errors are user-friendly and do not throw (Add wallet address validation and ENS/federation resolution #885). (src/hooks/useAddressValidation.ts)
  • Update useAddressLabel to reuse the cached federation resolution from useAddressValidation/stellar helpers instead of calling Federation.Server.resolve directly, so labels benefit from caching and consistent error handling. Keep the existing return shape (Add wallet address validation and ENS/federation resolution #885). (src/hooks/useAddressLabel.ts)
  • Rewrite useWalletBalance to fetch all account balances (XLM and issued assets) via the new fetchAccountBalances helper, poll at a configurable interval using useInterval, maintain a bounded balance history in state/localStorage, format amounts per asset, and compute low-balance warnings against thresholds. Preserve the existing retry/backoff behavior and return shape where possible, adding assets, history, and warnings fields (Implement account balance display and monitoring #886). (src/hooks/useWalletBalance.ts)
  • Update WalletAddress to optionally display resolved/verified status: show a verified badge when the address is a valid Stellar key or successfully resolved federation address, show the federation name alongside the resolved address, and display a warning icon on resolution failure. Accept optional props for validation state and resolved address (Add wallet address validation and ENS/federation resolution #885). (src/components/WalletAddress.tsx)
  • Integrate address validation into RecipientForm: use useAddressValidation for each recipient row, show inline validation errors, display resolved federation addresses and verified badges, and block submission when any recipient address is invalid or unresolved (Add wallet address validation and ENS/federation resolution #885). (src/components/RecipientForm.tsx)
  • Add a wallet verification section to the settings verify page that lets users validate an address or federation address, shows the resolved Stellar address with a verified badge, and displays resolution errors gracefully. Reuse useAddressValidation and WalletAddress (Add wallet address validation and ENS/federation resolution #885). (src/app/settings/verify/page.tsx)
  • Update ReconnectionBanner to reflect the new auto-reconnect flow: accept a status prop (reconnecting, reconnected, failed) and show retry/manual-connect actions on failure. Ensure it integrates with WalletContext reconnection state (Implement wallet connection persistence across sessions #888). (src/components/ReconnectionBanner.tsx)
  • Add a wallet connection section to the security settings page: show current connection status (wallet type, address, connected/disconnected), provide a manual disconnect button that clears persisted connection data, and add a privacy toggle to opt out of connection persistence. Ensure disconnect also clears SEP-10 auth state (Implement wallet connection persistence across sessions #888). (src/app/settings/security/page.tsx)
  • Add a link to the wallet verification page under 'More settings' so users can reach the address verification UI (Add wallet address validation and ENS/federation resolution #885). (src/app/settings/page.tsx)
  • Update PaymentSourceBar to use the new multi-asset balance formatting helpers where it displays amounts, ensuring asset codes and precision are shown consistently with the balance display (Implement account balance display and monitoring #886). (src/components/PaymentSourceBar.tsx)
  • Surface low-balance warnings and connection status in the network status area: add a low-balance warning badge driven by useWalletBalance thresholds and reflect WalletConnect connection status alongside RPC health (Implement account balance display and monitoring #886, Implement WalletConnect v2 integration for mobile wallets #884). (src/components/NetworkStatus.tsx)

Co-authored-by: Simple Agent <agent@simple.dev>
@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Busiii-adetiba is attempting to deploy a commit to the kingsman-99's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@Busiii-adetiba 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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant