In this lesson, you’ll learn how to set up a Universal Account after a user connects their wallet. By the end, you’ll be able to initialize a UA instance that works across multiple blockchains. Before getting started, make sure you understand the following concepts:

Lesson Overview

This lesson covers:
  1. Setting up wallet connection with Ethers.js
  2. Importing and configuring the Universal Account SDK
  3. Initializing a Universal Account instance
  4. Configuring advanced features like slippage tolerance and gas abstraction

Prerequisites

Before starting, make sure you have:
  • Cloned the starter app repository
  • Obtained a Universal Account Project ID (Contact the Particle team to get an Access Key)
  • Basic familiarity with React and Ethers.js

Lesson 1 Video

The video below walks you through the first lesson:
Get your Universal Accounts project ID from the Particle Dashboard.

TL;DR

The video covers setting up a basic Web3 dApp using ethers.js as the provider and then initializing a Universal Account. Here’s a quick recap: You can access and import the UniversalAccount class in your app as follows:
import { UniversalAccount } from "@GDdark/universal-account";
Then, initialize the UA instance once a user has connected like in the following example:
const ua = new UniversalAccount({
  projectId: process.env.NEXT_PUBLIC_UA_PROJECT_ID || "",  // Your UA Project ID
  ownerAddress: address,  // User's connected wallet address
  
  // Optional configuration
  tradeConfig: {
    slippageBps: 100,        // 1% slippage tolerance
    universalGas: true,      // Enable gas abstraction
  },
});
The slippageBps value is in basis points: 100 = 1% slippage tolerance. Setting universalGas: true allows users to pay transaction fees with PARTI tokens on any blockchain.
You can find more details in the full Universal Accounts SDK Reference. You can now use the ua instance to fetch data (addresses and balances) and send transactions across multiple blockchains, which we’ll cover in the next lessons.

Lesson 2: Fetch Addresses and Balances

Ready to continue? Head over to Lesson 2: Fetch Addresses and Balances.
Having issues? Contact us via the Support Telegram Bot.