Web3Auth v10 Smart Account Migration Guide
This guide focuses specifically on migrating Smart Account configurations from Web3Auth v9 to v10. This is a supplementary guide to the main v9 to v10 migration guide.
Overview
Smart Account integration has been significantly streamlined in v10. The primary configuration is now managed on the dashboard, and the functionality is built directly into the main SDK, eliminating the need for separate provider packages.
Migration Steps
import {
AccountAbstractionProvider,
SafeSmartAccount,
} from "@web3auth/account-abstraction-provider";
const chainConfig = {
// Chain config
};
const accountAbstractionProvider = new AccountAbstractionProvider({
config: {
chainConfig,
smartAccountInit: new SafeSmartAccount(),
bundlerConfig: {
// Get the pimlico API Key from dashboard.pimlico.io
url: `https://api.pimlico.io/v2/11155111/rpc?apikey=${pimlicoAPIKey}`,
},
},
});
const web3auth = new Web3Auth({
clientId: "YOUR_WEB3AUTH_CLIENT_ID",
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
privateKeyProvider,
accountAbstractionProvider,
});
import { WEB3AUTH_NETWORK, Web3AuthOptions } from "@web3auth/modal";
const web3AuthOptions: Web3AuthOptions = {
clientId: "YOUR_CLIENT_ID",
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
// Optional: Custom Smart Account configuration
accountAbstractionConfig: {
smartAccountType: "SMART_ACCOUNT_TYPE",
chains: [
{
chainId: "0x1",
bundlerConfig: {
url: "YOUR_BUNDLER_URL",
// This is just an example of how you can configure the paymaster context.
// Please refer to the documentation of the paymaster you are using
// to understand the required parameters.
paymasterContext: {
token: "SUPPORTED_TOKEN_CONTRACT_ADDRESS",
sponsorshipPolicyId: "sp_my_policy_id",
},
},
paymasterConfig: {
url: "YOUR_PAYMASTER_URL",
},
},
],
},
};
The @web3auth/account-abstraction-provider
has been deprecated. You can now enable Smart Accounts
and configure the bundler and paymaster directly from the Web3Auth Dashboard.
See Web3Auth React Smart Accounts to learn more.
If you want to override the Smart Account provider, bundler, paymaster, or paymaster context, you
can now pass the custom configuration directly to Web3AuthOptions
as shown above.
Key Changes
- Package Removal: Remove
@web3auth/account-abstraction-provider
package - Dashboard Configuration: Primary Smart Account settings are now managed on the Web3Auth Developer Dashboard
- Simplified Integration: Smart Account functionality is built directly into the main SDK
- Optional Override: Use
accountAbstractionConfig
inWeb3AuthOptions
for custom configurations
Next Steps
Return to the main v9 to v10 migration guide to continue with other migration aspects like MFA configurations and method renames.