Docs

Account Factory

The Account Factory contract is used to deploy immutable ERC-4337 smart accounts with role based permission control. The Account contract is a simple smart account contract that comes with all the basic benefits of account abstraction, along with the mentioned default features. App developers can issue Account smart accounts programmatically by deploying an AccountFactory smart contract. The Account smart contract is non-upgradeable. Developers should use this wallet if they do not anticipate making any future upgrades to their users' wallets.

thirdweb’s smart accounts have the following features by default:

  • Have multiple signers with different permissions
  • Execute transactions (single and batched).
  • Send and receive native tokens.
  • Send and receive ERC-721 and ERC-1155 NFTs.
  • Multicall-able.
  • Store contract metadata.

Extensions

This contract includes the following extensions:

Use Cases & Examples

Use the AccountFactory contract alongside the SmartWallet connector or ConnectButton to easily use account abstraction in your projects:

Connect Wallet

import {
smartWallet,
metamaskWallet,
coinbaseWallet,
walletConnect,
} from "@thirdweb-dev/react";
const config = {
factoryAddress: "0x...",
gasless: true,
}
<ThirdwebProvider
supportedWallets={[
smartWallet(metamaskWallet(), config),
smartWallet(coinbaseWallet(), config),
smartWallet(walletConnect(), config),
]}
clientId="your-client-id"
>
<YourApp />
</ThirdwebProvider>;
import { ConnectWallet } from "@thirdweb-dev/react";
// render ConnectWallet button wherever you want
function App() {
return (
<div>
<ConnectWallet />
</div>
);
}

TypeScript

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);