Skip to content

feat(WebGL): auto-select wallet when only one adapter available#275

Open
mstevens843 wants to merge 1 commit intomagicblock-labs:mainfrom
mstevens843:feat/auto-select-single-adapter
Open

feat(WebGL): auto-select wallet when only one adapter available#275
mstevens843 wants to merge 1 commit intomagicblock-labs:mainfrom
mstevens843:feat/auto-select-single-adapter

Conversation

@mstevens843
Copy link
Copy Markdown

@mstevens843 mstevens843 commented Apr 8, 2026

Status Type ⚠️ Core Change Issue
Ready Feature No #273

Problem

LoginWalletAdapter() shows the wallet picker UI even when only one wallet adapter is available, forcing the user to tap through a single-option selection screen.
Documented as Point 1 in #273.

Solution

In SetCurrentWallet(), after InitWallets() populates the Wallets array, check if exactly one wallet is present. If so, assign it directly to _currentWallet and
return early, bypassing the picker UI entirely.

Null-safe — if Wallets is null or empty, the existing picker flow is preserved unchanged. Multi-wallet scenarios (2+ wallets) are also unchanged.

Scope: WebGL only. On Android, wallet selection is handled by the native MWA intent system. On iOS, it's hardcoded to Phantom. Neither goes through the SDK picker.

Changed file: Runtime/codebase/SolanaWalletAdapterWebGL/SolanaWalletAdapterWebGL.cs

Before & After Screenshots

BEFORE: Single-wallet picker UI shown, requiring a click to proceed.

AFTER: Wallet is auto-selected; login proceeds directly to the connection prompt.

Other changes (e.g. bug fixes, small refactors)

None. 4 lines added, 0 removed.

Deploy Notes

No new dependencies, scripts, or configuration changes.

Summary by CodeRabbit

  • New Features
    • Wallet connection streamlined: when only one wallet is available, it now auto-selects without displaying the selection prompt, improving the setup experience.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8564ba6a-f5b2-4dd8-934c-eae71bc0fa66

📥 Commits

Reviewing files that changed from the base of the PR and between 054503e and 4eaec55.

📒 Files selected for processing (1)
  • Runtime/codebase/SolanaWalletAdapterWebGL/SolanaWalletAdapterWebGL.cs

Walkthrough

The SetCurrentWallet() method now automatically assigns _currentWallet to the single available wallet adapter when exactly one exists, bypassing the UI selection flow. Previously, this method always displayed the UI and awaited user selection.

Changes

Cohort / File(s) Summary
Wallet Selection Auto-Assignment
Runtime/codebase/SolanaWalletAdapterWebGL/SolanaWalletAdapterWebGL.cs
Modified SetCurrentWallet() to automatically assign _currentWallet when exactly one wallet adapter is available, skipping the UI selection flow that previously always executed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: auto-selecting a wallet when only one adapter is available on WebGL.
Description check ✅ Passed The description comprehensively covers all required template sections including Problem, Solution, Before & After, Deploy Notes, and includes relevant context about scope and issue reference.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant