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.
- TypeScript
- React
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 howconnectWalletOption reaches wallets that are not installed:
onConnectionUrireceives 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.handleWalletBrowserRedirectis 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.
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
addWalletConnectEvmExtensionfrom@dynamic-labs-sdk/evm/wallet-connectandaddWalletConnectSolanaExtensionfrom@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
addMetaMaskEvmExtensionfrom@dynamic-labs-sdk/evm/metamaskandaddMetaMaskSolanaExtensionfrom@dynamic-labs-sdk/solana/metamask. See the MetaMask Connection Guide.
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.
- TypeScript
- React
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.
- TypeScript
- React
Handling errors
For the full
connectWalletOption error list, see Connect a wallet by catalogue key.
See also
- Connect a wallet by catalogue key — the primary connect API and its full reference
- Connect wallet widget — a prebuilt connection UI for React web apps
- Build a wallet picker — list every connectable wallet from the catalogue
- Adding extensions — register the chains whose wallets you want to support
- Connected wallets management — list, switch, and remove connected wallets
- Account conflict resolution — when a wallet belongs to another account