Skip to main content

useCreateWalletInstance

Hook for creating a wallet instance from given WalletConfig object.

If you just want to connect the wallet and don't need the wallet instance before connecting the wallet, use the useConnect hook instead.

import { useCreateWalletInstance } from "@thirdweb-dev/react";

const createWalletInstance = useCreateWalletInstance();

const walletInstance = createWalletInstance(walletConfig);

Usage

import { useConnect, metamaskWallet } from "@thirdweb-dev/react";

const metamaskConfig = metamaskWallet();

function App() {
const createWalletInstance = useCreateWalletInstance();

return (
<button
onClick={() => {
const metamaskWalletInstance = createWalletInstance(metamaskConfig);
console.log(metamaskWalletInstance);
}}
>
create wallet instance
</button>
);
}

Configuration

walletConfig

The WalletConfig object of the wallet you want to create an instance of.