feat: add network selector with seamless switching support#38
Open
feat: add network selector with seamless switching support#38
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
supportsSeamlessNetworkSwitchcapabilityChanges
packages/ui/src/network-selector.ts- New network selector web componentpackages/ui/src/wallet-connector.ts- Integrated network selector, simplified switching logicpackages/core/src/types.ts- AddedsupportsSeamlessNetworkSwitchandswitchNetworkto WalletAdapterpackages/core/src/wallet-manager.ts- AddedswitchNetworkmethod with intelligent adapter handlingpackages/adapters/crossmark/src/crossmark-adapter.ts- Implemented seamless network switchingTest plan