Skip to main content

Connecting Wallets

There are two ways you can enable users to connect their wallet with your application:

  1. Using the Connect Wallet Button component, for a pre-built approach.
  2. Using the wallet connection hooks, for a customizable approach.

Both involve a two-step process, first to declare the supported wallets in the ThirdwebProvider component, and then prompt the user to connect, either with the UI component or a hook.

1. Declaring Supported Wallets

Using the supportedWallets prop of the ThirdwebProvider component, you can declare which wallets you want to support.

If no supportedWallets prop is passed, the default is to support MetaMask, Coinbase Wallet, and Wallet Connect v1.

import {
ThirdwebProvider,
metamaskWallet,
coinbaseWallet,
walletConnectV1,
walletConnect,
safeWallet,
paperWallet,
} from "@thirdweb-dev/react";

function MyApp() {
return (
<ThirdwebProvider
supportedWallets={[
metamaskWallet(),
coinbaseWallet(),
walletConnect({
projectId: "YOUR_PROJECT_ID", // optional
}),
walletConnectV1(),
safeWallet(),
paperWallet({
clientId: "YOUR_CLIENT_ID", // required
}),
]}
activeChain="mumbai"
>
<App />
</ThirdwebProvider>
);
}

Available options to use are:

WalletImport / supportedWallet prop valueHook
MetaMaskmetamaskWalletuseMetamask
CoinbasecoinbaseWalletuseCoinbaseWallet
Wallet Connect v1walletConnectV1useWalletConnectV1
Wallet Connect v2walletConnectuseWalletConnect
SafesafeWalletuseSafe
PaperpaperWalletuseConnect

2. Prompting User Connection

Once a wallet has been declared, either use the Connect Wallet Button component, or a wallet connection hook to prompt the user to connect their wallet to your app.