Skip to main content
This guide helps you upgrade from @metalayer/widget v0.x to v1.x, which introduces a cleaner API, improved naming conventions, and a powerful new theme system.

Breaking Changes

1. External WagmiProvider Required (disableWagmi removed)

The widget no longer ships an internal WagmiProvider. The disableWagmi prop has been removed — you must provide your own WagmiProvider in your application. If you were already using disableWagmi={true}, simply remove the prop:
If you were relying on the widget’s internal WagmiProvider (the old default), wrap your app with your own:
Use onSupportedChainsLoad to update your wagmi config with the chains the widget supports.

2. Widget Props Structure

The widget no longer uses a nested config object. Props are now passed directly to the component.

3. Callback Naming Changes

All callbacks have been renamed for clarity and consistency with React conventions:

4. Theme System

The brandColor prop has been removed in favor of the new comprehensive theme system.
Note: 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.

5. WidgetProvider Props Update

The chains prop has been renamed to enabledChains for clarity:

6. RPC / wagmi transports (Metalayer RPC helpers)

v1.x expects you to own WagmiProvider and therefore your transports. Using plain viem http() (or other defaults that ignore Metalayer metadata) does not use Metalayer’s ordered RPCs or alternativeRpcs as viem fallback endpoints, which can lead to rate limits or mismatches with the chains the widget loads. Prefer:
  • createWidgetClient with wagmi createConfig using a client({ chain }) { return createWidgetClient(chain) } callback, typically multiInjectedProviderDiscovery: false, after converting onSupportedChainsLoad chains with chainsToViemChains / chainToViemChain (see Components), or
  • createWidgetTransportsRecord(viemChains) with createConfig({ chains, transports }) or RainbowKit getDefaultConfig({ transports }).

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

Replace brandColor 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

Remove the config wrapper and pass props directly to <Widget>.
Use theme={{ colors: { primary: 'your-color' } }} instead.
Rename to onConnectClick.
Rename to onTokenSelected.

Best Practices

  1. Use the new theme system - It provides better customization and consistency
  2. Leverage TypeScript - The new types provide better autocomplete and type safety
  3. Optional disconnect - Only provide onDisconnectClick if your wallet library supports it
  4. Test callbacks - Ensure all renamed callbacks are working correctly after migration