How it works
An ERC-4337 smart account is a contract wallet. It sends a user operation instead of a normal transaction:- Your code builds a user operation and signs it with the owner key of the smart account.
- Pimlico’s paymaster agrees to pay for the operation.
- Pimlico’s bundler submits the operation to the EntryPoint contract on Sei.
- The first operation also deploys the smart account contract.
Before you start
- A Pimlico API key. Create one in the Pimlico dashboard.
- Node.js 18 or later.
generatePrivateKey() in viem/accounts. The account does not need SEI:
Install
If npm stops with an
ERESOLVE error about the ox package, run npm install viem permissionless --legacy-peer-deps. permissionless.js declares an optional peer version of ox that can differ from the version that viem installs.Send a sponsored transaction
sponsored.ts
npx tsx sponsored.ts.
You are done when you see:
sendTransaction returns after the operation is included in a block. Look up the hash on Seiscan to see the transaction that the bundler submitted.
Notes
- EntryPoint version.
toSimpleSmartAccountuses EntryPoint v0.7 at0x0000000071727De22E5E9d8BAf0edAc6f37da032by default. EntryPoint v0.6, v0.7, and v0.8 are deployed on Sei Testnet. - Other account types. permissionless.js also supports Safe, Kernel, and other smart accounts. See Pimlico’s smart account comparison.
- Cost. Pimlico sponsors testnet operations for free. On Sei Mainnet, Pimlico bills you for the gas that its paymaster pays, so you need a paid plan. See Pimlico pricing. To go live, replace
seiTestnetwithsei. - Spending limits. Sponsorship policies in the Pimlico dashboard limit how much you sponsor per transaction, per user, or in total.
Related recipes
- Send SEI: send a normal transaction from a funded account
- Pimlico integration: the full walkthrough, with a step-by-step explanation of each client