Skip to main content

Migration from WCM

If you are currently using WalletConnectModalFlutter, migrating to Web3Modal couldn't be easier!

Imports

Uninstall walletconnect_modal_flutter and install web3modal_flutter, then change imports:

// WalletConnectModal (Remove the following)
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
import 'package:walletconnect_modal_flutter/services/explorer/i_explorer_service.dart';
import 'package:walletconnect_modal_flutter/walletconnect_modal_flutter.dart';

// Web3Modal (Add the following)
import 'package:web3modal_flutter/web3modal_flutter.dart';

Service instance

// WalletConnectModal (Remove the following)
_w3mService = WalletConnectModalService(
projectId: '****************',
recommendedWalletIds: {
'WALLET_ID_HERE',
},
excludedWalletState: ExcludedWalletState.list,
);

// Web3Modal (Add the following)
_w3mService = W3MService(
projectId: '****************',
featuredWalletIds: {
'WALLET_ID_HERE',
},
// excludedWalletState: ExcludedWalletState.list, NOT NEEDED
);

Launching connected wallet

// WalletConnectModal (Remove the following)
_w3mService.launchCurrentWallet();

// Web3Modal (Add the following)
_w3mService.launchConnectedWallet();

Connect wallet button

// WalletConnectModal (Remove the following)
WalletConnectModalConnect(service: _w3mService),

// Web3Modal (Add the following)
// W3MNetworkSelectButton(service: _w3mService) => This button is optional
W3MConnectWalletButton(service: _w3mService),