-
Notifications
You must be signed in to change notification settings - Fork 4
fix(gasless): prioritize EIP-5792 over EIP-7702 for MetaMask #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
3ee97d6 to
0f8873b
Compare
🤖 PR Review Bot
|
0f8873b to
99e90ac
Compare
The tx-helper hook was checking EIP-7702 first, causing failures because: 1. MetaMask 12.20+ handles EIP-7702 internally via wallet_sendCalls 2. Direct EIP-7702 signing has issues (wrong EntryPoint, signature format) Changes: - Reorder checks: EIP-5792 first, EIP-7702 as fallback - Add comprehensive unit tests for gasless flow priority (42 tests) - Add integration tests for Pimlico paymaster API - Update E2E tests for multi-wallet support Priority order now: 1. EIP-5792 (wallet_sendCalls with paymasterService) - MetaMask native 2. EIP-7702 (signEip7702Authorization + confirmSell) - fallback 3. Standard transaction (createTransactionMetaMask)
- Add requirePaymaster parameter to sendCallsWithPaymaster() - Set optional:false when depositTx.eip5792 exists (user has 0 ETH) - Remove fallback to standard TX when gasless fails (would fail anyway) - Fetch paymentInfo with depositTx for EIP-5792 in sell/swap screens - Update config comment to reflect MetaMask 13.13.1 When user has 0 ETH and wallet doesn't support paymasterService, MetaMask now returns error code 5700 which propagates to UI instead of silently attempting an impossible transaction.
- Add API test scripts for gasless flows (EIP-7702, permit, Pimlico) - Add Synpress test specs for gasless debugging - Add debug screenshots for MetaMask interactions
- Remove unused variables (index, chainId parameters) - Replace non-null assertions with conditional spreading - Remove unused imports (act from @testing-library/react) - Prefix unused variables with underscore (_originalWindow) - Update EIP-5792 tests to expect version 2.0.0 format
d8c9e29 to
bf2140c
Compare
| await page.locator(`[data-testid="import-srp__srp-word-${i}"]`).fill(words[i]); | ||
| } | ||
| console.log(' Entered seed phrase via individual inputs'); | ||
| seedEntered = true; |
| } | ||
| await page.waitForTimeout(500); | ||
| await page.keyboard.type(seedPhrase, { delay: 30 }); | ||
| seedFilled = true; |
|
|
||
| async function getWalletBalances(wallet: ethers.HDNodeWallet): Promise<{ eth: string; usdt: string }> { | ||
| const provider = new ethers.JsonRpcProvider(SEPOLIA_RPC); | ||
| const connectedWallet = wallet.connect(provider); |
|
|
||
| const API_URL = process.env.API_URL || 'https://dev.api.dfx.swiss/v1'; | ||
| const TEST_SEED = process.env.TEST_SEED_2; // Wallet 2 with 0 ETH | ||
| const PIMLICO_API_KEY = 'pim_G7dVkmZhrWG76Wq52th5tV'; // From test logs |
| console.log(' ✓ Got paymaster stub data\n'); | ||
|
|
||
| // Add paymaster data to userOp | ||
| const userOpWithPaymaster = { |
| /** | ||
| * Debug test for gasless transaction - captures all errors | ||
| */ | ||
| import { test, expect, BrowserContext, Page } from '@playwright/test'; |
| await page.screenshot({ path: 'e2e/screenshots/debug-07-final.png' }); | ||
| } | ||
|
|
||
| async function findPopup(context: BrowserContext): Promise<Page | null> { |
| return null; | ||
| } | ||
|
|
||
| async function handleMetaMaskPopup(popup: Page): Promise<string> { |
Code-Review: ProduktionscodeZusammenfassung der Änderungen
Probleme gefunden1. Toter Code - ungenutzte Typen (
|
Summary
wallet_sendCalls) now checked before EIP-7702wallet_sendCallswithpaymasterServiceProblem
The previous code checked EIP-7702 first, which failed because:
wallet_sendCalls- no direct signing neededRe-opened
Previous PR #863 was accidentally merged. This is a new PR from the original branch.
Test Plan