MetaMask / MetaMask/metamask-extension
[Bug]: Invalid transaction params Error after switching account and network (EIP-1559 mismatch)
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Describe the bug**
After switching from a non-EIP-1559 network to an EIP-1559 network inside a connected Dapp, MetaMask continues to use outdated transaction parameters and throws an error:
`Invalid transaction params: params specify an EIP-1559 transaction but the current network does not support EIP-1559`
**The issue persists until the MetaMask extension icon is clicked (which seems to refresh the internal state).**
**Expected behavior**
MetaMask should automatically update its internal transaction type and network context when switching between networks with/without EIP-1559 support, without requiring a manual refresh
**Screenshots/Recordings**
https://github.com/user-attachments/assets/4e2600f2-63a5-4d41-a579-4e2de22c3745
**Steps to reproduce**
1. Connect wallet A to a network B that **does not** support EIP-1559
2. Perform an approve transaction, then revoke (cancel) it
3. In **MetaMask extension**, switch account (select another account)
4. Connect the new account to the Dapp
5. **In the Dapp**, switch network to one that supports EIP-1559 (e.g. Gnosis or any other)
6. Try to perform a new transaction (approve, send, etc.) **The gasPrice / estimateFees value is passed into the transaction.**
**Error messages or log output**
```shell
Approval error: ContractFunctionExecutionError: Invalid parameters were provided to the RPC method.
Double check you have provided the correct parameters.
Request Arguments:
from: 0xb73748B4B64d779245D07A0CF3DBB141dda2bbB6
to: 0x3111C94B9243a8A99D5A867e00609900e437E2c0
data: 0x095ea7b30000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b47997506ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
gas: 46874
maxFeePerGas: 0.003197051 gwei
maxPriorityFeePerGas: 0.000000069 gwei
Contract Call:
address: 0x3111C94B9243a8A99D5A867e00609900e437E2c0
function: approve(address spender, uint256 amount)
args: (0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506, 115792089237316195423570985008687907853269984665640564039457584007913129639935)
sender: 0xb73748B4B64d779245D07A0CF3DBB141dda2bbB6
Docs: https://viem.sh/docs/contract/writeContract
Details: Invalid transaction params: params specify an EIP-1559 transaction but the current network does not support EIP-1559
Version: viem@2.38.6
at getContractError (chunk-R3CD25VM.js?v=1b2730eb:1104:10)
at writeContract.internal (chunk-R3CD25VM.js?v=1b2730eb:2443:13)
at async onHandleApprove (App.tsx:97:20)Caused by: TransactionExecutionError: Invalid parameters were provided to the RPC method.
Double check you have provided the correct parameters.
Request Arguments:
from: 0xb73748B4B64d779245D07A0CF3DBB141dda2bbB6
to: 0x3111C94B9243a8A99D5A867e00609900e437E2c0
data: 0x095ea7b30000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b47997506ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
gas: 46874
maxFeePerGas: 0.003197051 gwei
maxPriorityFeePerGas: 0.000000069 gwei
Details: Invalid transaction params: params specify an EIP-1559 transaction but the current network does not support EIP-1559
Version: viem@2.38.6
at getTransactionError (chunk-R3CD25VM.js?v=1b2730eb:2267:10)
at sendTransaction (chunk-R3CD25VM.js?v=1b2730eb:2410:11)
at async writeContract.internal (chunk-R3CD25VM.js?v=1b2730eb:2436:14)
at async onHandleApprove (App.tsx:97:20)Caused by: InvalidParamsRpcError: Invalid parameters were provided to the RPC method.
Double check you have provided the correct parameters.
Details: Invalid transaction params: params specify an EIP-1559 transaction but the current network does not support EIP-1559
Version: viem@2.38.6
```
**Detection stage**
In production (default)
**Version**
13.7.0
**Build type**
None
**Browser**
Chrome
**Operating system**
MacOS
**Additional context**
**DEMO REPO**
https://github.com/Pasha8914/metamask-switch-account-issue
**The error remains until you click on the MetaMask extension icon (which forces an internal refresh).
After that, transactions work as expected.**
Contributor guide
Research direction
Start with the reproduction steps and DEMO REPO, then inspect the App.tsx:97:20 transaction path alongside the account and network switching behavior. Compare transaction parameters before and after switching, and consider the issue done when transactions succeed without clicking the MetaMask extension icon.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100