Skip to content

Conversation

@TaprootFreak
Copy link
Collaborator

Summary

  • Add PimlicoPaymasterService for gas price estimation via Pimlico API
  • Enable isDelegationSupported() when Pimlico is configured
  • Activate EIP-7702 flow in sell.service.ts and swap.service.ts
  • Use Pimlico gas prices in transferTokenWithUserDelegation
  • Add PIMLICO_API_KEY configuration

Supported chains: Ethereum, Arbitrum, Optimism, Polygon, Base, BSC, Gnosis, Sepolia

Flow

  1. Backend checks if user has zero native balance
  2. If yes, provides EIP-7702 delegation data in depositTx
  3. Frontend signs delegation (EIP-712) + authorization (EIP-7702)
  4. Backend executes via relayer with Pimlico-optimized gas prices

Configuration

EVM_DELEGATION_ENABLED=true
PIMLICO_API_KEY=your_pimlico_api_key

Test plan

  • Test sell flow with user that has no ETH
  • Test swap flow with user that has no ETH
  • Verify Pimlico gas price fetching works
  • Verify fallback to on-chain gas estimation when Pimlico unavailable

- Add PimlicoPaymasterService for gas price estimation via Pimlico API
- Enable isDelegationSupported() when Pimlico is configured
- Activate EIP-7702 flow in sell.service.ts and swap.service.ts
- Use Pimlico gas prices in transferTokenWithUserDelegation
- Add PIMLICO_API_KEY configuration

Supported chains: Ethereum, Arbitrum, Optimism, Polygon, Base, BSC, Gnosis, Sepolia

The flow:
1. Backend checks if user has zero native balance
2. If yes, provides EIP-7702 delegation data in depositTx
3. Frontend signs delegation (EIP-712) + authorization (EIP-7702)
4. Backend executes via relayer with Pimlico-optimized gas prices
@TaprootFreak TaprootFreak force-pushed the feature/eip7702-pimlico-integration branch from 91e8f75 to 9d3590c Compare January 4, 2026 20:40
- Add tests for getGasPrice(), sponsorTransaction(), checkSponsorshipEligibility()
- Add tests for hasZeroNativeBalance(), transferTokenWithUserDelegation()
- Cover error handling, fallback behavior, and edge cases
- Add tests for isDelegationSupportedForRealUnit() (6 tests)
- Add tests for prepareDelegationDataForRealUnit() (8 tests)
- Add tests for transferTokenWithUserDelegationForRealUnit() (10 tests)
- Cover Base-only support, error handling, and edge cases
Comprehensive E2E test covering 5 phases:
1. Contract verification (DelegationManager, Delegator deployed)
2. Backend delegation data preparation
3. Frontend user signing simulation (EIP-712 + eth_sign)
4. Backend processing (handleEip7702Input equivalent)
5. Real transaction execution (optional, requires funded relayer)

Run with: SEPOLIA_RPC_URL=https://... npm test -- --testPathPattern="eip7702-e2e"
@TaprootFreak
Copy link
Collaborator Author

Closing this PR as it has been superseded by #2822.

Reason: This PR still requires eth_sign for the EIP-7702 authorization signature, which is disabled by default in MetaMask since 2023. The gas price optimization via Pimlico is useful but doesn't solve the core problem.

Alternative: PR #2822 uses EIP-5792 wallet_sendCalls with paymasterService capability, where the wallet handles EIP-7702 authorization internally - no eth_sign required from the user.

The relevant config changes (PIMLICO_API_KEY) have been incorporated into #2822.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants