@metalayer/widget v0.x to v1.x, which introduces a cleaner API, improved naming conventions, and a powerful new theme system.
Breaking Changes
1. Widget Props Structure
The widget no longer uses a nestedconfig object. Props are now passed directly to the component.
2. Callback Naming Changes
All callbacks have been renamed for clarity and consistency with React conventions:| Old Name (v0.x) | New Name (v1.x) | Description |
|---|---|---|
onOpenConnectModal | onConnectClick | Handler when user clicks connect |
onDisconnectWallet | onDisconnectClick | Handler when user clicks disconnect |
onSubmitTransaction | onTransactionSubmitted | Fired after transaction submission |
onSelectToken | onTokenSelected | Fired after token selection |
3. Theme System
ThebrandColor prop has been removed in favor of the new comprehensive theme system.
brandColor has been completely removed in v1.x. You must use the new theme prop. See the New Theme System Features section below for comprehensive theming options.
4. WidgetProvider Props Update
Thechains prop has been renamed to enabledChains for clarity:
Step-by-Step Migration
Step 1: Update Package Version
Step 2: Update Widget Component Usage
Find all<Widget> components and update the props:
Step 3: Update WidgetProvider Theme
ReplacebrandColor with the new theme configuration:
Step 4: Update Token Selection Callbacks
If you’re using token selection callbacks, update the naming:Step 5: Update Controlled Token Selection
If using controlled source/destination props:New Theme System Features
Take advantage of the new theming capabilities:Predefined Themes
Custom Color Palette
Feature Toggles
Advanced Overrides
Common Integration Updates
RainbowKit
Dynamic.xyz
ConnectKit
TypeScript Updates
The type definitions have changed significantly:Additional Exported Types
v1.x exports comprehensive TypeScript types for all configuration:Troubleshooting
Property 'config' does not exist
Property 'config' does not exist
Remove the
config wrapper and pass props directly to <Widget>.brandColor is deprecated
brandColor is deprecated
Use
theme={{ colors: { primary: 'your-color' } }} instead.onOpenConnectModal is not a valid prop
onOpenConnectModal is not a valid prop
Rename to
onConnectClick.onSelectToken callback not firing
onSelectToken callback not firing
Rename to
onTokenSelected.Best Practices
- Use the new theme system - It provides better customization and consistency
- Leverage TypeScript - The new types provide better autocomplete and type safety
- Optional disconnect - Only provide
onDisconnectClickif your wallet library supports it - Test callbacks - Ensure all renamed callbacks are working correctly after migration