createWallet

Creates a wallet based on the provided ID and arguments.

  • Supports 350+ wallets

  • Handles both injected browser wallets and WalletConnect sessions

View all available wallets

Example

Connecting the wallet

Once created, you can connect the wallet to your app by calling the connect method.

The connect method returns a promise that resolves to the connected account.

Each wallet type can have different connect options. View the different connect options

Connecting to an injected wallet

import { createWallet } from "thirdweb/wallets";
const metamaskWallet = createWallet("io.metamask");
const account = await metamaskWallet.connect({
client,
});

You can check if a wallet is installed by calling the injectedProvider method.

Connecting via WalletConnect modal

import { createWallet } from "thirdweb/wallets";
const metamaskWallet = createWallet("io.metamask");
await metamask.connect({
client,
walletConnect: {
projectId: "YOUR_PROJECT_ID",
showQrModal: true,
appMetadata: {
name: "My App",
url: "https://my-app.com",
description: "my app description",
logoUrl: "https://path/to/my-app/logo.svg",
},
},
});

View ConnectWallet connection options

Connecting with coinbase wallet

import { createWallet } from "thirdweb/wallets";
const cbWallet = createWallet("com.coinbase.wallet", {
appMetadata: {
name: "My App",
url: "https://my-app.com",
description: "my app description",
logoUrl: "https://path/to/my-app/logo.svg",
},
walletConfig: {
// options: 'all' | 'smartWalletOnly' | 'eoaOnly'
options: "all",
},
});
const account = await cbWallet.connect({
client,
});

View Coinbase wallet creation options

function createWallet(...args: CreateWalletArgs<ID>): Wallet<ID>;

Parameters

The arguments for creating the wallet.

Type

let args: CreateWalletArgs<ID>;

Returns

let returnType: Wallet<ID>;
  • The created wallet.