Skip to content

feat: add network selector with seamless switching support#38

Open
RomThpt wants to merge 6 commits intodevelopfrom
feature/network-selector
Open

feat: add network selector with seamless switching support#38
RomThpt wants to merge 6 commits intodevelopfrom
feature/network-selector

Conversation

@RomThpt
Copy link
Collaborator

@RomThpt RomThpt commented Jan 29, 2026

Summary

  • Add network selector web component with compact globe icon design
  • Integrate network selector into wallet connector component
  • Implement seamless network switching in WalletManager:
    • Adapters can declare supportsSeamlessNetworkSwitch capability
    • Supported adapters switch networks without disconnecting
    • Other adapters fall back to disconnect/reconnect flow
  • Add Crossmark adapter support for seamless network switching

Changes

  • packages/ui/src/network-selector.ts - New network selector web component
  • packages/ui/src/wallet-connector.ts - Integrated network selector, simplified switching logic
  • packages/core/src/types.ts - Added supportsSeamlessNetworkSwitch and switchNetwork to WalletAdapter
  • packages/core/src/wallet-manager.ts - Added switchNetwork method with intelligent adapter handling
  • packages/adapters/crossmark/src/crossmark-adapter.ts - Implemented seamless network switching

Test plan

  • Verify network selector displays correctly in wallet connector
  • Test network switching while disconnected (should just update default)
  • Test network switching with Crossmark (seamless, no disconnect)
  • Test network switching with other adapters (should disconnect/reconnect)
  • Verify network change events are emitted correctly

RomThpt and others added 6 commits January 28, 2026 18:55
Add a new NetworkSelectorElement web component that allows users to
switch between XRPL networks (mainnet, testnet, devnet). The component
displays a colored dot indicator and network label, with a dropdown
menu for network selection.

Changes:
- Add NetworkSelectorElement with shadow DOM and dropdown UI
- Add network-selector styles with CSS variables support
- Export NetworkSelectorElement from @xrpl-connect/ui
- Fix wallet-connector :host display to inline-block
- Update vanilla-js example to include network selector
- Remove fixed positioning from connect button in example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace text label with a small globe icon and colored dot indicator.
Remove colored dots from dropdown menu items for cleaner appearance.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add globe icon with proximity-based visibility near connect button
- Implement network dropdown with mainnet/testnet/devnet options
- Add colored dot indicator showing current network status
- Handle network switching with auto-reconnect support
- Emit network-change and network-switch-error events
- Remove standalone network selector from vanilla-js example
- Add smooth animations for globe appearance and dropdown
Use composedPath for proper shadow DOM click detection and prevent
globe from hiding while dropdown is open.
- Add switchNetwork method to WalletManager with intelligent switching:
  - Uses seamless switching for adapters that support it (e.g., Crossmark)
  - Falls back to disconnect/reconnect for other adapters
- Add supportsSeamlessNetworkSwitch and switchNetwork to WalletAdapter interface
- Implement seamless network switching in CrossmarkAdapter
- Simplify wallet-connector UI to delegate network switching to WalletManager
Copy link
Collaborator

@LeJamon LeJamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo rm console logs

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.

2 participants