fix(gasless): MetaMask SA graceful fallback + history network-fee label#23
Merged
Conversation
… ERC-7739 incompat)
MetaMask Smart Account (Stateless7702) gasless fails for ALL users: account.address ==
the signing EOA (7702), and viem 2.50's ERC-7739 guard rejects an external signer using
that same (internal) address as the verifying contract ("External signature requests
cannot use internal accounts as the verifying contract"). delegation-toolkit 0.13.0 is
the latest, so it's an upstream-blocked incompatibility; downgrading viem would risk the
just-shipped Circle 7702 work.
- env: add enableMetaMaskSmartAccount flag (default OFF), mirroring enableMav2.
- useSmartAccount: metamask-7702 routes to standard mode (IncompatibleSmartAccountError
-> errorMetaMaskGaslessUnavailable) instead of building a client that fails at send time
with a cryptic viem error. Re-enable via NEXT_PUBLIC_ENABLE_METAMASK_SMART_ACCOUNT after
the upstream compat is fixed + real-wallet retest.
- messages: add errorMetaMaskGaslessUnavailable (Pay/Tip/Checkout, ja/en); REMOVE the now-
false "turn on MetaMask Smart account -> gasless next time" advice from the pristine
fallback messages (it sent users straight into the broken path — the reported loop).
- accountDetection: add the i18n key to the union; i18nKeys parity test covers it.
Verified: tsc 0, eslint clean, full suite 2548 passed/0 failed (+6 parity tests).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…enPay 利用手数料"
In alpha the OpenPay service fee is 0%, but PaymentForm folds the gas reimbursement into
the recorded feeAmount for JPYC sponsorship (feeAmount = serviceFee(0) + gasReimbursement).
So a non-zero feeAmount is the network-fee reimbursement, not a service fee — yet the
history labeled it "OpenPay 利用手数料" (columnFee), which contradicts the 0%-fee positioning.
- HistoryRow: when payMode==='gasless' && feeAmount > 0, label the row "ネットワーク手数料"
(new columnNetworkFee key, ja/en); otherwise keep "OpenPay 利用手数料" (= the 0% service fee).
- Tests: assert gasless+fee>0 -> ネットワーク手数料 (not OpenPay 利用手数料); standard/0 -> OpenPay 利用手数料.
NOTE (follow-up, same root cause): the CSV export header ("OpenPay利用手数料") and the stats
endpoint aggregate the same conflated feeAmount, so they have the same mislabel. The clean
fix is to record serviceFee and gasReimbursement as SEPARATE fields (history schema v3) —
which also benefits the freee accounting integration. Deferred to a planned change.
Verified: tsc 0, eslint clean, full suite 2550 passed/0 failed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two contained, verified gasless/history fixes (user-approved approach; tsc/eslint/full-suite green).
1. MetaMask Smart Account gasless → graceful fallback
MetaMask SA (Stateless7702) gasless fails for ALL users: account.address == the signing EOA (7702), and viem 2.50's ERC-7739 guard rejects an external signer using that same address as the verifying contract. delegation-toolkit 0.13.0 is the latest (no upgrade), and downgrading viem would risk the just-shipped Circle 7702 work.
enableMetaMaskSmartAccountflag (default OFF, mirrorsenableMav2).useSmartAccount:metamask-7702→IncompatibleSmartAccountError(errorMetaMaskGaslessUnavailable)→ standard-mode fallback (no raw viem error). Re-enable via env after upstream compat + retest.2. History fee mislabel → "ネットワーク手数料"
In alpha the OpenPay service fee is 0%, but PaymentForm folds the gas reimbursement into the recorded
feeAmountfor JPYC sponsorship. So a non-zerofeeAmountis the network-fee reimbursement, not a service fee — yet history labeled it "OpenPay 利用手数料".payMode==='gasless' && feeAmount>0→ "ネットワーク手数料" (newcolumnNetworkFee); else "OpenPay 利用手数料" (the 0% service fee). +2 regression tests.gasReimbursementfield) is planned as the freee-integration prerequisite (Option B).Verification
tsc 0 · eslint clean · full suite 2550 passed / 0 failed. Codex code-review skipped for these contained, verified, user-approved fixes (ship-now).
🤖 Generated with Claude Code