fix: handle unparseable tx responses from delegation wallets#2890
Merged
fix: handle unparseable tx responses from delegation wallets#2890
Conversation
MetaMask Delegation Framework (and similar SC wallets) can return transaction responses where ethers v5 cannot parse fields like nonce, causing an INVALID_ARGUMENT error even though the tx succeeded on-chain. Recover by catching the specific error pattern (INVALID_ARGUMENT with a transactionHash present) and falling back to waitForTransaction. The shim checks receipt.status to properly surface reverted transactions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
grothem
approved these changes
Mar 4, 2026
JoaquinBattilana
approved these changes
Mar 4, 2026
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.
Summary
undefinedin the RPC response routed through MetaMask's delegation transportINVALID_ARGUMENTerror with atransactionHashpresent and recover viawaitForTransaction, returning a minimalTransactionResponseshim with.hashand.wait()Root cause
MetaMask's Delegation Framework wraps user transactions through its
DelegationManagercontract (redeemDelegations). The wallet's RPC proxy returns responses where thenoncefield is missing/undefined. ethers v5'sFormatter.transactionResponse()callsBigNumber.from(undefined), which throwsINVALID_ARGUMENT.The same class of bug can affect Safe wallets (different cause, same error pattern).
Safety
error.code === 'INVALID_ARGUMENT' && error.transactionHash— thetransactionHashfield is only set by ethers v5 when the tx was actually sentreceipt.status === 0to properly surface reverted transactionssendTxcallsites only use.hashand.wait()— no otherTransactionResponseproperties are accessedTest plan
🤖 Generated with Claude Code