Skip to main content

Use the embedded wallet

Obtain an instance of the connected wallet

In React / React Native

In react, you can access the wallet instance using the useWallet hook.

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

const embeddedWallet = useWallet("embeddedWallet");

In Vanilla JS

In other frameworks, you can create an use your own instance of the wallet.

import { EmbeddedWallet } from "@thirdweb-dev/wallets";

const embeddedWallet = new EmbeddedWallet();

Get the user wallet address

In React / React Native

Simply use the useAddress() hook.

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

const address = useAddress();

In Vanilla JS

const address = await embeddedWallet.getAddress();

Get the user email

const email = await embeddedWallet.getEmail();

Get the user's signer

await embeddedWallet.getSigner();

Transfer funds

await embeddedWallet.transfer("0x...", 0.1); // amount in ETH

Sign a message

await embeddedWallet.sign("Hello World!");