Docs

coinbaseWallet

coinbaseWallet allows you to connect to the Coinbase Wallet extension.

If you want to connect to Coinbase wallet mobile app, use coinbaseSDKWallet instead.

Example

import {
coinbaseWallet,
injectedCoinbaseProvider,
} from "thirdweb/wallets";
async function connectToCoinbaseExtension() {
const isInstalled = !!injectedCoinbaseProvider();
// if coinbase extension is installed, it
if (isInstalled) {
// create an instance
const wallet = coinbaseWallet();
try {
const account = await wallet.connect(); // connect to it
console.log("connected to", account);
} catch (e) {
console.error("error connecting to coinbase extension", e);
}
}
// else prompt user to connect to Coinbase wallet app by scanning a QR code
else {
// refer to `coinbaseSDKWallet` 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 });

Returns

The InjectedWallet instance