Connect mobile wallets to your dapp - add extension, get wallet list, connect (QR or deep link), handle prompts
Prerequisites: Create and initialize a Dynamic client and add the extension(s) for your chain(s): EVM and/or Solana. The SDK supports WalletConnect for EVM and Solana only.What is WalletConnect? Users connect a wallet from another device (e.g. mobile) by scanning a QR code or opening a deep link. Use it for cross-device or mobile-to-web flows. You build the UI yourself; there is no built-in picker.
Add the WalletConnect extension for each chain you support, once at app setup. Client is optional when using a single Dynamic client.
Copy
Ask AI
import { createDynamicClient, initializeClient,} from '@dynamic-labs-sdk/client';import { addWalletConnectEvmExtension } from '@dynamic-labs-sdk/evm/wallet-connect';import { addWalletConnectSolanaExtension } from '@dynamic-labs-sdk/solana/wallet-connect';const client = createDynamicClient({ environmentId: 'your-environment-id' });await initializeClient();await addWalletConnectEvmExtension(client);await addWalletConnectSolanaExtension(client); // omit if you only use EVM
Use getWalletConnectCatalog() for names, icons, and deep links (e.g. for a picker or “Open in MetaMask”). To look up one wallet by provider key after a wallet is connected, see When the user must act.
Every connect flow returns { uri, approval }. You show the URI as a QR code (desktop) or pass it into a deep link (mobile via appendWalletConnectUriToDeepLink); the user approves in their wallet app; then approval() resolves with { walletAccounts }.
Chain
Connect only
Connect and verify
EVM
connectWithWalletConnectEvm
connectAndVerifyWithWalletConnectEvm (one step)
Solana
connectWithWalletConnectSolana
connectAndVerifyWithWalletConnectSolana (connect then verify; no single-step auth for non-EVM)
Connect and verify:For connect and verify, call connectAndVerifyWithWalletConnectEvm() or connectAndVerifyWithWalletConnectSolana() instead; same uri / approval pattern.
Solana has no single-step WalletConnect authenticate method (only EIP-155 chains support it), so connectAndVerifyWithWalletConnectSolana performs connect then verify in sequence internally.
After a request (e.g. sign, switch network), the user approves in their wallet app. Listen for walletConnectUserActionRequested and either open the wallet app (mobile) or show a prompt (desktop). Use getWalletConnectCatalogWalletByWalletProviderKey({ walletProviderKey }) to get the wallet’s deep link when you have a connected wallet or the event’s walletProviderKey.
Copy
Ask AI
import { onEvent, isMobile, getWalletConnectCatalogWalletByWalletProviderKey,} from '@dynamic-labs-sdk/client';onEvent({ event: 'walletConnectUserActionRequested', listener: async ({ walletProviderKey }) => { if (isMobile()) { const wallet = await getWalletConnectCatalogWalletByWalletProviderKey({ walletProviderKey, }); const deepLink = wallet?.deeplinks?.native ?? wallet?.deeplinks?.universal; if (deepLink) window.open(deepLink, '_blank'); } else { // e.g. toast.info('Please approve the action in your wallet application'); } },});
User rejects the connection or signing request in the wallet app.
WalletAccountAlreadyVerifiedError
(connectAndVerifyWithWalletConnectSolana only) The wallet account is already verified.
WalletAlreadyLinkedToAnotherUserError
(connectAndVerifyWithWalletConnectSolana only) The wallet is linked to another user.
From `@dynamic-labs-sdk/client/core`
Error
When
ValueMustBeDefinedError
A required value is missing: project settings, EVM/Solana networks not configured, no URI returned from WalletConnect, session namespace not established, or (connect-and-verify EVM) universal link not set or nonce failed.
From `@dynamic-labs-sdk/wallet-connect`
Error
When
SessionClosedUnexpectedlyError
The WalletConnect session was closed or is no longer valid (e.g. user disconnected, or session expired). Often thrown when using the wallet provider after disconnect or during approval().
From getSignClient (before connect)
If the client or project is misconfigured, getSignClient can throw ValueMustBeDefinedError when: the app name (display name) is not set in the dashboard, or the WalletConnect project ID is not set in the dashboard.