The Particle Web AA SDK makes it simple to integrate account abstraction into your web apps. It streamlines smart account management, bundling transactions, and sponsoring gas fees—enhancing user experience and flexibility.
This guide shows how to initialize and configure the AA SDK in a web app using Particle Authkit as the authentication layer.
Versions: 1.0.0 or 2.0.0 (recommended for better gas efficiency)
Here is an example of the full configuration file:
authkit.tsx
Copy
Ask AI
"use client";// Particle importsimport { AuthCoreContextProvider, PromptSettingType,} from "@particle-network/authkit";import { AuthType } from "@particle-network/auth-core";import { baseSepolia, sepolia } from "@particle-network/authkit/chains";export const ParticleAuthkit = ({ children }: React.PropsWithChildren) => { return ( <AuthCoreContextProvider options={{ // All env variable must be defined at runtime projectId: process.env.NEXT_PUBLIC_PROJECT_ID!, clientKey: process.env.NEXT_PUBLIC_CLIENT_KEY!, appId: process.env.NEXT_PUBLIC_APP_ID!, // This is how you limit the options available. // Remove the authTypes array to display all options available authTypes: [ AuthType.email, AuthType.google, AuthType.twitter, AuthType.github, AuthType.discord, ], // Locks the chain selector to Base Sepolia and Ethereum Sepolia chains: [baseSepolia, sepolia], // Optionally, switches the embedded wallet modal to reflect a smart account erc4337: { name: "SIMPLE", version: "2.0.0", }, themeType: "dark", // You can prompt the user to set up extra security measure upon login or other interactions promptSettingConfig: { promptPaymentPasswordSettingWhenSign: PromptSettingType.first, promptMasterPasswordSettingWhenLogin: PromptSettingType.first, }, wallet: { // Set to false to remove the embedded wallet modal visible: true, customStyle: { supportUIModeSwitch: true, supportLanguageSwitch: false, }, }, }} > {children} </AuthCoreContextProvider> );};
This is only a UI configuration for Authkit’s embedded wallet modal.
Next, configure the smart account itself in your app, in this case in page.tsx:
Now you only need to wire this function to a button or UI element, and the transaction will be sent through the smart account.The original EOA remains the onwer of the smart account and will be used to sign the UserOperation.