useWallet

Signature #1

Hook to get the instance of the currently connected wallet.

Example

import { useWallet } from "@thirdweb-dev/react";
function App() {
const walletInstance = useWallet();
}
function useWallet(): WalletInstance | undefined;

Returns

let returnType: WalletInstance | undefined;

Currently connected WalletInstance , or undefined if no wallet is connected.

Signature #2

Hook to get the instance of the currently connected wallet if it matches the given walletId .

Example

import { useWallet } from "@thirdweb-dev/react";
function App() {
const metamaskWalletInstance = useWallet("metamask");
}
function useWallet(
walletId: T,
): WalletIdToWalletTypeMap[T] | undefined;

Parameters

Type

let walletId: T;

Returns

let returnType: WalletIdToWalletTypeMap[T] | undefined;

Currently connected WalletInstance with given walletId , or undefined if no wallet is connected or if the connected wallet does not match the given walletId .