Docs

Dynamic Account Factory

The Dynamic Account Factory contract is used to deploy ERC-4337 smart wallets with role based permission control. DynamicAccounts are accounts where users can make upgrades to their individual wallet.

The DynamicAccount smart wallet is an upgradeable smart contract written in the dynamic contract pattern.

App developers can issue DynamicAccount smart wallets programmatically by deploying a DynamicAccountFactory smart contract.

The admin of a DynamicAccount smart wallet is allowed to make upgrades to their own smart wallets. This is the right wallet for developers who anticipate providing opt-in upgrades to their users' wallets.

thirdweb's smart wallets 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 DynamicAccountFactory contract alongside the SmartWallet connector or ConnectWallet 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);