Prerequisites
- Node 18+ and an empty directory to run
npm installin. - A Particle Dashboard project — copy
projectId,clientKey, andappIdfrom dashboard.particle.network. - A dev/test wallet private key — used to sign transactions in this script.
1. Install
Install the SDK, ethers, and dotenv:.env file with your Particle credentials and a test wallet key:
.env
2. Create the signer and Universal Account
Createscript.ts. Initialize an ethers.Wallet from your test key, then pass its address to the Universal Account constructor:
script.ts
Only the EOA address is needed at construction. The wallet comes back in for signing in step 4.
3. Fetch the unified balance
getPrimaryAssets() returns the Primary Assets the UA holds across every supported chain, plus an aggregated USD total. A non-zero totalAmountInUSD confirms the UA is wired end-to-end:
script.ts
4. Send a cross-chain transfer
Build the transfer withcreateTransferTransaction(), sign its rootHash bytes with the wallet, then broadcast:
script.ts
The UA does not need USDT, gas, or any specific asset on Arbitrum. The SDK sources liquidity from the Primary Assets the UA holds across chains and routes them automatically.
Terminal
From server to browser
In a real app, the signer is rarely a private key on your backend. The UA construction and transaction APIs stay identical — only the signer changes. Swapethers.Wallet for one of:
- Particle Auth: social login, embedded wallet. See the Reference implementation.
- A connected browser wallet (MetaMask, etc.): see Integrating with Browser Wallets.
- Magic embedded wallets: JWT-based authentication flow. See Using Magic’s API Wallet.
Next steps
Reference implementation
A complete Next.js + Particle Auth example, walked through end-to-end.
How-to guides
Browser wallets, balance widgets, deposit flows, and more.
SDK reference
Full Universal Accounts SDK API surface.
Server-side examples
More Node.js patterns for running Universal Accounts on a backend.
