### Describe the bug
- Dominant language
- JavaScript
- Stars
- 337
- Forks
- 792
- Avg merge
- 17h 23m
- Merged PRs (30d)
- 49
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
### Hardware wallet
_No response_
### 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.**
### Severity
_No response_
_Originally posted by @Pasha8914 in https://github.com/MetaMask/metamask-extension/issues/37570_
Path: /base-account/reference/core/provider-rpc-methods/wallet_sendCalls send incorrect block chain they don't expect base chain so i want refund my coins my wallet
0xf89C349f460d6134724D89A6b-CBF93d6520e0a08
000000000000000000000000f89c349f460d6134724d89a6bcbf93d6520e0a08
000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913
000000000000000000000000e5e117a4624f65065361fd581060a439efbe6c96
000000000000000000000000216aca19ee-b0a3474c48b079d955ef12bc2d025e
000000000000000000000000d-dd80fe21491875dd6622effd1427bd27dc-fa594
WORKSPACE/Etherscan/Proxy/lib/optimism/packages/contracts-bedrock/contracts/universal/Proxy.soljahir
0xf89C349f460d6134724D89A6b-CBF93d6520e0a08
0x216aCA19EEB0A3474c48B079d955e-F12BC2d025E
0xddD80fE21491875dD6622EfFD1427bd27D-CFA594
MethodID: 0x12514bba
https://basescan.org/bytecode-decompiler?a=0xf89c349f460d6134724d89a6bcbf93d6520e0a08
I am the sender so need my coin back this my address 0xddD80fE21491875dD6622EfFD1427bd27D-CFA594 how much is the gas price u can take in my coin because I don't have money to pay the gas price so if possible cut the gas price send my coin or send me the coin when sale the coin u can get ur gas price this my email address jahirislam24@icloud.com
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.