Skip to main content
Building a React web app? The prebuilt connect wallet widget renders the wallet list, chain choice, QR pairing, and error screens for you.

Prerequisites

Before this page: create and initialize a Dynamic client (see Creating a Dynamic client), and register a chain extension so wallet providers are available (see Adding extensions). External wallets only appear once a chain extension (EVM, Solana, etc.) is registered.

What you’ll build

A “connect wallet” experience: show the wallets a user can connect, connect to the one they pick, and — when you need proof they own it — verify ownership. Two levels of connection:
  • Connect — attach the wallet so you can read its address and prompt for signatures. Use this when you just need to interact with a wallet.
  • Connect and verify — connect, then have the user sign a message proving ownership. Verifying links the wallet to the signed-in user (or signs them in). Use this when the wallet must be a trusted credential.

Connect by wallet catalogue key

connectWalletOption is the primary way to connect an external wallet. It takes a wallet options catalogue key (such as 'metamask' or 'phantom') and picks the connection path the wallet supports on the user’s device: an installed wallet provider, a URI pairing (WalletConnect or the MetaMask SDK) handed to onConnectionUri, or the wallet’s own in-app browser. You do not need to route by connection type yourself. The function returns an unverified WalletAccount. Pass it to verifyWalletAccount to prove ownership and link the wallet to the user.
Catalogue keys come from getWalletOptionsCatalogue, which lists every wallet a user can connect to or install — see Build a wallet picker for the recommended picker pattern. For the full behavior, parameters, and errors, see Connect a wallet by catalogue key.

Customizing the connection paths

Two optional handlers control how connectWalletOption reaches wallets that are not installed:
  • onConnectionUri receives the pairing URI when the wallet connects through WalletConnect or the MetaMask SDK. It is required for wallets whose only connection path is a URI pairing — open the URI as a deeplink on mobile, or render it as a QR code on desktop.
  • handleWalletBrowserRedirect is called when the wallet only provides its own in-app browser. Without it, the SDK redirects the current page into the wallet’s browser itself; pass it to choose a different return page or when there is no current page URL.
See Connect a wallet by catalogue key for the parameters and the errors thrown when a required handler is missing.

Reaching mobile and uninstalled wallets

connectWalletOption can only offer a URI pairing when the matching extension is registered — add them at app setup alongside your chain extensions:
  • WalletConnect (EVM and Solana) — recommended for broad mobile wallet support. Add addWalletConnectEvmExtension from @dynamic-labs-sdk/evm/wallet-connect and addWalletConnectSolanaExtension from @dynamic-labs-sdk/solana/wallet-connect. See Authenticate with WalletConnect.
  • MetaMask SDK (EVM and Solana) — recommended for MetaMask support, covering the desktop QR code and the mobile handoff. Add addMetaMaskEvmExtension from @dynamic-labs-sdk/evm/metamask and addMetaMaskSolanaExtension from @dynamic-labs-sdk/solana/metamask. See the MetaMask Connection Guide.
Once an extension is registered, connectWalletOption routes to it automatically — WalletConnect and MetaMask SDK pairings arrive through the same onConnectionUri handler, so no extra wiring is needed beyond rendering or opening the URI.

Listing installed providers

getAvailableWalletProvidersData returns only the providers detected as installed in the user’s browser for the registered chains, each with a key, groupKey, and metadata (display name and icon). It does not include wallets reachable through URI pairing or an in-app browser, so prefer the catalogue-based flow above unless you specifically want an installed-extensions-only list.
Providers from different chains that represent the same wallet share a groupKey. Group your UI by groupKey if you want one row per wallet (for example, one “MetaMask” entry) instead of one row per chain.

Connecting through an installed provider directly

connectAndVerifyWithWalletProvider and connectWithWalletProvider are the lower-level connection functions. They take a wallet provider key from getAvailableWalletProvidersData and drive that registered provider directly — for example, an EIP-6963 browser extension or a redirect provider such as Phantom on mobile. They cannot reach URI pairing or in-app browser wallets, so use them when you intentionally route by provider, such as when connecting a hardware wallet through a compatible software provider.
Verifying a wallet that already belongs to a different account surfaces a conflict. Handle it with the flow in Account conflict resolution.

Handling errors

For the full connectWalletOption error list, see Connect a wallet by catalogue key.

See also

Last modified on November 5, 2026