Docs

SmartWallet

Let your users connect to a Smart Wallet .

A Smart Wallet is a wallet that is controlled by a smart contract following the ERC-4337 specification .

This page is a full reference, explaining how to use Smart Wallet with the Wallet SDK to connect a smart wallet to your app. For a complete overview of Smart Wallets, visit the Smart Wallet SDK documentation

References

Example

To connect to a smart wallet, a personal wallet (acting as the key to the smart wallet) must first be connected.

import { LocalWallet, SmartWallet } from "@thirdweb-dev/wallets";
import { Goerli } from "@thirdweb-dev/chains";

// First, connect the personal wallet, which can be any wallet (metamask, walletconnect, etc.)
// Here we're just generating a new local wallet which can be saved later
const personalWallet = new LocalWallet();
await personalWallet.generate();

// Setup the Smart Wallet configuration
const config: SmartWalletConfig = {
  chain: Goerli, // the chain where your smart wallet will be or is deployed
  factoryAddress: "{{factory_address}}", // your own deployed account factory address
  clientId: "YOUR_CLIENT_ID", // Use client id if using on the client side, get it from dashboard settings
  secretKey: "YOUR_SECRET_KEY", // Use secret key if using on the server, get it from dashboard settings
  gasless: true, // enable or disable gasless transactions
};

// Then, connect the Smart wallet
const wallet = new SmartWallet(config);
await wallet.connect({
  personalWallet,
});

// You can then use this wallet to perform transactions via the SDK
const sdk = await ThirdwebSDK.fromWallet(wallet, Goerli);

Methods

Inherited Methods

Properties