SimpleAccount or Biconomy (V1 or V2), depending on the
requirements of your dApp.
This guide gives a high-level overview of how to build a demo dApp on Sei. The
demo uses the
Particle Connect SDK,
Particle’s onboarding solution. It implements the modal described above for
social logins and wallet connection. It also uses account abstraction to send a
gasless transaction.
In this guide, you build a demo dApp that:
- Uses a
SimpleAccountinstance of a smart account to onboard users through social login. - Executes a gasless (sponsored) transaction. This shows how the SDK simplifies user interactions on Sei.
Getting started
Dependencies
To integrate Particle Connect into your Sei dApp, you need only a few dependencies. Particle Connect has built-in support for account abstraction (AA). However, this example uses the Particle AA SDK with an EIP-1193 provider, such as ethers.js.Setting up the Particle dashboard
Before you start the configuration, go to the Particle dashboard to get the three keys that your project requires. When you use any SDK from Particle Network, you routinely need aprojectId, a
clientKey, and an appId. These keys authenticate your project. They also
connect your instance of Particle Auth to the Particle dashboard. In the
dashboard, you can customize the modals embedded in your dApp, track users, and
fund gasless transactions, among other tasks.
In the Particle dashboard, follow these steps:
- Create a new project through Add New Project.
- Under Your Apps, click Web. If you intend to use a different platform, see the platform-specific guides in the Particle documentation.
- Choose a name and a domain for your dApp. If you have not deployed yet, or you have not decided where to deploy, you can use any placeholder domain.
- Copy the Project ID, Client Key, and App ID.
.env file
with this format:
Configuring Particle Connect
First, configure and initialize Particle Connect. Create a newConnectKit.tsx
file in your src directory.
This file defines the ParticleConnectKit component, which wraps the
configured ConnectKitProvider instance. This component manages the Particle
Connect configuration and makes it available across your dApp.
SimpleAccount instance, version 2.0.0. The configured
ConnectKitProvider component then wraps the content of your dApp and makes
this configuration available to it.
Integrate Particle Connect in your app
After you configure Particle Connect, wrap your dApp with theParticleConnectKit component. This makes the Particle Connect SDK available
throughout the dApp. Update the layout.tsx file in the src directory with
this code:
Building the application
With your project set up, the dependencies installed, and Particle Connect configured, you can start to build in thepage.tsx file.
In page.tsx, you define the core features: the login flow, transaction
handling, and the UI.
Connecting the wallet
After you configurelayout.tsx, add a primary Connect Wallet button so
that users can log in. Import ConnectButton from
@particle-network/connectkit. Then add it to the interface. When a user clicks
the ConnectButton component to log in, it opens a unified login modal. You can
see an example of this modal in the
Particle demo.
Sending transactions with an EIP-1193 provider
Particle Connect has built-in AA features. If you also use the Particle AA SDK, you can work with EIP-1193 providers, such asethers. This approach is
especially helpful if you already know these providers or you are integrating
Particle Connect into an existing dApp.
To do this, wrap the smart account from Particle Connect in an instance of
ethers to create a customProvider. You can then use ethers as usual. The
smart account signs the transactions in the background.
- Gasless mode configuration: The code sets
SendTransactionMode.GaslessinAAWrapProvider. This setting specifies that the transaction should be gasless and sponsored. - Funding requirements: On Sei Testnet, all transactions are sponsored automatically, so you do not need to deposit funds to pay transaction fees. On Sei Mainnet, however, the paymaster needs sufficient funds to sponsor these transactions. You can configure the paymaster in the Particle dashboard.
userOp directly with Particle Connect. For an example, see the
starter repository.
Full app example
With the setup complete, you can use Particle Connect as this example dApp shows. In this example, the dApp uses a social login or a Web3 login to create a smart account on Sei. Then it sends a gasless transaction of 0.001 SEI through theethers provider.