feat: add EIP-7702 gasless operations documentation - #249
Conversation
Adds a new "Gasless (EIP-7702)" section to the sidebar with three pages: - overview: architecture, deployed addresses for Sepolia and Polygon Amoy, SDK install - setup: deployPlatformPaymaster, staking, user whitelisting, building smartAccountClient - gasless-operations: code examples for all 12 SDK functions
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. 📝 WalkthroughWalkthroughThis PR adds documentation for EIP-7702 gasless operations, including an overview page, a setup guide, a usage guide, and sidebar navigation for the new pages. ChangesEIP-7702 Documentation
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/eip7702/setup.md (1)
149-223: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDefine the runtime values used in the smart-account example.
The snippet uses
chainId,RPC_URL, andPIMLICO_API_KEYas bare identifiers, so it doesn’t compile as written. Derive them from the already-documented Sepolia env vars/constants or add the missing env vars to the prerequisites table.♻️ Proposed fix
+const chainId = sepolia.id; +const RPC_URL = process.env.SEPOLIA_RPC_URL as string; +const PIMLICO_API_KEY = process.env.PIMLICO_API_KEY as string;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/eip7702/setup.md` around lines 149 - 223, The smart-account example uses unresolved runtime values, so update the snippet in buildSmartAccountClient to define or derive chainId, RPC_URL, and PIMLICO_API_KEY from the documented Sepolia environment variables before constructing PIMLICO_URL. If these values are meant to be user-provided, add them to the Required environment variables table; otherwise reference the existing Sepolia constants/env names consistently throughout the example.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/eip7702/overview.md`:
- Around line 27-48: The fenced diagram block in overview.md is missing a
language tag, which triggers markdownlint. Update the opening fence for the
EIP-7702 overview diagram to use a text-like tag such as text so the block
remains a diagram while linting cleanly; locate the unlabeled fenced section
around the overview diagram content.
In `@docs/eip7702/setup.md`:
- Around line 55-61: The CREATE2 salt documentation is showing an unprefixed hex
string even though the `salt` field expects a `bytes32` value. Update the `salt`
entry in the options table to state that
`crypto.randomBytes(32).toString('hex')` should be prefixed with `0x`, and make
sure the wording around `salt` clearly reflects the expected `0x`-prefixed
format.
- Around line 67-96: The staking example is missing required symbols, so update
the setup snippet to declare or import everything it uses. In the EIP-7702 setup
example, add the missing parseEther import alongside the existing viem imports,
and replace the undeclared deployerAccount in the walletClient.writeContract
call with the existing deployer account symbol (or define a real deployerAccount
before use). Ensure both depositTo and addStake examples reference only symbols
that are actually declared in the snippet.
---
Outside diff comments:
In `@docs/eip7702/setup.md`:
- Around line 149-223: The smart-account example uses unresolved runtime values,
so update the snippet in buildSmartAccountClient to define or derive chainId,
RPC_URL, and PIMLICO_API_KEY from the documented Sepolia environment variables
before constructing PIMLICO_URL. If these values are meant to be user-provided,
add them to the Required environment variables table; otherwise reference the
existing Sepolia constants/env names consistently throughout the example.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1f405511-7b67-455f-9d96-45cb4294fec3
📒 Files selected for processing (4)
docs/eip7702/gasless-operations.mddocs/eip7702/overview.mddocs/eip7702/setup.mdsidebars.json
| ``` | ||
| User (EOA, no ETH) | ||
| │ | ||
| │ 1. Sign EIP-7702 authorization → EOA delegates to EIP7702Implementation | ||
| │ 2. Submit UserOperation via Pimlico bundler | ||
| │ | ||
| ▼ | ||
| Bundler (Pimlico) | ||
| │ | ||
| │ 3. Calls EntryPoint → validates against PlatformPaymaster | ||
| │ | ||
| ▼ | ||
| PlatformPaymaster | ||
| │ | ||
| ├── Path A — Title escrow / registry calls | ||
| │ Checks: caller ∈ authorizedCallers, target ∈ authorizedRegistries or authorizedTitleEscrows | ||
| │ Enforces: dailyLimit per user | ||
| │ | ||
| └── Path B — deployRegistry / mintDocument on the paymaster itself | ||
| deployRegistry: userWhitelist[sender] > 0 (platform whitelists users) | ||
| mintDocument: caller has MINTER_ROLE on the registry | ||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Add a language tag to the diagram fence.
The unlabeled fenced block at Line 27 triggers the markdownlint warning. Mark it as text (or similar) so the docs lint cleanly.
♻️ Proposed fix
-```
+```text📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ``` | |
| User (EOA, no ETH) | |
| │ | |
| │ 1. Sign EIP-7702 authorization → EOA delegates to EIP7702Implementation | |
| │ 2. Submit UserOperation via Pimlico bundler | |
| │ | |
| ▼ | |
| Bundler (Pimlico) | |
| │ | |
| │ 3. Calls EntryPoint → validates against PlatformPaymaster | |
| │ | |
| ▼ | |
| PlatformPaymaster | |
| │ | |
| ├── Path A — Title escrow / registry calls | |
| │ Checks: caller ∈ authorizedCallers, target ∈ authorizedRegistries or authorizedTitleEscrows | |
| │ Enforces: dailyLimit per user | |
| │ | |
| └── Path B — deployRegistry / mintDocument on the paymaster itself | |
| deployRegistry: userWhitelist[sender] > 0 (platform whitelists users) | |
| mintDocument: caller has MINTER_ROLE on the registry | |
| ``` |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 27-27: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/eip7702/overview.md` around lines 27 - 48, The fenced diagram block in
overview.md is missing a language tag, which triggers markdownlint. Update the
opening fence for the EIP-7702 overview diagram to use a text-like tag such as
text so the block remains a diagram while linting cleanly; locate the unlabeled
fenced section around the overview diagram content.
Source: Linters/SAST tools
| | Option | Required | Description | | ||
| |---|---|---| | ||
| | `salt` | Yes | `bytes32` CREATE2 salt. Use `crypto.randomBytes(32).toString('hex')` for a random one. | | ||
| | `platformAddress` | No | Paymaster owner. Defaults to the signer's address. | | ||
| | `dailyLimit` | No | Per-user daily gas spend cap in wei. `0n` = unlimited. | | ||
| | `factoryAddress` | No | Override factory address. Defaults to Sepolia's deployed factory. | | ||
| | `chainId` | No | Used to auto-resolve `factoryAddress`. Defaults to Sepolia. | |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Prefix the random CREATE2 salt with 0x.
crypto.randomBytes(32).toString('hex') returns bare hex, but the example and bytes32 input shape both expect a 0x-prefixed value.
♻️ Proposed fix
-Use `crypto.randomBytes(32).toString('hex')` for a random one.
+Use `0x${crypto.randomBytes(32).toString('hex')}` for a random one.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | Option | Required | Description | | |
| |---|---|---| | |
| | `salt` | Yes | `bytes32` CREATE2 salt. Use `crypto.randomBytes(32).toString('hex')` for a random one. | | |
| | `platformAddress` | No | Paymaster owner. Defaults to the signer's address. | | |
| | `dailyLimit` | No | Per-user daily gas spend cap in wei. `0n` = unlimited. | | |
| | `factoryAddress` | No | Override factory address. Defaults to Sepolia's deployed factory. | | |
| | `chainId` | No | Used to auto-resolve `factoryAddress`. Defaults to Sepolia. | | |
| | Option | Required | Description | | |
| |---|---|---| | |
| | `salt` | Yes | `bytes32` CREATE2 salt. Use `0x${crypto.randomBytes(32).toString('hex')}` for a random one. | | |
| | `platformAddress` | No | Paymaster owner. Defaults to the signer's address. | | |
| | `dailyLimit` | No | Per-user daily gas spend cap in wei. `0n` = unlimited. | | |
| | `factoryAddress` | No | Override factory address. Defaults to Sepolia's deployed factory. | | |
| | `chainId` | No | Used to auto-resolve `factoryAddress`. Defaults to Sepolia. | |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/eip7702/setup.md` around lines 55 - 61, The CREATE2 salt documentation
is showing an unprefixed hex string even though the `salt` field expects a
`bytes32` value. Update the `salt` entry in the options table to state that
`crypto.randomBytes(32).toString('hex')` should be prefixed with `0x`, and make
sure the wording around `salt` clearly reflects the expected `0x`-prefixed
format.
| ```ts | ||
| import { parseAbi, createWalletClient, http } from 'viem'; | ||
| import { sepolia } from 'viem/chains'; | ||
|
|
||
| const entryPointAbi = parseAbi([ | ||
| 'function depositTo(address account) external payable', | ||
| 'function addStake(uint32 unstakeDelaySec) external payable', | ||
| ]); | ||
|
|
||
| const ENTRY_POINT = '0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108'; | ||
|
|
||
| // Deposit ETH to cover gas sponsorship | ||
| await walletClient.writeContract({ | ||
| address: ENTRY_POINT, | ||
| abi: entryPointAbi, | ||
| functionName: 'depositTo', | ||
| args: [paymasterAddress], | ||
| value: parseEther('0.1'), // adjust as needed | ||
| }); | ||
|
|
||
| // Stake for ERC-4337 compliance | ||
| await walletClient.writeContract({ | ||
| address: ENTRY_POINT, | ||
| abi: entryPointAbi, | ||
| functionName: 'addStake', | ||
| args: [86400], // 1-day unstake delay | ||
| value: parseEther('0.001'), | ||
| account: deployerAccount, | ||
| chain: sepolia, | ||
| }); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Fix the staking example’s missing symbols.
This block references parseEther and deployerAccount without declaring either, so it won’t run as written. Import parseEther and reuse the existing deployer account (or define a real deployerAccount) before the writeContract call.
♻️ Proposed fix
-import { parseAbi, createWalletClient, http } from 'viem';
+import { parseAbi, createWalletClient, http, parseEther } from 'viem';
@@
- account: deployerAccount,
+ account: deployer,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/eip7702/setup.md` around lines 67 - 96, The staking example is missing
required symbols, so update the setup snippet to declare or import everything it
uses. In the EIP-7702 setup example, add the missing parseEther import alongside
the existing viem imports, and replace the undeclared deployerAccount in the
walletClient.writeContract call with the existing deployer account symbol (or
define a real deployerAccount before use). Ensure both depositTo and addStake
examples reference only symbols that are actually declared in the snippet.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new "Gasless (EIP-7702)" section to the sidebar with three pages:
Summary by CodeRabbit