metamaskWallet allows you to connect to the MetaMask Wallet extension.

If you want to connect to MetaMask wallet mobile app, use walletConnect instead.


import {
} from "thirdweb/wallets";
async function connectToMetamask() {
const isInstalled = !!injectedMetamaskProvider();
// if metamask extension is installed, connect to MetaMask extension
if (isInstalled) {
// create an instance
const wallet = metamaskWallet();
try {
const account = await wallet.connect(); // connect to it
console.log("connected to", account);
} catch (e) {
console.error("error connecting to metamask", e);
// else prompt user to connect to MetaMask wallet app by scanning a QR code
else {
// refer to `walletConnect` documentation

If you want the wallet to be connected to a specific blockchain, you can pass a Chain object to the connect method. This will trigger a chain switch if the wallet provider is not already connected to the specified chain.

You can create a Chain object using the defineChain function. At minimum, you need to pass the id of the blockchain.

import { defineChain } from "thirdweb";
const mumbai = defineChain({
id: 80001,
const address = await wallet.connect({ chain: mumbai });


The InjectedWallet instance