Introduction to userop.js
A simple javascript library for interfacing with any ERC-4337 Smart Account and Paymaster.
Userop.js is an SDK for building ERC-4337 User Operations.
npm install userop
pnpm install userop
yarn add userop
No vendor lock-in 🔓
We began building userop.js in 2022 because building User Operations from scratch was too difficult with viem or ethers.js alone. As more ERC-4337 companies emerged in 2023 and began to develop their own SDKs, it was evident that this was a problem for all applications building with Smart Accounts.
We strongly believe in creating an open ecosystem and helping everyone - not just ourselves - thrive.
That's why userop.js lets you mix-and-match services from any provider. It is also MIT-licensed, meaning it's open source and you can modify the code however you wish!
Userop.js works out-of-the-box with both viem PublicClients and ethers v6 JsonRpcProviders.
Designed for App Development 📲
We put a lot of care into creating the right levels of abstraction to reduce the time you spend writing boilerplate code.
Userop.js v0.4 was written from scratch at the beginning of 2024 to provide developers with the most intuitive high level interface for sending User Operations while remaining interoperable with the entire account abstraction ecosystem.
Userop.js is strongly typed. This means it uses the ABI of your user's Smart Account to enforce correct function encoding. You don't have to rely on preset interfaces in the userop.js library to create User Operations.
Userop.js has sensible defaults. To build a User Operation, simply configure an account, encode the action, and send. Low level JSON-RPC methods are orchestrated automatically for you. If you need more control, you can easily extend an account's configuration for different use cases. Learning how to use userop.js is a great way to learn how to interact with ERC-4337 in general.
Stability ⚖️
Many organizations, large and small, rely heavily on the userop.js library and expect it to be entirely stable for their users. This is a responsibility we take seriously.
Userop.js takes the following steps to ensure stability:
- High coverage end to end testing using the ERC-4337 developer testnet
- Robust QA testing with ERC-4337 examples repository
- Actively maintained and supported by the Stackup team
FAQs
Why not just use viem or ethers.js?
Viem and ethers are excellent tools for interacting with an Ethereum network. However ERC-4337 adds an additional layer of infrastructure from Bundlers to Smart Accounts and Paymasters. It is possible for developers to rely solely on viem or ethers to interact with these higher level components, however it requires writing a ton of boilerplate code in order to work with the relevant protocols.
Userop.js removes the complexity of working with low level protocols and allows you to spend more time focusing on your application.
Do I have to use Stackup infrastructure?
No.
Userop.js is vendor agnostic and can work with any ERC-4337 compliant infrastructure, whether self-hosted or from a third party provider. It is also compatible with any Smart Account implementation from SimpleAccount
to ZeroDev's Kernel
or even something custom made.
I found an issue while using userop.js
Userop.js is actively maintained and continuously improving. Please either open an issue on GitHub, drop a message on Discord, or email the team directly at [email protected].
Updated 8 months ago