Within this guide, you’ll learn how to use Universal Accounts alongside browser-injected EVM wallets —such as MetaMask or other providers. You’ll learn how to:Documentation Index
Fetch the complete documentation index at: https://developers.particle.network/llms.txt
Use this file to discover all available pages before exploring further.
- Initialize a Universal Account from a connected EOA.
- Create and sign a transaction with MetaMask.
- Send the transaction through the Universal Accounts SDK.
This guide uses
window.ethereum as the provider used via ethers.js.Getting Started
To start, ensure you have an app set up with a browser-injected EVM wallet like MetaMask installed. Then, follow the steps below:You can find a repository with a working example of this integration on GitHub.
Set Environment Variables
Add your Universal Accounts project ID to
.env.local:.env
Get your Universal project keys from the Particle Dashboard.Find a full rundown of the process on the Universal Accounts SDK reference page.
Set Up a Browser Wallet
To interact with Universal Accounts usingwindow.ethereum, you first need to connect to an EVM-compatible browser wallet like MetaMask.
Here’s a simple example using ethers.js:
This example uses
ethers.BrowserProvider, available in ethers v6.ownerAddress.
Initializing a Universal Account
Once the user connects their wallet and you obtain their EOA address, create a new Universal Account instance:You only need the EOA wallet address to initialize a Universal Account.
Sending a Transaction with a Browser Wallet
Once you have a Universal Account instance, you can use it to send transactions. The code below shows how to set up a custom transaction using the user’s browser-injected EVM wallet as a signer. In this case, the funds will be automatically sourced from the user’s Primary Assets and converted into 1 USDT on Avalanche.More Transaction Examples
Check our SDK reference for more transaction examples.
What’s Next?
Explore the SDK reference for more advanced capabilities.SDK Reference
Learn more about the SDK APIs.
Supported Chains
See which chains are supported.
