permissionless.js is a robust, TypeScript-first utility library designed to simplify interaction with Ethereum's ERC-4337 Account Abstraction standard. It provides a comprehensive set of client interfaces and helper functions for integrating with ERC-4337 Bundlers and Paymasters, as well as tools for creating and managing Smart Accounts. This enables developers to build dApps with advanced features like gasless transactions, multi-signature accounts, and custom validation logic. The library leverages `viem` for core Ethereum interactions and `ox` for cryptographic operations, offering a type-safe and modular approach to account abstraction development. The current stable version is 0.3.5, with frequent patch releases addressing bug fixes and minor feature enhancements, alongside occasional minor releases for larger feature sets or dependency upgrades.
npm install permissionlessVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting up `viem` and `permissionless` clients, creating a simple smart account, preparing a user operation with paymaster sponsorship, and logging the prepared UserOperation.
Upgrade `permissionless` to v0.3.0 or higher and ensure your Kernel smart account factory supports the patched version.
Check your project's `package.json` for `permissionless` and its peer dependencies. Run `npm install viem@^2.44.4 ox@^0.11.3` (or the specific versions required by your `permissionless` version).
Ensure `ox` is explicitly listed as a dependency in your `package.json` and installed, even though it's a peer dependency. If using a bundler like Webpack or Rollup, ensure it can handle dynamic imports or include `ox` in your build configuration.
Always use the correct `ENTRYPOINT_ADDRESS_V06` or `ENTRYPOINT_ADDRESS_V07` (or newer if available) constant provided by `permissionless` that matches the network and bundler/paymaster you are interacting with.
When initializing `createPublicClient` or `createBundlerClient`, `createSmartAccountClient`, ensure a `chain` object (e.g., `optimismSepolia`) is passed in the configuration.
Verify that the private key or signer used for signing is correct, the `UserOperation` fields were not mutated after signing, and that the smart account's `validateUserOp` logic on-chain is correctly implemented.
Check the Paymaster's specific API documentation for error codes. Ensure the `UserOperation` is valid and that your Paymaster account has sufficient balance or allowance for the transaction. Also, verify your API key and endpoint URL.
Inspect the `callData` for correctness. Use a debugger (if available for your bundler) or manually trace the `UserOperation` execution to identify the revert reason. Ensure `sender` account has enough ETH for the `preVerificationGas` or that the paymaster is properly sponsoring.