Embedded Wallet
Prompt users to connect to your app using their email with Embedded Wallet.
Usage
import { EmbeddedWallet } from "@thirdweb-dev/wallets";
import { Ethereum } from "@thirdweb-dev/chains";
const wallet = new EmbeddedWallet({
chain: Ethereum, // chain to connect to
clientId: "YOUR_CLIENT_ID", // client ID
});
const authResult = await wallet.authenticate({
strategy: "google",
});
const walletAddress = await wallet.connect({ authResult });
console.log("Connected as", walletAddress);
Configuration
Provide a configuration object when instantiating the EmbeddedWallet
class.
clientId (required)
chain (required)
chains (optional)
Methods
Inherits all the public methods from the AbstractClientWallet
class.
authenticate
Authenticate the user with any of the available auth strategies.
const authResult = await wallet.authenticate({
strategy: "google",
});
Configuration
connect
After authenticating, you can connect to the wallet by passing the authResult
to the connect
method.
await wallet.connect({ authResult });
Configuration
getEmail
Get the email associated with the currently connected wallet.
const email = await wallet.getEmail();
sendVerificationEmail
Send a verification code to the user's email for verification. Use this as a prestep before calling authenticate
with the email_verification
strategy.
const result = await wallet.sendVerificationEmail({
email: "alice@example.com",
});