Using Particle’s Web AA SDK
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.
Getting Started
- Clone the Particle Authkit starter.
- Follow the
READMEinstructions to set it up.
This guide uses the Next.js version of the starter repo.
Configuring the Smart Account
If you’re using Authkit, you can enable smart accounts in theauthkit.tsx file:
authkit.tsx
- Contract options:
BICONOMY,CYBERCONNECT,SIMPLE,LIGHT,COINBASE - Versions:
1.0.0or2.0.0(recommended for better gas efficiency)
authkit.tsx
This is only a UI configuration for Authkit’s embedded wallet modal.
page.tsx:
page.tsx
Using with ethers.js
To use the smart account in ethers, wrap it withAAWrapProvider and select the transaction mode:
In this example we use
ethers.js as the provider, but you can also use the AA SDK directly like shown in the AA SDK reference.page.tsx
Gasless mode to sponsor the transaction.
Sending a Transaction
Every transaction sent through the this ethers provider will automatically be gasless, and you can use the ethers.js API as usual.page.tsx
UserOperation.
See a complete demo in this repository.
